How to determine which operand has type 'RootOf' in MuPad?

1 visualizzazione (ultimi 30 giorni)
Hi All,
I have an expression which contains the multiply operands from Type 'solvelib::VectorImageSet', where one of the operands contains a 'RootOf'. I am trying to identify which operand contains the 'RootOf'.
Below is the matlab output from the mupad object 'test':
test =
({matrix([[Ct], [0], [0]])} union Dom::ImageSet(matrix([[(2*Ct)/3 - Ot/3 + Sit/3 - z/3], [Ct/3 + Ot/3 - Sit/3 - (2*z)/3], [z]]), z, RootOf(z1^4 + (z1^3*(- 6*Ct*R^2*T^2 + 3*Ot*R^2*T^2 + 6*R^2*Sit*T^2))/(3*R^2*T^2) - (4*Keq1*Vpore^2*z1^2)/(3*R^2*T^2) + (z1*(4*Ct*Keq1*Vpore^2 + 4*Keq1*Ot*Vpore^2 - 4*Keq1*Sit*Vpore^2))/(3*R^2*T^2) - (Ct^2*Keq1*Vpore^2 + Keq1*Ot^2*Vpore^2 + Keq1*Sit^2*Vpore^2 - 2*Keq1*Ot*Sit*Vpore^2 + 2*Ct*Keq1*Ot*Vpore^2 - 2*Ct*Keq1*Sit*Vpore^2)/(3*R^2*T^2), z1))) minus Dom::ImageSet(matrix([[z], [z1], [0]]), [z, z1], [C_, C_])
My goal is to isolate out the operand that has 'Dom::ImageSet' and contains the 'RootOf'. Is there anyway to identify it by type? Is 'RootOf' even a type that can be used for identification?
For this example I know that
op(op(test,1),2) =
Dom::ImageSet(matrix([[(2*Ct)/3 - Ot/3 + Sit/3 - z/3], [Ct/3 + Ot/3 - Sit/3 - (2*z)/3], [z]]), z, RootOf(z1^4 + (z1^3*(- 6*Ct*R^2*T^2 + 3*Ot*R^2*T^2 + 6*R^2*Sit*T^2))/(3*R^2*T^2) - (4*Keq1*Vpore^2*z1^2)/(3*R^2*T^2) + (z1*(4*Ct*Keq1*Vpore^2 + 4*Keq1*Ot*Vpore^2 - 4*Keq1*Sit*Vpore^2))/(3*R^2*T^2) - (Ct^2*Keq1*Vpore^2 + Keq1*Ot^2*Vpore^2 + Keq1*Sit^2*Vpore^2 - 2*Keq1*Ot*Sit*Vpore^2 + 2*Ct*Keq1*Ot*Vpore^2 - 2*Ct*Keq1*Sit*Vpore^2)/(3*R^2*T^2), z1)))
will give the operand from the main tree that I am seeking, but would like a better way than visual inspection to find where this operand is in the tree structure.
Thanks

Risposta accettata

Walter Roberson
Walter Roberson il 8 Set 2011
It appears to be possible, but not trivial.
I do not have the Symbolic Toolbox to test with, and the type system of MuPad is not as easy to work with as the type system of Maple.
It appears to me that you would probably want to start with map() in order to traverse the set elements. The mapped function would call indets(), probably with the PolyExpr option. You would then intersect that with Type::Union(Type::Function, Type::Predicate(XXX)) where XXX is something like XXX->bool(op(0,XXX) = RootOf)
It would probably be messier than this as you want to find the part that contains the RootOf, rather than just the RootOf expression itself.
In Maple, isolating the RootOf expression would be trivial:
indets(X,RootOf)
In Maple, isolating any other specific function name (say logGAMMA for example) would be
indets(X, specfun(anything,logGAMMA))
Perhaps I missed something when I went through the MuPad type predicates, but it appeared that the type expressions I use the most often in Maple are messy in MuPad.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by