Hello,
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?
>
> (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.
>
> 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
Here is a basic example:
(C1) t:[1,2];
(D1) [1, 2]
(C2) h(m):=block(m[1]:0,m);
(D2) h(m) := BLOCK(m : 0, m)
1
(C3) h(t);
(D3) [0, 2]
(C4) t;
(D4) [0, 2]
hope this helps,
JDF