How to solve the below equation.

2 views (last 30 days)
P=30;A=1.73*10^-5;R=1.35; a=1.5;
P*A*R/x^2=(pi/2)-(a/x)*sqrt(1-(a/x)^2)-asin(a/x)
I tried to solve but I am not getting expected value. I am getting
x=-2.1904584724526039369361593374613e278980111
which is not true.

Accepted Answer

John D'Errico
John D'Errico on 29 May 2017
Edited: John D'Errico on 29 May 2017
It is NEVER right to just throw something at a computer without applying cognitive thought, and then hope the computer does something intelligent. If you cannot bother to do something intelligent, then how do you expect a computer program do be more intelligent that you?
PLOT EVERYTHING. Think about what you see. Do this BEFORE you throw something at solve, or any algorithm. Certainly do that as soon as you see something that you don't understand. Then think about what you see.
EQ = -P*A*R/x^2 + (pi/2)-(a/x)*sqrt(1-(a/x)^2)-asin(a/x);
ezplot(EQ),grid
As you should see, there MAY be a root near x==1.5.
However, does this problem have an analytical solution? Of course not! So if you throw it at solve, solve will give up quickly enough, and call vpasolve.
But what is the default start point for vpasolve? x==0. This relation seems to not even produce real values near x==0, and there is a singularity at x==0.
subs(EQ,x,0)
Error using symengine
Division by zero.
Error in sym/subs>mupadsubs (line 150)
G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 135)
G = mupadsubs(F,X,Y);
vpa(subs(EQ,x,.1))
ans =
- 0.070064999999999992737198528658382 - 221.09935879232314363432473672475i
So if you start at zero, the solver heads down the left branch towards -inf. It has clearly diverged.
Does it have a solution at all? It does appear to cross the axis, if you look carefully enough.
vpasolve(EQ,x,1.6)
ans =
1.5045119404060829982776470260739
The solution is to start vpasolve in the RIGHT branch, the branch that does admit a solution.

More Answers (0)

Categories

Find more on MATLAB Support Package for LEGO MINDSTORMS EV3 Hardware in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!