SHM - as two ordinary linear differential equations

Click For Summary
SUMMARY

The discussion focuses on solving simple harmonic motion (SHM) represented by two linear ordinary differential equations (ODEs). The equations derived are based on the relationships between position (x) and velocity (v) in SHM, specifically using the forms x = A*sin(w*t + φ) and v = A*w*cos(w*t + φ). The analytical solution involves transforming the second-order ODE, y'' + ω²y = 0, into a system of two first-order equations. The numerical methods discussed include Euler's method and the fourth-order Runge-Kutta method for solving these equations in Python.

PREREQUISITES
  • Understanding of simple harmonic motion (SHM)
  • Familiarity with ordinary differential equations (ODEs)
  • Knowledge of numerical methods, specifically Euler's method and Runge-Kutta method
  • Basic Python programming skills for implementing numerical solutions
NEXT STEPS
  • Study the transformation of second-order ODEs into first-order systems
  • Learn about the analytical solutions for linear homogeneous second-order differential equations
  • Implement the fourth-order Runge-Kutta method in Python for solving ODEs
  • Explore potential and kinetic energy concepts in the context of SHM
USEFUL FOR

Students studying physics or mathematics, particularly those focusing on differential equations and numerical methods, as well as educators looking for practical examples of SHM applications.

leonmate
Messages
81
Reaction score
1

Homework Statement



I've attached an image of the problem question, it's Q1 I'm working on

This is what I have so far:
we have two components of SHM, position x and velocity v.

when x = 0, v = a maximum, when v = 0, x = a maximum

this is represented by sin & cos functions.

where x = A*sin(w*t*phi)

and v = A*w*cos(w*t*phi)Here it can be shown that a = -w^2 * x

thus, dv/dt = -w^2 * x

and, dv/dt = dv/dx * dx/dt = -w^2 * x

and, v*dv/dx = -w^2 * x

then we're left with differential equation, v*dv = -w^2 *x*dxSo the last equation: v dv = -ω2x dx
Would this be considered two linear ordinary equations?? I'm a little unsure about the question is actually asking me - 'the analytical solution'

I've got to code this with python, and solve using euler and fourth-order Runge-Kutta method - I've already made solver functions to do both these things, I just can't progress past q1! ..frustratingAny help would be very appriciated

Leon
 

Attachments

Physics news on Phys.org
leonmate said:

Homework Statement



I've attached an image of the problem question, it's Q1 I'm working on

This is what I have so far:
we have two components of SHM, position x and velocity v.

when x = 0, v = a maximum, when v = 0, x = a maximum

this is represented by sin & cos functions.

where x = A*sin(w*t*phi)

and v = A*w*cos(w*t*phi)Here it can be shown that a = -w^2 * x

thus, dv/dt = -w^2 * x

and, dv/dt = dv/dx * dx/dt = -w^2 * x

and, v*dv/dx = -w^2 * x

then we're left with differential equation, v*dv = -w^2 *x*dxSo the last equation: v dv = -ω2x dx
Would this be considered two linear ordinary equations?? I'm a little unsure about the question is actually asking me - 'the analytical solution'

I've got to code this with python, and solve using euler and fourth-order Runge-Kutta method - I've already made solver functions to do both these things, I just can't progress past q1! ..frustratingAny help would be very appriciated

Leon
I'm not sure I follow what you are doing here. Have you studied ordinary differential equations and how to solve them in a separate course?

The second-order ODE, y" + ω2y = 0, describes the motion of an undamped oscillator.

The 'analytical solution' described in the assignment means the non-numerical solution to this equation which would be obtained by using the methods for solving such equations. This is a linear homogeneous second order differential equation with constant coefficients, so there are solution methods readily available:

http://tutorial.math.lamar.edu/Classes/DE/SecondOrderConcepts.aspx

In solving such equations numerically, the usual numerical procedures, like Euler's method or Runge-Kutta, can solve only first-order differential equations. What this assignment requires you to do is re-write the original second-order differential equation as a system of two first-order equations, and then solve this system numerically.
 
