solving an equation with no analytical solution

Hi everybody, so I'm trying to solve an equation which doesn't have an analytical solution. I tried using numeric::solve but the problem is I have parameters in my equation and it says "Symbolic parameters are not allowed in nonpolynomial equations". "solve" doesn't help either.
The equation is: cos(b*x)=cos(a*b)+b*a*sin(a*b)-b*x*sin(b*a)
While a,b are constant parameters and x is the variable. I want the solution for x as a function of a and b. Is this even possible? Thanks!

 Accepted Answer

John D'Errico
John D'Errico on 2 Mar 2016
Edited: John D'Errico on 2 Mar 2016
Why do you assume that EVERY equation you might possibly write down has a solution?
There is no analytical solution for the problem you have written.
Since your problem has symbolic constants that can take on ANY values, then there also can never be a numerical solution. No numbers, no numerical solution. The two go together. If you substitute values for a and b, then of course it is possible to find a numerical solution, though still not an analytical one in general.
Sorry, but magic only works for Harry Potter, and he left town recently.

8 Comments

Thanks for the answer! I'm not assuming every equation I might write has a solution. I have gotten this particular equation through some simple physical derivation which, according to my professor, should be possible to solve using MatLab. Maybe I screwed up something on the way and got this non-sense equation.
But, in general - is it possible to get a parametric solution to an equation with no analytical solution, or is it impossible in principle? For example if I have a more simple equation like sinx=a*x ?
Thanks again! :)
Nope. Sorry, but no. There is no analytical solution to the equation you have written. At least none that I know of, and probably because it is not a terribly useful problem to solve.
Of course, you COULD define a special function. Lets call it the Lavi function. This is a solution often used. Once done, you need to do nothing more, well beyond a lot of work to get Lavi(x) accepted by the world of mathematicians who might care about it. By definition, the solution to the problem sin(x)==a*x is just Lavi(a). Write a few papers, showing how it is useful, what problems it solves, and provide code to evaluate the function given any value for a. Of course, since that equation has one OR more solutions, depending on the value of a, you will next need to define the solution desired. Thus 0 might be called the degenerate solution, and the first non-zero solution (if one exists, thus for positive a, a<1 is necessary for the existence of a non-zero solution) will be the principal solution. Thus
Lavi(a,0) == 0
Lavi(a,1) is the principal solution, etc.
Look at that, a paper in the works! Send it into Mathematics of Computation, or some such journal. (Feel free to cite my response in your paper.) Some research might be a good idea, to verify that nobody has yet done the same. This seems to be a simple enough problem that it may have been done already, but I'm not sure why it would be sufficiently valuable that anyone would really care to have done the work.
Think about it. Where do you think special functions like Bessel, erf, LambertW, etc., came from? Somebody realized that the solution to a specific problem was needed often enough to justify a special function. So get in on the ground floor!
Yes, I know that somebody will then go on to extend your result, showing where the Lavi(a,n) function SHOULD be defined for non-integer values of n, or even complex n. This will then create an entirely new branch of mathematics, that will be employed in solving some unsolved Hilbert problem. The end result is they will get the Fields medal, whereas your name will be lost in obscurity. :)
See how I did that? First, I made you famous, the author of ground breaking papers. Then I sent you tumbling down into the depths of obscurity. Such is fame. Enjoy your 15 minutes. :)
Hey, I still have the name of the function after me!
Thanks again for the help! I guess I'm just doing something wrong.
I'm not claiming you are doing something wrong. But there are certain problems that have no simple solution.
In your problem, if you have no numeric values for a and b, there are still some things you MIGHT do. For example, you MIGHT decide to create a large grid of values for a and b. Compute the numerical solution for EVERY combination of a and b in that grid. Note that in some cases, there will be multiple solutions. Take the principal one. So now, you have essentially x(a,b), but defined only on that grid of points. You could then use interpolation to evaluate it at other points. You can use surf, contour, or pcolor to plot it. Lots of things you could do. You will never gain a functional form for that relationship, although you might decide to try to find a simple approximation, if you can find one.
Another idea is to expand everything in the form of a Taylor series. Now you have a polynomial, with non-constant coefficients, the roots of which will not be available beyond 4th order analytically. So, IMHO, this last idea is probably not really that valuable.
Personally, I like the approach of generating x(a,b) on a mesh, at least to start. You can look at it. Make lots of nice pretty plots. Understand what the surface looks like, and maybe then go forward from there. It depends on what your goals and needs are for this solution.
For example...
[ag,bg] = meshgrid(-2:.25:2);
xab = NaN(size(ag));
syms a b x
E = cos(b*x) == cos(a*b)+b*a*sin(a*b)-b*x*sin(b*a);
for i = 1:numel(ag)
xi = vpasolve(subs(E,{a,b},{ag(i),bg(i)}),x)
xab(i) = double(xi(1));
end
surf(ag,bg,xab)
It would probably be smarter to choose which root I take from vpasolve, in case there is more than one found. And I might think to ensure that it looks only for real roots.
There is often much you can learn though from a simple plot. Here, I'm not sure what the lesson is, but...
Hi again! I realized my equation was not quite right and now I have a slightly simpler one with just one parameter (yay!):
cos(x)+xsin(a)=asin(a)+cos(a)
Also, I realized I'm only interested in values of -pi<a<pi. How do I do what you did but with only one parameter? I've never worked with Matlab before so I'm confused.
Thanks for all the help!
ag = linspace(-pi,pi,250);
syms a x
E = cos(x)+x*sin(a) == a*sin(a)+cos(a);
xa = NaN(size(ag));
for i = 1:numel(ag)
xi = vpasolve(subs(E,a,ag(i)),x);
xa(i) = double(xi(1));
end
plot(ag,xa)
It does not seem terribly interesting though, and fairly sensitive to the value of a. There may be multiple solutions for some values of a, I only chose the first one that vpasolve found.

Sign in to comment.

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!