Classic Fourier Series
|
02-01-2015, 03:10 AM
(This post was last modified: 02-01-2015 03:51 AM by Han.)
Post: #15
|
|||
|
|||
RE: Classic Fourier Series
(01-31-2015 09:53 PM)salvomic Wrote: Yes, however, I would export a list of three arguments: a0 (however this one is always the same), ak, bk... 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 ak, 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. Graph 3D | QPI | SolveSys |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)