How to assign values to variables



Robert Dodier wrote:

>hello paul,
>
>  
>
>>I am using maxima to program a simple physic model.
>>Let's imagine that at some point of my program, I get a matrix like :
>>
>>U:MATRIX([U1x],[U1y],[U2x],[U2y])
>>
>>and an other one like
>>
>>Fm:MATRIX([SIN(x)],[COS(x)],[SIN(x)^2],[ATAN(x)])
>>
>>I am looking for a way to assign Fm elements to U elements,
>>element-per-elements.
>>I mean that at the end of the process, typing U1y; should return cos(x)
>>for exemple, or U2x; should return sin(x)^2.
>>    
>>
>
>i find that this seems to do it:
>
>  matrixmap (lambda ([a, b], a :: b), U, Fm);
>
>(1) matrixmap -- apply some function to elements of a matrix,
>see also map, apply, and lambda
>(2) "::" operator evaluates its left hand side,
>in this case we want to assign to whatever U[k] contains,
>not assign to U[k] itself
>  
>
Even better ! Thank you very much.
My piece of code is aimed to solve *symbolicaly* Finite Element Problems,
the main advantage with a analytical (=symbolic) solution is that it is 
faster
to study :)
I keep the previous code because it can help me to define a new 
procedure like
assign(var1,var2); so that at the end, value of var2 is assigned to the
symbol passed to var1 :)

Thank you again

paul

>
>  
>