Subject: Question regarding passing functions as arguments
From: giovanni gherdovich
Date: Thu, 31 Aug 2006 02:43:42 +0200 (CEST)
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 (
...
define(f(x),input_expression),
/* 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
Maxima:
http://maxima.sourceforge.net/docs/intromax/intromax.html#tth_sEc7http://maxima.sourceforge.net/docs/tutorial/en/gaertner-tutorial-revision/Pages/Programming0001.htm
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
http://mail.yahoo.it