Solve for symbol not finding explicit solution

5 views (last 30 days)
Hi all,
Im trying to isolate/solve an equition for a symbol, but both the solve and isolate function arent providing any solutions.
Heres my code:
clear
syms H SH AO RA;
t = sqrt(H / pi);
r = (0.506 * t + 1.0) / (1.79 * t^2 + 2.045*t + sqrt(2.0));
a = 1.0 / (0.803 * t^3 + 1.886 * t^2 + 2.524*t + 2.0);
c = 0.5 - r * sin(0.5 * pi * (a - t^2));
s = 0.5 - r * cos(0.5 * pi * (a - t^2));
eqn = ((pi * (cos(H / 2.0) * c + sin(H / 2.0) * s)^2) / ( RA^2 * (sin(H / 2.0 + AO))^2)) == SH;
answer = solve(eqn, H);
I've looked on this forum and google and ive tried a bunch of stuff but i cant figure this out
  2 Comments
John D'Errico
John D'Errico on 21 Feb 2019
Even making it more precise is not going to do it though. Replacing the number 0.5 with1/2 is not going to magically make everything solvable, even if you can also replace those other constants like 1.886, 2.045, etc., with infinitely high precision analogs.
You are still left with a problem that will have no solution to be found unless you resort to providing numerical values for SH, AO, RA. And even then you will need to use a numerical solver, one that will only find one solution at best, that will be dependent on the starting values used.
Remember there will be almost surely infinitely many solutions to any such trig problem. But they will not be simple things like adding some multiple of pi for many of those solutions. You will probably find multiple solutions (if any exist) just in the interval [-pi,pi]. And then you might possibly be able to add any multiple of 2*pi to that. Again, that is only a wild guess based on a glance at the nature of the problem. In fact as I look at it, since H enters inside the trig functions in a nonlinear fashion, while there will still probably be infinitely many solutions, they won't be easily predictable.
Walter Roberson
Walter Roberson on 21 Feb 2019
Edited: Walter Roberson on 21 Feb 2019
There is sqrt(H) in the definition of t, so H cannot be negative.
1/RA^2 acts as a scale parameter, so at any given location, H, if the left side of the equation would be non zero and non-infinite, you can achieve any given SH by adjusting the RA.
Once past the first stretch, the left hand size has a denominator that becomes 0 at intervals of 2*Pi; in particular, at 2*Pi - 2 * AO . Therefore the equation becomes infinite, an infinite number of times.
For AO between 0 and approximately 27/64, there is an initial stretch of H values between 0 and approximately 4.59 where the equation increases at first and decreases again, possibly reaching 0. AO acts as a phase modifier on that. At roughly 27/64 the phase becomes critical and at larger AO values, that initial stretch disappears.
I have not yet been able to determine whether the left hand side reaches back down to 0 each time, or just to a small-ish value. It just might be the case that for fixed RA and AO > 0.86-ish, that for sufficiently small positive SH (on the order 1E-9 or smaller) there are perhaps no solutions, but it might also be the case that there are infinite number of solutions; closer analysis would have to be done.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 21 Feb 2019
Asking for an analytical solution to an equation involving floating point numbers is always a mistake. Are you working to 1 significant digit such as for your 0.5 or are you working at 2 such as your 1.0 or at 3 such as your 0.803 or at 4 digits such as your 1.886?
Remember that to 1 significant digit 0.5 means everything from 0.45 inclusive to 0.55 exclusive. No solution you could arrive at can be accurate to more than +/- 1/2 relatively because of the 1 significant digit in the coefficients , so why are you trying to find an infinitely precise solution ?
Before you can consider asking for infinitely precise solutions you need to be using infinitely precise equations, or else you are GIGO (Garbage In Garbage Out)
  1 Comment
JBerteling
JBerteling on 21 Feb 2019
You're both right, i shall try to make my equition more precise. Thank you both!

Sign in to comment.

More Answers (1)

John D'Errico
John D'Errico on 21 Feb 2019
Edited: John D'Errico on 21 Feb 2019
And you "know" a solution exists? What is it? Not all problems have an analytical solution. How is it that you assert a solution MUST exist?
That you want a solution to exist is something, but really only wishful thinking. If you were willing to assign numerical values to those additional symbolic parameters, then you could search for solutions, of which there will probably be infinitely many solutions. That is pretty common with trig problems. But you would then use a rootfinder, like fzero.
But to hope that solve will succeed on this mess is a just a wish and a prayer.
eqn =
(pi*(cos(H/2)*((sin((pi*(H/pi - 1/((943*H)/(500*pi) + (631*H^(1/2))/(250*pi^(1/2)) + (803*H^(3/2))/(1000*pi^(3/2)) + 2)))/2)*((253*H^(1/2))/(500*pi^(1/2)) + 1))/((179*H)/(100*pi) + 2^(1/2) + (409*H^(1/2))/(200*pi^(1/2))) + 1/2) - sin(H/2)*((cos((pi*(H/pi - 1/((943*H)/(500*pi) + (631*H^(1/2))/(250*pi^(1/2)) + (803*H^(3/2))/(1000*pi^(3/2)) + 2)))/2)*((253*H^(1/2))/(500*pi^(1/2)) + 1))/((179*H)/(100*pi) + 2^(1/2) + (409*H^(1/2))/(200*pi^(1/2))) - 1/2))^2)/(RA^2*sin(AO + H/2)^2) == SH
Really? And you expect that to be valid for any values of SH, A0, RA? You are indeed a bit of an optimist, I see. H appears in how many places there, in how many forms?

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!