Message Boards Message Boards

0
|
19771 Views
|
7 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Solve differential equation to describe the motion of simple pendulum

Posted 11 years ago




Differential equation is given by
y''[t]==-(g/L)*Sin[y[t]]

where y is the offset angle and t is time. I used the following mathematica code to solve for y
DSolve[{y''[t] ==-(g/L)*Sin[y[t]], y[0]==Pi/2,y'[0]==0},y,t]

and get the following errors
Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>
DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. >>


The problem seems to be Sin[y], but I don't know how to work around this. Thanks for any help.
POSTED BY: Julian Lovlie
7 Replies
Posted 11 years ago
Thanks guys, you are awesome emoticon
POSTED BY: Julian Lovlie
Posted 11 years ago




Differential equation is given by
y''[t]==-(g/L)*Sin[y[t]]

where y is the offset angle and t is time. I used the following mathematica code to solve for y
DSolve[{y''[t] ==-(g/L)*Sin[y[t]], y[0]==Pi/2,y'[0]==0},y,t]

and get the following errors
Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>
DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. >>


The problem seems to be Sin[y], but I don't know how to work around this. Thanks for any help.
POSTED BY: Julian Lovlie
Posted 11 years ago




Differential equation is given by
y''[t]==-(g/L)*Sin[y[t]]

where y is the offset angle and t is time. I used the following mathematica code to solve for y
DSolve[{y''[t] ==-(g/L)*Sin[y[t]], y[0]==Pi/2,y'[0]==0},y,t]

and get the following errors
Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>
DSolve::bvfail: For some branches of the general solution, unable to solve the conditions. >>


The problem seems to be Sin[y], but I don't know how to work around this. Thanks for any help.
POSTED BY: Julian Lovlie
@Julian, if what you need is just a case with small excitation at the equilibrium, you can simply use the y instead of Sin[y]. For small y, the Taylor expansion gives you an approximation at the first order in a small neighbourhood of x=0: 
Series[Sin[x], {x, 0, 1}]
POSTED BY: Shenghui Yang
Sander is right, it's better to go with numerical solution here. Closed analytic form exist in terms of elliptic functions, but the problem is finding constants of integration from initial conditions. This needs solution of a system of nonlinear equations, which is not always possible.
sol = DSolve[y''[t] == -(g/l) Sin[y[t]], y, t];
y /. sol // Column // TraditionalForm

POSTED BY: Vitaliy Kaurov
To my knowledge there is no closed analytical solution to the pendulum problem.
You could try to do it numerically though:
g=9.81
L=0.5
y=.
y=First[y/.NDSolve[{y''[t]==-(g/L)*Sin[y[t]],y[0]==Pi/2,y'[0]==0},y,{t,0,10}]]
Plot[y[t],{t,0,10}]

This does look like a sine function but it isn't, it becomes especially clear for large exitations:
g=9.81
L=0.5
y=.
y=First[y/.NDSolve[{y''[t]==-(g/L)*Sin[y[t]],y[0]==Pi/2,y'[0]==6.25},y,{t,0,10}]]
Plot[y[t],{t,0,10}]

Hope this helps.
POSTED BY: Sander Huisman

Sander,

I have a two questions regarding both approach and syntax. First, why can't we obtain a numerical solution to the differential equation by using only the command, 'NDSolve' ? Second, what does the syntax below accomplish (i.e., y = .)?

y =. y = First[ y /. NDSolve[{y''[t] == -(g/L)*Sin[y[t]], y[0] ==Pi/2, y'[0] == 0}, y, {t, 0, 10}]]

Best,

-Javier

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract