get only addends of subexpression
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
David Armendáriz
il 15 Mar 2018
Commentato: Walter Roberson
il 15 Mar 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 Commento
Steven Lord
il 15 Mar 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, ...).
Risposta accettata
Walter Roberson
il 15 Mar 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Get Started with MuPAD in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!