Solutions are only valid under certain conditions

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

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 13 Mai 2021
Bearbeitet: Walter Roberson am 13 Mai 2021
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 Kommentare

Tiku
Tiku am 13 Mai 2021
Bearbeitet: Tiku am 13 Mai 2021
Thank you for the reply.
Actually my main aim is to solve two nonlinear equations self consistently for y and z in the below equations with the value of g for each n from previous solved equation.
The two equations are
%Solving two nonlinear equations self consistently for y and z where sum runs over n
%and for each n need to plug in values of g from above equation
sceq1 = 2*pi*symsum((2*n+1)*pi*(g-1)/(((2*n+1)*pi + 0.4*pi*x/y)*((2*n+1)*pi + 0.4*pi*x*g/y)),n,0,10)- psi(1/2 +0.2*x/y)+ psi(1/2+0.2*x/1.02)- log(y/1.02);
sceq2 = 2*pi*symsum((2*n+1)*pi*(g-1)/(((2*n+1)*pi + 4.4*pi*x/y)*((2*n+1)*pi + 4.4*pi*x*g/y)),n,0,10)- psi(1/2 +2.2*x/y)+ psi(1/2)- log(y/1.7);
Here sum runs over each n and for each n we have different g from above equation which you already helped me to solve it.
I know I should use vpasolve or solve in matlab.
1/g-sqrt(1 + z.^2/((2*n+1)*Pi*y + 4.4*Pi*x*g).^2) == 0;
Could you please help me to solve for y and z?
I don't know my second question makes sense or not?
One more thing gn is assumed to be real.
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.
Tiku
Tiku am 14 Mai 2021
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 13 Mai 2021

Kommentiert:

am 14 Mai 2021

Community Treasure Hunt

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

Start Hunting!

Translated by