# Solutions are only valid under certain conditions

조회 수: 13(최근 30일)
Tiku 2021년 5월 13일
댓글: Tiku 2021년 5월 14일
Hi,
I am trying to solve for g in terms of y and z and I believe the solve command should give me four roots in terms of y and z.
But the warning says
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
I tried to use 'ReturnConditions' value as 'true' but didn't work out.
My code is
%solving fourth order algebraic equation to get g
syms x n g y z
x = 0.0585;
n = 0;
solve(1/g-sqrt(1 + z.^2/((2*n+1)*pi*y + 4.4*pi*x*g).^2) == 0, g);
g

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

### 채택된 답변

Walter Roberson 2021년 5월 13일
편집: Walter Roberson 2021년 5월 13일
You can get four solutions. However, the solutions will be effectively useless, and the conditions under which they apply will be unreadable.
%solving fourth order algebraic equation to get g
syms g y z
x = 0.0585;
n = 0;
Pi = sym(pi);
eqn = 1/g-sqrt(1 + z.^2/((2*n+1)*Pi*y + 4.4*Pi*x*g).^2) == 0;
sol = solve(eqn, g, 'returnconditions', true, 'maxdegree', 4);
G = simplify(sol.g)
C = simplify(sol.conditions)
Furthermore...
solve() is for finding indefinitely precise solutions. However, your input value 0.0585 is not indefinitely precise, instead representing some value between 5845/100000 (inclusive) and 5855/100000 (exclusive). It does not make logical sense to ask for exact solutions when some of the inputs are known precisely known. There are y, z values for which this makes a difference. Quartics can be very sensitive to exact values in determining which parts are real valued or which parts are complex valued.
##### 댓글 수: 3표시숨기기 이전 댓글 수: 2
Tiku 2021년 5월 14일
I think I am not able to explain problem properly so I have attached pdf file detaling the process and the required equations. The equations are derived from a pubished review paper and I am trying to reproduce the plot.
Could you please have a look?
Thank you

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

### Community Treasure Hunt

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

Start Hunting!

Translated by