I think you're not doing what they want in the order they want. Also to say 'it can be shown' I thought was a privilege reserved for textbook writers.

I think they want you to multiply the given equation by y and do the operations you may or may not remember to get to express in terms of the concepts of potential and kinetic energy. If it doesn't come back to you look in your intermediate level physics textbook.
 
  • Like
Likes   Reactions: rude man
epenguin said:
.
"RSVP! If I trouble to help your homework and you never reply or react I will enter your name in a black book and not help you next time. I may do this if you let the thing drop before any conclusion reached.
Don't tell us you have got the answer, tell us the answer you have got!


Beautiful! Wish I had thought of it myself. It would discourage turn-key solution hunters.
 
SteamKing said:
I'm not sure I follow what you are doing here. Have you studied ordinary differential equations and how to solve them in a separate course?

The second-order ODE, y" + ω2y = 0, describes the motion of an undamped oscillator.

The 'analytical solution' described in the assignment means the non-numerical solution to this equation which would be obtained by using the methods for solving such equations. This is a linear homogeneous second order differential equation with constant coefficients, so there are solution methods readily available:

http://tutorial.math.lamar.edu/Classes/DE/SecondOrderConcepts.aspx

In solving such equations numerically, the usual numerical procedures, like Euler's method or Runge-Kutta, can solve only first-order differential equations. What this assignment requires you to do is re-write the original second-order differential equation as a system of two first-order equations, and then solve this system numerically.

I did do a course with ODEs, but I wound up taking some time off and my memory of them isn't great. I probably need to go over it much more as this course progresses.

So, I had a read through that site - very helpful thank you.

This is what I've come up with...

y'' = w2y = 0
y(t) = ert
y''(t) = r2ert
ay'' + by' + cy = 0
r2 + w2 = 0
r = ±2π i (w = 2π)

y(t) = c1 cos (2πt) + c2 sin (2πt)
y'(t) = -2πt c1 sin (2πt) + 2πt c2 cos (2πt)

Plug in my y(0) = 1 and y'(0) = 0

gives c1 = 1, c2 = 0

and y(t) = cos(2πt)and now I'm a little lost again. Am I heading in the right direction with this working?

Leon
 
leonmate said:
I did do a course with ODEs, but I wound up taking some time off and my memory of them isn't great. I probably need to go over it much more as this course progresses.

So, I had a read through that site - very helpful thank you.

This is what I've come up with...

y'' = w2y = 0
y(t) = ert
y''(t) = r2ert
ay'' + by' + cy = 0
r2 + w2 = 0
r = ±2π i (w = 2π)

y(t) = c1 cos (2πt) + c2 sin (2πt)
y'(t) = -2πt c1 sin (2πt) + 2πt c2 cos (2πt)

Plug in my y(0) = 1 and y'(0) = 0

gives c1 = 1, c2 = 0

and y(t) = cos(2πt)and now I'm a little lost again. Am I heading in the right direction with this working?

Leon
If c1 = c2 = 0, then y(t) = 0.

Go back to the solution of the characteristic equation r2 + ω2 = 0

How did you arrive at r = ±2π i ?

Re-writing, r2 = -ω2, so what should r be?
 
"Write the second-order equation for the harmonic oscillator,
y'' + ω2y = 0
as two linear ordinary differential equations."


You're still not doing what was asked, which was to reduce the one second-order ODE into two 1st order ODE's.
Hint: let u = dy/dt, then
form two 1st order ODE's in u' and y'.
 
Hey guys,

I've worked through some more, here's what I have

y1(t) = (cos(wt) + i sin(wt))
y2(t) = (cos(wt) - i sin(wt))

y(t) = A y1(t) + B y2(t)

y(t) = A(cos(wt) + i sin(wt)) + B(cos(wt) - i sin(wt))
y'(t) = Aw(-sin(wt) + i cos(wt)) + Bw(-sin(wt) - i cos(wt))

Plug in boundary conditions:

y(0) = 1

1 = A( 1 + 0 ) + B( 1 - 0 ) = A + B

