Classic Fourier Series
|
01-31-2015, 09:11 PM
(This post was last modified: 01-31-2015 09:17 PM by Snorre.)
Post: #11
|
|||
|
|||
RE: Classic Fourier Series
Hello Salvo,
a program is always a good idea ;-) Just two tips: 1st: You should take care of the argument types your program expects. Your code seems to expect fun to be an expression (not a function) with t (and only t) being the independent variable, so the typical usage looks like: fourcoeff(t²,1) or f(x):=x² and fourcoeff(f(t),1). By that you have to always remember that fun must be an expression of t. And furthermore, t must not be defined already. If you change your program slightly by Code: ... 2nd: Your program returns a sequence (an object similiar to those created by the builtin seq function), not a vector/list. That is totally OK as long as it was your intention. Just be aware that sequences behave quite differently when used in further calculations, for example 0+fourcoeff(...) vs. 0+[fourcoeff(...)]. If you want your program to return a vector or list, put the last expression return a0,ak,bk; within brackets or braces: return [a0,ak,bk]; or return {a0,ak,bk};. Greetings |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 7 Guest(s)