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

    Find the family
    L
    of trajectories given by the equation
    y'(x)=
    -
    2
    x
    +2xy-
    2
    y
    2
    y
    +2xy-
    2
    x
    .
    (
    1
    )
    Then, Find the family of orthogonal trajectories to the family
    L
    .

    Solution

    The solution of equation (1) is a one parametric family of curves which satisfy an equation of the form
    G(x,y(x),c)=0
    , where
    c
    is the parameter. In order to find the family of orthogonal trajectories to the family
    L
    we must solve the differential equation
    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]
    1
    2
    
    
    1
    
    -
    2
    
    1
    
    +4
    
    1
    
    x-4
    2
    x
    ,y[x]
    1
    2
    
    
    1
    
    +
    2
    
    1
    
    +4
    
    1
    
    x-4
    2
    x
    
    From the solution y[x] find an equation
    G(x,y(x))=0
    which satisfy the points
    (x,y(x))
    :
    In[]:=
    equationG=#1-#2&@@Expand
    2
    List@@sol[[1,1]]-
    1
    2
    C[1]
    
    0/.y[x]y
    Out[]=
    -
    
    1
    
    x+
    2
    x
    -
    
    1
    
    y+
    2
    y
    0
    Plot the family
    L
    of trajectories:
    In[]:=
    L=​​ContourPlot[​​Evaluate@Table[(equationG/.C[1]n),{n,Range[1,5,.25]}],{x,-35,40},{y,-10,80},​​AspectRatioAutomatic,​​ContourStyleLighter@Blue,​​ImageSize300]
    Out[]=
    Solve the differential for the orthogonal family of trajectories:
    In[]:=
    OrthoSol=DSolvey'[x]
    -1
    rside
    ,y[x],x
    Out[]=
    y[x]
    1
    2
    
    
    1
    
    -
    2
    
    1
    
    -4
    
    1
    
    x-4
    2
    x
    ,y[x]
    1
    2
    
    
    1
    
    +
    2
    
    1
    
    -4
    
    1
    
    x-4
    2
    x
    
    From the solution y[x] find an equation
    G(x,y(x))=0
    which satisfy the points
    (x,y(x))
    :
    In[]:=
    OrthoequationF=#1-#2&@@Expand
    2
    List@@OrthoSol[[1,1]]-
    1
    2
    C[1]
    
    0/.y[x]y
    Out[]=
    
    1
    
    x+
    2
    x
    -
    
    1
    
    y+
    2
    y
    0
    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},​​AspectRatioAutomatic,​​ContourStyleOrange,​​ImageSize300]
    Out[]=
    Put together the two families:
    In[]:=
    Show[L,OrthoL,BackgroundBlack,FrameFalse]
    Out[]=

    Problem 2

    Find the family
    L
    of trajectories given by the equation
    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

    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]
    1
    2
    x
    
    1
    -
    -4
    2
    a
    +4
    2
    x
    +
    2
    x
    2
    
    1
    ,y[x]
    1
    2
    x
    
    1
    +
    -4
    2
    a
    +4
    2
    x
    +
    2
    x
    2
    
    1
    
    From the solution y[x] find an equation
    G(x,y(x))=0
    which satisfy the points
    (x,y(x))
    :
    In[]:=
    equationG2=(#1-#2)&@@Expand
    2
    List@@First[sol2[[1]]]-
    1
    2
    xC[1]
    0/.{y[x]y,a1.5}
    Out[]=
    2.25-
    2
    x
    +
    2
    y
    -xy
    
    1
    0
    In[]:=
    familyL=​​ContourPlot[​​Evaluate@Table[(equationG2/.{C[1]n}),{n,Range[-4,4,.5]}],{x,-3,3},{y,-2,2},​​ContourStyleOrange,​​AspectRatioAutomatic]
    Solve the differential for the orthogonal family of trajectories:
    Plot the orthogonal family of trajectories:
    Put together the two families: