vpa, simplify, solve, etc don't fully simplify symbolic function.

I am doing integration using MATLAB's symbolic toolbox. I have many functions of my independent variable, z. This is my code, with numbers changed and the problem simplified. I have F1 print at the end just so I can see what the function resolves to.
l = 50;
a = 10;
W = 1200;
syms Q(z);
Q(z) = 1200 + 56*z - 2.5*z^2;
R = - int(Q(z), [0 l]) + W;
syms F1(z) F2(z) F3(z);
F1(z) = simplify(- int(Q(z), [0 z]) - R,"IgnoreAnalyticConstraints",true);
F1
F1(z) = 
Even with simplify and "IgnoreAnalyticConstraints" being set to true, F1 is in the form "73900/3 - (z*(- 5*z^2 + 168*z + 7200))/6" instead of az^3/b + cz^2/d + ez/f + g, the fully simplified method. vpa just puts all fractions in numeric form, and eval doesn't really do anything. What am I missing, as I know that there should be some method to this simple operation of simplifying a polynomial.

답변 (2개)

Paul
Paul 2025년 1월 31일
편집: Paul 2025년 2월 1일
l = 50;
a = 10;
W = 1200;
syms Q(z);
Q(z) = 1200 + 56*z - 2.5*z^2;
R = - int(Q(z), [0 l]) + W;
syms F1(z) F2(z) F3(z);
F1(z) = simplify(- int(Q(z), [0 z]) - R,"IgnoreAnalyticConstraints",true)
F1(z) = 
[c,t] = coeffs(F1(z),z,'all')
c = 
t = 
F1(z) = sum(c.*t)
F1(z) = 
Walter Roberson
Walter Roberson 2025년 1월 31일
이동: Walter Roberson 2025년 1월 31일
l = 50;
a = 10;
W = 1200;
syms Q(z);
Q(z) = 1200 + 56*z - 2.5*z^2;
R = - int(Q(z), [0 l]) + W;
syms F1(z) F2(z) F3(z);
F1(z) = expand(- int(Q(z), [0 z]) - R)
F1(z) = 

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

릴리스

R2023b

질문:

2025년 1월 31일

편집:

2025년 2월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by