Nontrivial(Non-zero) solution of two nonlinear equations

13 views (last 30 days)
I have two equations given in code. The two lines are cutting each other at (x,y)=(0.098, 2.26) and (0.4899, 2.448) roughly as I can see it when it will be plotted within the range of x [0, 1.2].
But I would like to get these points by solving numerically. By using 'vpasolve()' I am getting only one crossing point at x= - 0.499 (contains a neg. sign), y= 2.443 where the other crossing point is not produced at all. Pl somebody help me to do that. Here I attach my code of two equations.
clc;clear
syms x y
p=1.0;
q=0.5;
r=0.2;
l1=1;
l2=2;
o=sqrt(((p).^2)-(4.*((r).^2)));
m=sqrt((p+o)./(2.*o));
n=((p-o)./(2.*r)).*m;
e=(((x)./((2.*r)+p)).*(1+((p-o)./(2.*r)))).*m;
e1=((l1+(1./2)).*o)-(p./2)-(((x).^2)./((2.*r)+p));
e2=((l2+(1./2)).*o)-(p./2)-(((x).^2)./((2.*r)+p));
ee1=((l1-(1./2)).*o)-(p./2)-(((x).^2)./((2.*r)+p));
ee2=((l2-(1./2)).*o)-(p./2)-(((x).^2)./((2.*r)+p));
d1= (q./2).*(exp(-2.*((e).^(2)))).*(laguerreL(l1,(4.*((e).^2))));
d2=(q./2).*(exp(-2.*((e).^(2)))).*(laguerreL(l2,(4.*((e).^2))));
dd1=(q./2).*(exp(-2.*((e).^(2)))).*(laguerreL((l1-1),(4.*((e).^2))));
dd2=(q./2).*(exp(-2.*((e).^(2)))).*(laguerreL((l2-1),(4.*((e).^2))));
E1=e1 -d1;
E2=e2 -d2;
EE1=ee1 +dd1;
EE2=ee2 +dd2;
G=(EE1-E1)./2;
h=(EE2-E2)./2;
D1=(e.*q./sqrt(l1)).*exp(-2.*(e.^2)).*laguerreL((l1-1),1,(4.*(e.^2)));
D2=(e.*q./sqrt(l2)).*exp(-2.*(e.^2)).*laguerreL((l2-1),1,(4.*(e.^2)));
u=sqrt(((G).^2)+((D1).^(2)));
v=sqrt(((h).^2)+((D2).^(2)));
%x1(x)= 2.*(((l1-(((u) + (G))./(2.*u))).*(((m).^2)+(n).^2))+((((m-n).^2).*((e).^2))+(n).^2));
%x2(x)= 2.*(((l2-(((v)-(h))./(2.*v))).*(((m).^2)+(n).^2))+ (sqrt(l2)).*(e).*((m-n).^2).*(D2./(v)));
%x=linspace(0.0001,1.2,50);
%plot(x,x1(x),'r',x,x2(x),'b--')
%% Numerical part
eq1=y- 2.*(((l1-(((u) + (G))./(2.*u))).*(((m).^2)+(n).^2))+((((m-n).^2).*((e).^2))+(n).^2));
eq2=y- 2.*(((l2-(((v)-(h))./(2.*v))).*(((m).^2)+(n).^2))+ (sqrt(l2)).*(e).*((m-n).^2).*(D2./(v)));
sol=vpasolve([eq1,eq2],[x,y]);
xSol=sol.x
ySol=sol.y

Accepted Answer

Walter Roberson
Walter Roberson on 2 May 2020
That crossing point calculated by vpasolve is correct. If you
fimplicit([eq1, eq2], [-3 3 -3 3])
you will see that there are four crossings, not two. It looks to me as if it might be symmetric around x = 0.
You can
y_in_x = solve(eq1,y);
EE = simplify(subs(eq2, y, y_in_x));
This reduces it down to a single equation EE in a single variable, x. But if you look at the equation you will see that it is fairly complicated, including terms that are exponential in x. It is not realistic that you are going to be able to come up with a closed form solution for that, only numeric solutions.
To get numeric solutions in a particular range, the easiest way is to give a starting point, such as
vpasolve([eq1,eq2], [1;1])
To get the other one, use a different initial point, one just a bit larger than 0.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!