y'(0) = 0

0 = Aw( 0 + i ) + Bw( 0 - i)
0 = Awi - Bwi
0 = A - B

A = B = ½

(w = 2π given in question)y(t) = ½cos(2πt) + ½sin(2πt)

let u = y' = -π sin(2πt) + π cos(2πt)

u' = y'' = - 2π2cos(2πt) - 2π2sin(2πt)

We're given the equation y'' + w2y = 0 so we can test

- 2π2cos(2πt) - 2π2sin(2πt) + 4π2(½cos(2πt) + ½sin(2πt)) = 0
- 2π2cos(2πt) - 2π2sin(2πt) + 2π2cos(2πt) 2π2sin(2πt) = 0

...then i get stuck
I also did this, which makes more sense but I don't know if it's right

y = cos(wt)
y = cos(2πt)
u = y' = - 2π sin(2πt)
u' = -4π2cos(2πt) = -4π2y
du / dt = -4π2y

du = dy/dt

dy / y = -4π2 dt2
 
  • #10
My lecturer gave me this, the first two slides are relevant
 

Attachments

  • #11
leonmate said:
I also did this, which makes more sense but I don't know if it's right
y = cos(wt)
y = cos(2πt)
u = y' = - 2π sin(2πt)
u' = -4π2cos(2πt) = -4π2y
du / dt = -4π2y
du = dy/dt
dy / y = -4π2 dt2
Your y(t) and u(t) are corect. Don't know why you continue with du/dt etc. You were asked to provide y(t) only in part 1.
I can't assist after that.
 
  • #12
rude man said:
Your y(t) and u(t) are corect. Don't know why you continue with du/dt etc. You were asked to provide y(t) only in part 1.
I can't assist after that.

Ok, how do I get y = cos(wt)

I got it once, now everytime I do it I end up with a sin in there.

y'' + w2y = 0
y(t) = ert
y''(t) = r2ert
ay'' + by' + cy = 0
r2 + w2 = 0
r = ±2π i (w = 2π)

y(t) = c1 cos (2πt) + c2 sin (2πt)
y'(t) = -2πt c1 sin (2πt) + 2πt c2 cos (2πt)

Plug in my y(0) = 1 and y'(0) = 0

gives c1 = 1, c2 = 0

and y(t) = cos(2πt)

Is this correct?
 
  • #13
leonmate said:
Ok, how do I get y = cos(wt)
I got it once, now everytime I do it I end up with a sin in there.
Where? I see only cosines, in both ways you did it.
y'' + w2y = 0
y(t) = ert
y''(t) = r2ert
ay'' + by' + cy = 0
r2 + w2 = 0
r = ±2π i (w = 2π)
y(t) = c1 cos (2πt) + c2 sin (2πt)
y'(t) = -2πt c1 sin (2πt) + 2πt c2 cos (2πt)
Plug in my y(0) = 1 and y'(0) = 0
gives c1 = 1, c2 = 0
and y(t) = cos(2πt)
Is this correct?
yes.
y'' + w2y = 0
y(t) = ert
y''(t) = r2ert
ay'' + by' + cy = 0
r2 + w2 = 0
r = ±2π i (w = 2π)
y(t) = c1 cos (2πt) + c2 sin (2πt)
y'(t) = -2πt c1 sin (2πt) + 2πt c2 cos (2πt)
Plug in my y(0) = 1 and y'(0) = 0
gives c1 = 1, c2 = 0
and y(t) = cos(2πt)
Is this correct?
Since it's a duplicate of what you just wrote above, the answer had better be Yes here too, hadn't it!
So where's the sine term(s) in y(t)?
 
  • #14
You were asked to derive from the second order equation two first order ones and then from those solve analytically.
It seems to me you have first solved and then tried to derive the equations from the solutions! Maybe not yet successfully.

If you feel stuck after all this you might give consideration to #3 which is a couple of lines and seems to me what is being asked.
 
Last edited:

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 21 ·
Replies
21
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 19 ·
Replies
19
Views
2K