That's not quite what I'm looking for. Sorry, I wrote this right
before I went to bed last night. I am looking to replace the vector
[-x,-y,-z] in %i2 with -c. The purpose of %i3 was to show that if I
manually enter the -1 multiplier, it works. This works for scalars,
though not with my vector example. Maybe I am approaching it wrong?
Thanks,
Tim
On Tue, Oct 16, 2012 at 6:31 AM, Jaime Villate <villate at fe.up.pt> wrote:
> 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)
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima