A positive root of an equation

13 Ansichten (letzte 30 Tage)
Fares
Fares am 12 Dez. 2022
Kommentiert: Fares am 12 Jan. 2023
Hello dear,
I have a mathemtaical model and one of the dependant variable, M, is a positive root of a nonlinear equation. I am not interested in finding this M but I would like to tell MATLAB that M is a positive root of the equation r(M)(a+P(M))(K-d)-bKM=0. How to do that?
Thank you!

Akzeptierte Antwort

Torsten
Torsten am 12 Dez. 2022
Without further knowledge about the background of your question:
Maybe by setting (r(M)(a+P(M))(K-d))/(bK) instead of M in your model.
  22 Kommentare
Torsten
Torsten am 12 Jan. 2023
I changed the code above so that it now gives correct results.
I didn't notice that "coeffs" gives the vector of polynomial coefficients in the reverse order as "roots" expects them. Therefore the "fliplr" command had to be added.
Sorry for that.
Fares
Fares am 12 Jan. 2023
Thanks Torsten for your replay.
No need to be sorry. Many thanks for your continuous support!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

John D'Errico
John D'Errico am 12 Dez. 2022
Bearbeitet: John D'Errico am 12 Dez. 2022
syms M r0 epsilon rho k1 K b m alpha omega mu k2 eta sigma
P = (r0*(1+k1*(mu+(rho*M)/(1+M))*(1-k2*(mu+(rho*M)/(1+M)))))*(eta+(epsilon*M)/(1+M))*(K-alpha*sigma*m*(eta+(epsilon*M)/(1+M))*(1+(mu+(rho*M)/(1+M)))-b*(m+alpha)*(pi*M-omega))-b^2*alpha*K*(pi*M-omega) == 0
P = 
If you multiply by (M+1)^2, then regardless if I assume that m is not just a typo where you intended to write M in one place, this would appear to be effectively a 6th degree polynomial in M as long as M~=1.
If all of those parameters have known values, then you can just use vpasolve to return the 6 roots. If you want to find a solution in terms of symbolc parameters all as unknowns, then you are wasting your time. Abel-Ruffini (long before any of us was born) showed that general polynomials of degree higher than 4 will have no solutions in algebraic form. (Except for certain trivial cases.)
Of course, if you wish, you always can try this:
Msol = solve(P,M,'maxdegree',6,'returnconditions',true)
Msol = struct with fields:
M: [6×1 sym] parameters: [1×0 sym] conditions: [6×1 sym]
Msol.M
ans = 
Which is MATLAB's way of telling you that as much as it wants to solve the problem, it cannot resolve the issue of mathematical impossibility.

Community Treasure Hunt

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

Start Hunting!

Translated by