Mathematica: position vs time in a spring

Click For Summary

Homework Help Overview

The discussion revolves around plotting the position versus time graph of an object attached to a spring, incorporating the effects of friction. The original poster provides initial conditions and a differential equation for a spring-mass system, seeking guidance on how to account for friction in the model.

Discussion Character

  • Exploratory, Assumption checking, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the impact of friction on the differential equation governing the motion of the spring-mass system. There are inquiries about the nature of friction, whether it is constant or velocity-dependent, and how to modify the equation accordingly. Some participants express confusion regarding the implementation of these concepts in Mathematica.

Discussion Status

Participants have explored various interpretations of friction and its mathematical representation. Suggestions have been made to use numerical methods like NDSolve in Mathematica for solving the modified equations. There is an acknowledgment of the complexity of the problem, with no consensus on a single approach yet.

Contextual Notes

There is a lack of specificity regarding the type of friction being considered, which has led to different interpretations and proposed equations. The discussion also highlights the challenges of solving the equations analytically versus numerically, particularly in the context of Mathematica's capabilities.

Fre4k
Messages
12
Reaction score
0

Homework Statement



Plot the position vs time graph of an object attached to a spring.
m = 0.5 kg
k = 60 N/m
x[0] = 3 m
v[0] = 4 m/s

Homework Equations



d²x/dt² + (k/m)*x = 0

The Attempt at a Solution



I solved the differential equation using DSolve and plotted the resulting function, ok. But what if there was friction? I have no idea how I'd plot that graph.

And sorry for my bad english. D:
 
Physics news on Phys.org
Friction would change the differential equation. If the object slides on a horizontal surface, the force of friction is constant in magnitude, but opposite to velocity, v=dx/dt.
It is also possible that "friction" means some resistive force and is proportional to the velocity, and opposite to it. Then the equation will be

d²x/dt² + (k/m)*x +γ/m dx/dt= 0, the equation of a damped harmonic oscillator.



ehild
 
It worked, but I still don't get it. I thought friction was independent of velocity, so what is this "friction"?
 
You did not specify the kind of friction and its value.

Sliding friction is independent of the magnitude of velocity, but depends on its sign - it is opposite to the velocity v. Fr=-μg sgn(v).
So you have to solve the equation

d²x/dt² + (k/m)*x +μg/m*sgn(dx/dt)= 0

with the condition that both x(t) and dx/dt are continuous.
An example is shown here: http://www.wolframalpha.com/input/?i=x"+x+0.1sgn(x')=0

ehild
 
Last edited:
Thanks, I understand it now, but when I try to solve this equation using Mathematica nothing happens. The program sends back to me the same thing I typed and no error messages.
 
The solution is "piecewise" and the "pieces" depend very much on the parameters and initial conditions. There is no solution in a closed form.
Wolframalpha did not work with the general equation, either.
Try to give Mathematica the equation with numerical parameters and initial conditions and see if it does anything. ehild
 
This is what I'm doing:

m := 0.5(* kg *)
k := 60(* N/m *)
μ := 0.4
g := 10(* m/s² *)
DSolve[{x''[t] + (k/m)*x[t] + μ*g*Sign[x'[t]] == 0, x[0] == 3,
x'[0] == 4}, x[t], t]
 
It is a complicated problem, and Mathematica might not be able to handle it.

ehild
 
You could try using NDSolve to get a numerical solution.
 
  • #10
Fre4k said:
This is what I'm doing:

m := 0.5(* kg *)
k := 60(* N/m *)
μ := 0.4
g := 10(* m/s² *)
DSolve[{x''[t] + (k/m)*x[t] + μ*g*Sign[x'[t]] == 0, x[0] == 3,
x'[0] == 4}, x[t], t]

Mathematica can't solve this analytically, that's why it spits out exactly what you put into it. You can probably get a numerical solution with NDSolve (It's been a while since I've used mathematica, but I think that is what it is called).

A more typical setup (as far as nice analytical solutions go) is a velocity dependent damping (such as from air resitance).
 
  • #11
Thanks guys, I'll just use the other equation.
 
  • #12
The equation d²x/dt² + (k/m)*x +μg/m*sgn(dx/dt)= 0
I suggested in #4 is not quite correct. The sign function returns zero for v=0, but the force of friction is not zero. But it is static friction. Assuming that static and kinetic frictions are the same, the direction of friction is opposite to x(t) when v=0.

It has to be checked at every turning point if the elastic force is enough to overcome friction, that is |x|>μg/k

So the equation

d²x/dt² + (k/m)*x +μg/m*sgn(dx/dt)= 0

has to be solved according to the initial conditions, but the solution is valid for 0<t<t1, where v(t1)=0.
Check if |x(t1)|>μg/k.
In the next step, the initial conditions are x(t1) and v(t1)=0, with opposite sign for the friction. It goes on till v reaches zero again...

ehild
 
  • #13
Thanks again. :)
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
1K
Replies
16
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
1
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
5
Views
1K
Replies
9
Views
2K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K