# [Maxima] defining a function

Sam Steingold sds at gnu.org
Tue Mar 31 17:16:07 CDT 2009

```I think I am doing something fairly trivial, but somehow it does not work:
this works:
(%i37) a(x):=x+1;
(%o37)                                                       a(x) := x + 1
(%i38) a(1);
(%o38)                                                             2
this does not:
(%i31)
expand(integrate(exp(x),x,-1,1)/integrate(1,x,-1,1) +
t*integrate(exp(x)*x,x,-1,1)/integrate(x*x,x,-1,1) +
f(t)*integrate(exp(x)*f(x),x,-1,1)/integrate(f(x)*f(x),x,-1,1));
2        - 1  2
- 1
5 %e t    65 %e    t        - 1
%e   121 %e
------- - ----------- + 3 %e    t - -- +
---------
6           6
18      18
(%i32) g(t):=(%o31);
(%o32)                                                        g(t) := %o31
(%i33) g(3);
2        - 1  2
- 1
5 %e t    65 %e    t        - 1
%e   121 %e
(%o33)                                     ------- - ----------- + 3 %e    t -
-- + ---------
6           6
18      18

how do I tell maxima that g(t) is a quadratic function?
how do I evaluate and plot it?

thanks.

```