solving an equation with no analytical solution
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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!
채택된 답변
John D'Errico
2016년 3월 2일
편집: John D'Errico
2016년 3월 2일
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
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! :)
John D'Errico
2016년 3월 2일
편집: John D'Errico
2016년 3월 2일
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...
Assaf Lavi
2016년 3월 3일
편집: Assaf Lavi
2016년 3월 3일
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.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
