13 views (last 30 days)

Show older comments

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

Walter Roberson
on 13 May 2021

Edited: Walter Roberson
on 13 May 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.

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

Start Hunting!