changing variables in syms

If I am working in syms and I say
c= I * (a * I + b * J)
How do I tell matlab that I want I * J = 0 so that it outputs
c = I * (a * I)?

 Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 12 Okt. 2011

0 Stimmen

subs(c,'J',0)
since J or I has to be zero in the substitution and you want I retained.

4 Kommentare

Franco
Franco am 12 Okt. 2011
neither is zero. Basically Im trying to take the dot product of the 2 unit vectors I and J, so I not J is 0, but I*J =0
Walter Roberson
Walter Roberson am 12 Okt. 2011
I doubt that would output
c = I * (a * I)
as required by the poster. It would instead output
c = I^2 * a
or
c = a * I^2
It might even output
c = -a
Retaining bracketing in expressions of equal algebraic priority is tricky in symbolic engines, at least without visible constructs such as Mathematica's HOLD .
Walter Roberson
Walter Roberson am 12 Okt. 2011
Franco, I * J does not express dot product. MuPad expresses dot product via the MuPad routine linalg::scalarProduct (which is not exposed at the MATLAB level.)
If you are using the Maple based symbolic engine, then Maple's dot product operator is . (period), as in maple('A . B')
Franco
Franco am 12 Okt. 2011
thanks Walter.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by