Solutions are only valid under certain conditions
79 次查看(过去 30 天)
显示 更早的评论
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.
Can someone please help me, shouldn't be a big issue I guess in the above problem?
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
0 个评论
采纳的回答
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 个评论
Walter Roberson
2021-5-13
How does
1/g-sqrt(1 + z.^2/((2*n+1)*Pi*y + 4.4*Pi*x*g).^2) == 0;
fit in with sceq1 and sceq2 ? It uses n, but n only exists inside the symsum() .
You could potentially solve the equation over a set of four different n values, getting out x, y, z, g values, but your symsum runs to 5, and the equation cannot be consistently extended to 5 different n values.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Oceanography and Hydrology 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!