get only addends of subexpression
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
David Armendáriz
am 15 Mär. 2018
Kommentiert: Walter Roberson
am 15 Mär. 2018
Suppose I have a symbolic expression like this
syms x x0
f=(x-x0)^3
children(f)
[(x-x0),3]
I would like to get instead
[(x-x0)^3]
How can this be done?
1 Kommentar
Steven Lord
am 15 Mär. 2018
Can you say a little more about your ultimate goal? Perhaps there's a way to do what you want without running a MuPAD expression via feval(symengine, ...).
Akzeptierte Antwort
Walter Roberson
am 15 Mär. 2018
You cannot do that with children().
You need to do something like,
feval(symengine, '(V) -> if testtype(V,"_plus") then [op(V)] else [V] end_if;', f)
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MuPAD finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!