On 10/16/2012 04:25 AM, Tim Josey wrote:
> I am new to Maxima, and have been having this problem for a while. I
> want to do a simple substitution for a vector, and in this case I
> can't get it to work with just a scalar multiplier of -1. In my output
> below, I would like input 2 to work as I'm expecting.
>
> (%i1) load("lrats")$
> (%i2) lratsubst([[x,y,z]=c], [-x,-y,-z]);
> (%o2) [- x, - y, - z]
Hi Tim,
welcome to Maxima.
If I understood correctly, you would want x, y and z to be replaced by c
in the "vector" [-x, -y, -z] ?
The error with your %i1 is explained in the documentation for lratsubst:
"The first argument of `lratsubst' is an equation or a list of
equations identical in format to that accepted by `subst'."
[x,y,z]=c is not accepted as an equation or list of equation. But you
can use "makelist" to build the list of equations you need:
(%i3) lratsubst (makelist (v=c, v, [x,y,z]), [-x,-y,-z]);
(%o3) [- c, - c, - c]
Does that answer your question?
Best regards,
Jaime
P.S. Notice that some time ago the notation [x,y,z]: [2,3,4] was
introduced in Maxima but, as far as I know, nobody has made a similar
change in subst, to make it accept: subst ([x,y,z] = [2,3,4], x*y/z)
You still have to use the traditional syntax: subst ([x=2, y=3, z=4], x*y/z)