I'm getting error as "First argument must be scalar" while finding roots of a 8 degree poynomial

9 visualizzazioni (ultimi 30 giorni)
root([2*A*B*K^2 - B^2*K^2 - A^2*K^2, - 4*A*B*K^2*R + 2*B^2*K^2*R + 2*A^2*K^2*R + 2*B*C*K^2 - 2*A*C*K^2, - 2*B*C*K^2*R + 2*A*C*K^2*R + 2*A*B*K^2*R^2 - B^2*K^2*R^2 - A^2*K^2*R^2 - C^2*K^2, -1, + 5*R, - 10*R^2, + 10*R^3, -5*R^4, R^5])
%this is what i'm doing , actually i needed all real roots in terms of variables, but i'm getting error that says first argument must be scalar

Risposta accettata

Matt J
Matt J il 3 Dic 2021
Modificato: Matt J il 3 Dic 2021
You have 2 problems.
First, you are trying to find analytical expressions for the roots of an 8-degree polynomial, which is mathematically impossible.
Second, you are confusing the syntaxes of the two different commands root() and roots(). You can find the roots of an 8-degree polynomial with the roots() command, but not with symbolic input variables.
  2 Commenti
Apurva Suman
Apurva Suman il 3 Dic 2021
yes ,i realized that
Thanks.
Actually this is what i'm trying to do ,I need x = function of all other terms;
i.e an explicit solution for x
is it possible?
because with this i'm getting a 8 degree equation , even if i neglect higher order terms to get the roots ,i'm not getting satisfactory answer, i need x as a function of almost all other terms(i.e K A B C R) or at least 2 of them
Note: x will have a very small value, upto x^3 its not neglibile but terms with power above than that can be neglected
syms K A B C x R
eqn = ( ( (R^2)*K*( A - B - (C/R*(1- x)) )*((x^3)/(1-x)) )^2 ) == R*(1- x) ;
SS = solve(eqn,x,'MaxDegree',2,"ReturnConditions",true);
Matt J
Matt J il 3 Dic 2021
x will have a very small value, upto x^3 its not neglibile but terms with power above than that can be neglected
But all of the polynomial coefficientsterms below x^5 depend on R only:
syms K A B C x R
P= ( ( (R^2)*K*( A - B - (C/R*(1- x)) )*((x^3)/(1-x)) )^2 ) - R*(1- x) ;
P=simplify( simplifyFraction(P*(x - 1)^2),'Steps',5);
Coeffs=coeffs(P,x,'All');
Coeffs(end-5:end)
ans = 

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by