A positive root of an equation

조회 수: 7 (최근 30일)
Fares
Fares 2022년 12월 12일
댓글: Fares 2023년 1월 12일
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!

채택된 답변

Torsten
Torsten 2022년 12월 12일
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
Torsten
Torsten 2023년 1월 12일
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 2023년 1월 12일
Thanks Torsten for your replay.
No need to be sorry. Many thanks for your continuous support!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

John D'Errico
John D'Errico 2022년 12월 12일
편집: John D'Errico 2022년 12월 12일
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.
  댓글 수: 1
Fares
Fares 2022년 12월 12일
Thanks John for your help!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by