Real solutions to a polynomial

Hi, I am stuck to this task: I am trying only to get the real solutions to the function
A = [1 -12 55 -120 124 -80]
B = roots(A)

4 Comments

First of all
A = [1 -12 55 -120 124 -80]
is not a function. But
A = [1 -12 55 -120 124 -80]
B = roots(A)
yields
B =
4.699 + 0i
3.067 + 1.6505i
3.067 - 1.6505i
0.58351 + 1.031i
0.58351 - 1.031i
so, all the roots for the polynomial with the terms in A are imaginary, except the first:
>> isreal(B(1))
ans =
logical
1
I did this: I got "good" answers for a and d but not for the ones in the middle;
A = x^5 - 12*x^4 + 55*x^3 - 120*x^2 + 124*x == 48;
a = solve(A,x,'Real',true)
B = 5*x^6 - x^4 + 70*x^2 - 10*x == 50;
b = solve(B,x,'Real',true)
C = 3*x^5 - x*4 - 12*x^3 + 12*x^2 == 10;
c = solve(C,x,'Real',true)
D = x^5 - 13*x^4 + 64*x^3 - 152*x^2 + 176*x == 80;
d = solve(D,x,'Real',true)
>> Matlab412
a =
1
2
2
3
4
b =
root(z^6 - z^4/5 + 14*z^2 - 2*z - 10, z, 1)
root(z^6 - z^4/5 + 14*z^2 - 2*z - 10, z, 2)
c =
root(z^5 - 4*z^3 + 4*z^2 - (4*z)/3 - 10/3, z, 1)
root(z^5 - 4*z^3 + 4*z^2 - (4*z)/3 - 10/3, z, 4)
root(z^5 - 4*z^3 + 4*z^2 - (4*z)/3 - 10/3, z, 5)
d =
2
2
2
2
5
O know b and c are not monomial and coefficents of highest order is non-zero though

Sign in to comment.

Answers (1)

A = randi([-9 9], 1, 6)
A = 1×6
-7 -4 4 4 -2 9
B = roots(A)
B =
-1.0813 + 0.6487i -1.0813 - 0.6487i 1.0967 + 0.0000i 0.2472 + 0.8223i 0.2472 - 0.8223i
B(imag(B)==0)
ans = 1.0967

Asked:

on 24 Apr 2021

Commented:

on 24 Apr 2021

Community Treasure Hunt

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

Start Hunting!