[Maxima] Question regarding passing functions as arguments
amli at comcast.net
Wed Aug 30 23:28:32 CDT 2006
Thanks giovanni. I had made a mistake in defining my function with  rather than (). Now it works. I also tried to verify with a simple example
h(t):=t^3 + t;
and it gives me result as expected.
(%o24) 3 t + 1
I think I can pass function as arguments rather than passing expression that defines the function.
Thanks for the link.
-------------- Original message ----------------------
From: giovanni gherdovich <g_gherdovich at yahoo.it>
> Hello Ram,
> > [...]
> > listarray(t);
> > f(x):=(x-3)*(x-6)*(x-9);
> > for i:1 thru nm4 do
> > [...]
> In this script you specify the function, but you
> don't know how to pass the function as an argument
> to a more general script.
> I had the same problem, and after few experiment I
> found a way that worked for me: you must pass
> the expression af your function to the script, than
> you have to define the function inside the script
> from this expression. I mean:
> compCoef(input_expression):= block (
> /* now you can work with f(x) */
> Then you can pass to the script expressions like
> (x-3)*(x-6)*(x-9), or whatever you want.
> You can write comments in the script using slash and
> star, like
> /* I'm a comment */
> Hope to help.
> I found useful these tutorials to programming in
> Giovanni Gherdovich
> p4.vert.ukl.yahoo.com uncompressed/chunked Thu Aug 31 00:13:36 GMT 2006
> Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
More information about the Maxima