28 views (last 30 days)

Show older comments

Moisés Antonio Fonseca Beltrán
on 17 Apr 2021 at 9:38

Commented: Alan Stevens
on 18 Apr 2021 at 7:36

Hi,

I want to get the factorized format of a symbolic polynomial.

I know how to get the factors in symbolic way:

syms x

factor(x.^2-1)

ans =

[ x - 1, x + 1]

This is an array with factors.

But, I want to get as answer something like

(x - 1)*(x + 1)

how could I get it? I remember in ancient versions this was the result.

Do I have to build this expression?

In this case, any sugestion in order to make it?

Thanks in advance.

Alan Stevens
on 17 Apr 2021 at 10:14

syms x

y=x^2-1;

a = factor(y)

b = a(1)*a(2)

Alan Stevens
on 18 Apr 2021 at 7:36

Yes, it looks like you'll have to deal with the scalar factor by hand.

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

Start Hunting!