Implementing an expression in Matlab's Symbolic Math Toolbox
1 次查看(过去 30 天)
显示 更早的评论
Good day,
At the moment I have got equations which look like:
A = ....- q1^2*q1c*q3c + q1*q3*q1c^2 - q1*q3*q2c^2 - q1*q3*q3c^2 + q1*q3*q4c^2 - 2*q1*q4*q1c*q2c - 2*q1*q4*q3c*q4c - q2^2*q1c*q3c + q2^2*q2c*q4c + 2*q2*q3*q1c*q2c + 2*q2*q3*q3c*q4c + q2*q4*q1c^2 - q2*q4*q2c^2 - q2*q4*q3c^2 + q2*q4*q4c^2 + q3^2*q1c*q3c - q3^2*q2c*q4c + q4^2*q1c*q3c - q4^2*q2c*q4c))/((q1*q1c + q2*q2c + q3*q3c + q4*q4c)*(q1^2 + q2^2 + q3^2 + q4^2)*(q1c^2 + q2c^2 + q3c^2 + q4c^2))
Now I know that:
q1c^2+q2c^2+q3c^2+q4c^2 = 1
q1^2+q2^2+q3^2+q4^2 = 1
I like to introduce this information such that I can work with more simplified expressions, because the ones I work with at the moment are very large.
Any ideas how I can achieve this?
2 个评论
Walter Roberson
2013-5-20
If q1c^2+q2c^2+q3c^3+q4c^4 = 1 then what would you like (q1^2 + q2^2 + q3^2 + q4^2) to be transformed to?
Will the expression q1c^2+q2c^2+q3c^3+q4c^4 appear specifically as a sub-expression, or do you need to (for example) have MuPAD detect that
5*q3c^4 + 5*q3*q2c^2 + 5*q4c^4*q3c + 5*q3c*q1^2
is
5*q3c*(q1c^2+q2c^2+q3c^3+q4c^4)
and so substitute
5*q3c*1
which is
5*q3c
?
回答(1 个)
Walter Roberson
2013-5-20
simplify(subs(A, {q4c^2, q4^2}, {1 - (q1c^2+q2c^2+q3c^2), 1 - (q1^2+q2^2+q3^2)}))
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!