Finite Differences Method for Physics

AI Thread Summary
The discussion centers on solving a differential equation for a hanging mass influenced by gravity and deriving the finite differences equation. The differential equation is established as m*(d^2x/dt^2) = -kx - mg, and the finite differences equation is formulated for numerical solutions. The user encounters discrepancies between the expected maximum extension of the spring (4.9) and the results obtained from Excel simulations, which yield a maximum displacement of around 9.8. Clarifications are made regarding the interpretation of maximum extension versus total swing, with the consensus suggesting that the total swing is indeed 9.8, while the maximum extension is 4.9. The conversation emphasizes the importance of correctly interpreting the results of numerical simulations in relation to theoretical expectations.
fredrogers3
Messages
40
Reaction score
0

Homework Statement


I am to first write a differential equation that describes a hanging mass influenced by gravity and then write the finite differences equation. Then, the problem asks me to graph this numerical solution and make sure that maximum extension of the spring that I derive matches that of the finite differences result.

Homework Equations


The Differential equation is: m*(d^2x/dt^2)=-kx-mg
The second derivative is approximately equal to (Xn+1-2Xn+Xn-1)/Δt^2
Solved for Xn+1=

Xn+1=Δt^2*((-kXn-mg)/m)+2Xn-Xn-1

m=1kg
delta t= .1

The Attempt at a Solution


I worked out all of the above in the relevant equations section. I set k=2 (we were allowed to pick any value), so the max extension = 9.8/2 = 4.9

I did the finite differences on Excel but did not get 4.9 (or -4.9 if down is negative) as a max displacement. I got around 9.8. Anyone see my error?

Thanks
 
Last edited:
Physics news on Phys.org
If you write mx'' = -kx - mg you are ipso facto calling x = 0 where the spring is relaxed. So now you're holding the mass attached to the spring at initial condition x = 0 and letting go. In other words, you are applying an initial condition F = -mg and then running the diff. eq. What will the mass do? Between what values of x will it vibrate?

I also ran an Excel (I used T = 0.01s.) and got about the right swing extrema.

If you want you can e-mail me your run. I use excel 2003 so I hope we'd be compatible. Or describe your program in detail. Also, what is your time response for the continuous case?

EDIT: I'm guessing you reported the end-to-end swing. In which case are you sure it's not right?
 
Last edited:
rude man said:
If you write mx'' = -kx - mg you are ipso facto calling x = 0 where the spring is relaxed. So now you're holding the mass attached to the spring at initial condition x = 0 and letting go. In other words, you are applying an initial condition F = -mg and then running the diff. eq. What will the mass do? Between what values of x will it vibrate?

I also ran an Excel (I used T = 0.01s.) and got about the right swing extrema.

If you want you can e-mail me your run. I use excel 2003 so I hope we'd be compatible. Or describe your program in detail. Also, what is your time response for the continuous case?

How do I attach via email on physics forum?
 
fredrogers3 said:
How do I attach via email on physics forum?

Before you do that, what is your solution to the differential equation? And what were the end-points of your excel mass swing? I suspect your simulation's OK.
 
rude man said:
Before you do that, what is your solution to the differential equation? And what were the end-points of your excel mass swing? I suspect your simulation's OK.

I found the numerical solution rather than the analytical solution, thus I didn't solve the Diffeq. I plugged into Excel what I have under the "relevant equation" section solved for Xn+1. My graph comes out as a cosine graph with min -9.81192 and max zero. I took n from -1 to 100.
 
fredrogers3 said:
I found the numerical solution rather than the analytical solution, thus I didn't solve the Diffeq. I plugged into Excel what I have under the "relevant equation" section solved for Xn+1. My graph comes out as a cosine graph with min -9.81192 and max zero. I took n from -1 to 100.

Well I have news for you. That result is correct.

Now you'd better be able to explain why! :smile:
 
rude man said:
Well I have news for you. That result is correct.

Now you'd better be able to explain why! :smile:

Am I calculating what the "theoretical max extension" should be incorrectly?
 
fredrogers3 said:
Am I calculating what the "theoretical max extension" should be incorrectly?

Well, the mass swings from 0 to - 9.8, so what would you call the "max. extension"?
 
rude man said:
Well, the mass swings from 0 to - 9.8, so what would you call the "max. extension"?

Wouldn't it be 9.8 then?
 
  • #10
fredrogers3 said:
Wouldn't it be 9.8 then?

I would argue no.
Max. extension = 4.9, max. compression = 4.9, total swing = 9.8.
 
Back
Top