Question: ODE second order plot both y and y'

I have modeled a simple pendulum with large intital amplitude (so we do not approx sin(theta) by theta).

I have a plot of theta agains time but would like to have both theta (position) and theta' (velcocity) on same graph.

Grateful for any suggestions

Pendulum2time.mw
 

Simple pendulum without approximating sin(θ) to θ

restart; with(DEtools)

ode := diff(theta(t), t, t)+g*sin(theta(t))/L = 0; ics := theta(0) = 1, (D(theta))(0) = 0

diff(diff(theta(t), t), t)+g*sin(theta(t))/L = 0

 

theta(0) = 1, (D(theta))(0) = 0

(1)

g := 9.8; L := .75

ans := dsolve({ics, ode}, theta(t), numeric, output = Array([0, .1, .2, .3]))

Matrix(%id = 18446746279246469110)

(2)

NULL

DEplot(ode, theta(t), t = 0 .. 3.5, theta = -1 .. 1, [{ics}], linecolour = blue)

 

with(plots); odeplot(dsolve({ics, ode}, theta(t), numeric), t = 0 .. 3.5, colour = blue)

 

NULL


 

Download Pendulum2time.mw

 

Please Wait...