(02-01-2015 03:10 AM)Han Wrote: Again, you need to understand the difference between a function and an expression.
g:=x^2; <-- this creates an expression whose name is g
g(x):=x^2; <-- this creates a function whose name is g
a0:=int(fun(t),t,0,2*PI)/(2*PI); <-- this creates a variable named a0 whose value is the result of integrating a function named 'fun' (which hopefully you've already pre-defined); if 'fun(t)' is not defined, then a0 is an expression (otherwise a0 is presumably a numerical value)
ak:=int(fun(t)*cos(k*t),t,0,2*PI)/PI; <-- this creates a variable named ak whose value is the result of integrating the product of the function 'fun(t)' and 'cos(k*t)'; if 'fun' and 'k' were predefined prior to creating ak, then ak is just a numerical value; otherwise ak is an expression (same as a0)
Neither a0 nor ak are functions when defined this way. However, the CAS will let you get away with using expressions as if they were functions -- it will just always throw warnings/complaints about using expressions as if they were functions. So don't do it if you don't want to see the warnings.
ak(f,k):=int(f(t)*cos(k*t),t,0,2*PI)/(2*PI); <-- this creates a function named a0, whose arguments are a CAS function f and a constant k; that means 'f' must be a function (see the g(x):=x^2 example), and NOT an expression (see the g:=x^2 example)
Once you understand the difference between the two, your warnings will go away.
Han - thanks for these explanations/clarifications; your detailed examples are very useful for learing to use CAS, and some of the more exotic features.
fyi - For your final example, in the explanation 'a0' should be 'ak', that is if I understood it correctly.