Fast solution to an orthogonal trajectories problem
Diego Ramos, Universidad del valle
◼
This notebook is intended to show how faster we can solve an orthogonal trajectories problem using wolfram language for symbolics.
Problem 1
Problem 1
Find the family of trajectories given by the equation
L
y'(x)=+2xy-.
-+2xy-
2
x
2
y
2
y
2
x
(
1
)Then, Find the family of orthogonal trajectories to the family .
L
Solution
Solution
The solution of equation (1) is a one parametric family of curves which satisfy an equation of the form , where is the parameter. In order to find the family of orthogonal trajectories to the family we must solve the differential equation
G(x,y(x),c)=0
c
L
z'(x)=-
1
y'(x)
(
2
)The solution of this last differential equation is a one parametric family of curves orthogonal to the curves in the family .
L
Store the right hand side of the differential equation in a variable:
In[]:=
rside=-;
x^2+2xy[x]-y[x]^2
y[x]^2+2xy[x]-x^2
Solve the differential equation and store the solutions in a variable:
In[]:=
sol=DSolve[y'[x]rside,y[x],x]
Out[]=
y[x]-+4x-4,y[x]++4x-4
1
2
1
2
1
1
2
x
1
2
1
2
1
1
2
x
From the solution y[x] find an equation which satisfy the points :
G(x,y(x))=0
(x,y(x))
In[]:=
equationG=#1-#2&@@Expand0/.y[x]y
2
List@@sol[[1,1]]-
1
2
C[1]
Out[]=
-x+-y+0
1
2
x
1
2
y
Plot the family of trajectories:
L
In[]:=
L=ContourPlot[Evaluate@Table[(equationG/.C[1]n),{n,Range[1,5,.25]}],{x,-35,40},{y,-10,80},AspectRatioAutomatic,ContourStyleLighter@Blue,ImageSize300]
Out[]=
Solve the differential for the orthogonal family of trajectories:
In[]:=
OrthoSol=DSolvey'[x],y[x],x
-1
rside
Out[]=
y[x]--4x-4,y[x]+-4x-4
1
2
1
2
1
1
2
x
1
2
1
2
1
1
2
x
From the solution y[x] find an equation which satisfy the points :
G(x,y(x))=0
(x,y(x))
In[]:=
OrthoequationF=#1-#2&@@Expand0/.y[x]y
2
List@@OrthoSol[[1,1]]-
1
2
C[1]
Out[]=
1
2
x
1
2
y
Plot the orthogonal family of trajectories:
In[]:=
OrthoL=ContourPlot[Evaluate@Table[(OrthoequationF/.C[1]n),{n,Range[1,5,.25]}],{x,-40,35},{y,-10,80},AspectRatioAutomatic,ContourStyleOrange,ImageSize300]
Out[]=
Put together the two families:
In[]:=
Show[L,OrthoL,BackgroundBlack,FrameFalse]
Out[]=
Problem 2
Problem 2
Find the family of trajectories given by the equation
L
y'(x)=.
y(++)
2
x
2
y
2
a
x(+-)
2
x
2
y
2
a
(
3
)Then, Find the family of orthogonal trajectories to the family .
L
Solution
Solution
Store the right hand side of the differential equation in a variable:
In[]:=
rside2=;
y[x](x^2+y[x]^2+a^2)
x(x^2+y[x]^2-a^2)
Solve the differential equation and store the solutions in a variable:
In[]:=
sol2=DSolve[y'[x]rside2,y[x],x]
Out[]=
y[x]x-x+
1
2
1
-4+4+
,y[x]2
a
2
x
2
x
2
1
1
2
1
-4+4+
2
a
2
x
2
x
2
1
From the solution y[x] find an equation which satisfy the points :
G(x,y(x))=0
(x,y(x))
In[]:=
equationG2=(#1-#2)&@@Expand0/.{y[x]y,a1.5}
2
List@@First[sol2[[1]]]-xC[1]
1
2
Out[]=
2.25-+-xy0
2
x
2
y
1
In[]:=
familyL=ContourPlot[Evaluate@Table[(equationG2/.{C[1]n}),{n,Range[-4,4,.5]}],{x,-3,3},{y,-2,2},ContourStyleOrange,AspectRatioAutomatic]
Solve the differential for the orthogonal family of trajectories:
Plot the orthogonal family of trajectories:
Put together the two families: