Effacer les filtres
Effacer les filtres

how do I combine terms with a common power in a polynomial

4 vues (au cours des 30 derniers jours)
Howard Padmore
Howard Padmore le 13 Juin 2023
Commenté : Dyuman Joshi le 16 Juin 2023
I am using the symbolic toolbox and am new to it. I have taylor expanded an expression that is a function of x and y. Part of the expansion is
y^2/(2*R) + x^2/(2*R*cos(t)^2) + (A*y^3)/(2*R) + (B*y^4)/(8*R) + (A^2*y^4)/(2*R) + (A^3*y^5)/(2*R)
1st 3 terms in y^2, x^2 and y^3 are fine, but y^4 is split into two terms that should be combined. Anyone know how to do this? Code is
syms z x y t R A B
T=taylor(((x^2*(sec(t))^2+y^2)/((R*((1-A*y)+((1-A*y)^2-B*(x^2*(sec(t))^2+y^2))^0.5)))),[x,y],'Order',6)
T1=collect(T,[x y])
T2=combine(T1,'IgnoreAnalyticConstraints',true)
T3=expand(T2)
  5 commentaires
Howard Padmore
Howard Padmore le 16 Juin 2023
Perfect......many thanks!
Dyuman Joshi
Dyuman Joshi le 16 Juin 2023
Glad to have helped!

Connectez-vous pour commenter.

Réponse acceptée

Dyuman Joshi
Dyuman Joshi le 14 Juin 2023
Modifié(e) : Dyuman Joshi le 14 Juin 2023
"What I really want is to not have the sigmas at all, ie. just mutiply them out. Is this possible?"
It is possible.
From the documentation page Abbreviate Common Terms in Long Expressions - By default, live scripts display symbolic expressions in abbreviated output format.
You can turn off abbreviated output format by setting the 'AbbreviateOutput' preference to false.
syms z x y t R A B
%Change the setting
sympref('AbbreviateOutput',false);
f=taylor(((x^2*(sec(t))^2+y^2)/((R*((1-A*y)+((1-A*y)^2-B*(x^2*(sec(t))^2+y^2))^0.5)))),[x,y],'Order',7);
f1=collect(f,[x y]);
f2=combine(f1,'IgnoreAnalyticConstraints',true);
f3=expand(f2);
f4=collect(f3,[x y])
f4 = 

Plus de réponses (0)

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by