Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
'z' variable appears in my symbolic solution in cubic form (without any RootOf) when using 'solve'
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to obtain the fixed points of 3 differential equations using the symbolics, and once I have the equations for each fixed point, I want to try different values of the parameters to see for which of them the fixed points remain positive. The code is below and if you run it, you will see that in the solutions form the "solve" I get my symbolics plus a new one that I do not use that is the "z" which appears in a cubic form. The problem is that I do not know where does this come from so I do not know how to deal with this, since I can not use the symbolic form to see if those parameter values are working.
Thank you very much!
% code
syms w n b alpha_w alpha_n1 alpha_n2 alpha_b1 alpha_b2
Parameters = {};
for i = 0.1:0.1:2
for j = 0.1:0.1:2
for k = 0.1:0.1:2
for l = 0.1:0.1:2
for m = 0.1:0.1:2
syms w n b alpha_w alpha_n1 alpha_n2 alpha_b1 alpha_b2
[w, n, b] = solve(w == ((alpha_w*b)/(1+b)), n == ((alpha_n1*w)/(1+w))+((alpha_n2*n)/(1+n)), b == ((alpha_b1*n)/(1+n))+((alpha_b2*w)/(1+w)));
fw = symfun(w, [alpha_w, alpha_n1, alpha_n2, alpha_b1, alpha_b2]);
fb = symfun(b, [alpha_w, alpha_n1, alpha_n2, alpha_b1, alpha_b2]);
fn = symfun(n, [alpha_w, alpha_n1, alpha_n2, alpha_b1, alpha_b2]);
if fw(i,j,k,l,m) > 0 && fb(i,j,k,l,m) > 0 && fn(i,j,k,l,m) > 0
Parameters = {'alpha_w=%d, alpha_n1=%d, alpha_n2=%d, alpha_b1=%d, alpha_b2=%d',i,j,k,l,m};
end
end
end
end
end
end
댓글 수: 0
답변 (1개)
Megha Parthasarathy
2017년 5월 16일
편집: Walter Roberson
2017년 5월 16일
Hello,
You may specify the 'MaxDegee" option as 3 in the "solve" function. When we solve a higher order polynomial equation, the solver might use "RootOf" to return the results.
To get an explicit solution for such equations, we need to call the solver with 'MaxDegree' argument set to 3. This option specifies the maximum degree of polynomials for which the solver tries to return explicit solutions. The default value is 2. By increasing this value, you can get explicit solutions for higher order polynomials.
Refer to the following code to obtain y in terms of x and c :
clear all
close all
clc
syms x y c;
sol=solve(x*(c - y)^3 - y == 0, y, 'MaxDegree', 3)
Refer to the following documentation for more details:
You can further simplify the resulting expressions using:
simplify(sol,'Steps',100)
Hope this helps.
Megha
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!