How to simplify a symbolic polynomial with respect to x?
3 views (last 30 days)
Show older comments
Thanks. What I want is:
syms a b c x
equ = (x-a)*(x-b)+(x-c)
%some code
ans = x^2-(a+b-1)*x+a*b-c
0 Comments
Accepted Answer
Stephan
on 24 May 2018
Hi,
use the
collect
command:
syms a b c x
equ = (x-a)*(x-b)+(x-c)
f = collect(equ)
gives:
f =
x^2 + (1 - b - a)*x - c + a*b
which is the version you want sorted by powers of x - just a little bit rewritten, but following your wishes.
Best regards
Stephan
More Answers (0)
See Also
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!