Tuesday, January 27, Math 487: More on Differential Equations

solution  =  
      DSolve[{y''[t]  +  y[t]  ==  0}, y[t], t]

g[t_]  =  y[t]  /.  First[solution]  /. 
          C[1] -> 1  /.  C[2]  ->  0

Plot[g[x],  {x, -6, 6},  
      PlotStyle  ->  {Hue[0.5]}]

sol2d  = 
      DSolve[{v'[t] == w[t], w'[t]  ==  -v[t], 
          v[0] == 1, w[0] == 0}, {v[t], w[t]}, t]

x1[t_]  =  v[t]  /. First[sol2d]

x2[t_]  =  w[t]  /.  Last[sol2d]

ParametricPlot[{x1[t], x2[t]},  {t, 0, 7}, 
      AspectRatio  -> 1]

DSolve[{y''[t] + Sin[y[t]]  ==  0}, y[t], t]

NumericalSolution  =  
      NDSolve[{y''[t] + Sin[y[t]]  ==  0, 
          y[0] == 1, y'[0] == 0},  
        y[t],  {t, 0, 7}]

z1[t_]  =  y[t]  /.  First[NumericalSolution]

Plot[{z1[t], Cos[t]}, {t, 0, 7}, 
      PlotStyle  -> {Hue[0.5], Hue[0.9]}]