How to simplify a symbolic polynomial with respect to x?

 Risposta accettata

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

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by