Fabrizio Caruso wrote:
> Hello,
>
> I have a serious problem with parameters in Maxima.
> I don't understand parameters passing in Maxima:
>
> (1) is there a way to pass an array/matrix as a parameter by reference?
> For example, in order to have a function change some elements in an
> array/matrix,
> do I always need to copy the whole array/matrix locally?
The issue is... if you do array(z,3,3) and
have a function
f(h):= ..... h[2,2] ... then call as f(z),
a (new) array, h, appears to be used, rather than z[2,2].
Something like f(h):= ... q:ev(h), q[2,2]:... would
seem to be needed, or an assignment statement that
evaluates h[2,2]::: differently.
A way around this is to NOT pass z as a parameter, but leave
it global.
>
> (2) how do I declare an array local? do I need to use the "local"
> command. Putting it in brackets after the "block" command seems not to
> work.
>
maybe block ([a], array(a,3,3)... ) will do what you want?
> Could you give me a toy example?
> like for instance a function that modifies a matrix passed as a parameter
> by setting one value to zero.
>
> Thanks in advance
>
> Fabrizio Caruso
>
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima