The linear spring
Here m is the mass of the weight, L0 is the resting length of the spring and x is the position of the spring. A linear spring exerts a force that is proportional to the difference between the resting length and the distance the spring is pulled. The constant of proportionality is called the spring constant. If the spring is stretched so that it is longer than the rest length, the force is negative and pulls the mass back while if the spring is compressed, it pushes it out. There is also frictional force which is proportional to the velocity. Using Newton's laws of motion:
This says that " mass time acceleration equal total force." As you can see, if the distance x exceeds the resting length, then the force is negative and the mass accelerates to the left. If the spring is compressed, the acceleration is positive and to the right.
To simplify the analysis of this, we let y = x-L0 denote the displacement from rest and then divide the quation by the mass obtaining:
The general solution to this is obtained by looking at the roots of the polynomial
There are several cases that we will explore. This is an examplw of a one degree of freedom mechanical system. Later in the course we will develop tools to understand all such systems. For now, we will use the linear theory so far developed and also look at the solutions to this computed numerically.
Here are some exercises for you that don't require the computer.
The nonlinear spring can be completely analyzed since it is a linear equation with constant coefficients and the roots of the characteristic equation are known. However, it is instructive to use the computer to look at the solutions in a number of different ways as a sort of practice for system where you cannot explicitly solve the equations. That is what we will do here. As before, we will first create an XPP file to play with on the computer. Since this is a second order system, I will first write it as a pair of first order equations:
yp' = -(k/m)y - f yp
# the linear spring y'=yp yp' = -(k/m)*y -f*yp par k=1,m=1,f=0 @ xp=y,yp=yp,xlo=-1,xhi=1,ylo=-1,yhi=1 @ total=60 doneOk, before beginning, a few explanatory notes. The lines beginning with @ tell XPP/WinPP how to start up. The default is to have time along the x-axis, the first differential equation along the y-axis, etc. These commands simply tell XPP/WinPP to start up with different defaults. Of course, you can change these parameters in the program, but this saves the user a bunch of steps. The first @ line says to put y along the x-axis, yp along the y-axis and tells us the window is (-1,1) by (-1,1). The second line just tells us to integrate up until t=60.
Now, fire up the differential equation. The display is different from what we have seen in the past - the axes are both phase variables. This is called the phaseplane. As you can see, I have set the system up so that the friction is initially zero. From your work above, this means that there are periodic solutions. What does a periodic solution look like in the phaseplane? Click on Init Conds - Mouse (or Run - Mouse in Windows) and click on a point in the plane. You should see a circle. Try it again with different initial conditions.
Here is a picture of the phaseplane I have obtained:
Click on Dir.field/flow - Dir. Field and accept the defaults (or Phaseplane - Direct Field in WinPP) and see the direction field confirming the basic form of the solutions.
Erase the screen.
We will view an animation of the spring. To do this, you must create an animation file. Rather than type it in, you can download it by clicking here. Alternatively, copy this into a file called spring.ani:
# spring.ani PERMANENT line 0;0;0;.5;$BLACK;8 # cross hairs for the phaseplane line .75;1;.75;.5;$BLUE line .5;.75;1;.75;$BLUE # axis labels text .8;.95;y' text .95;.7;y # axes for the time plot line 0;.75;.45;.75;$BLUE # axis labels text .425;.7;t TRANSIENT # make the spring - it has 10 segments line 0;.3;(.5+.5*y)/10;.35 line [1..8]*(.5+.5*y)/10;.3-.05*cos([j]*pi);[j+1]*(.5+.5*y)/10;.3+.05*cos([j]*pi) line 9*(.5+.5*y)/10;.35;(.5+.5*y);.3 # make the mass frect (.5+.5*y);.25;(.5+.5*y)+.1;.35;$RED # phaseplane plot fcircle .75+.25*y;.75+.25*yp;.02;$GREEN # y,y' plot fcircle t*.45/60;.75+.25*y;.015;$PURPLE fcircle t*.45/60;.75+.25*yp;.015;$ORANGE end
Now set the friction to f=0.1 and solve the equations with the initial condition y=1,y'=0. Click on Viewaxes Toons (or Graphics - Toons in WinPP) A new window will appear. This is the animation window. Click on File (or New File in WinPP) and at the prompt, enter the file spring.ani . You should get a message saying Loaded 21 lines successfully. Click on OK and now you can run the animation. (If the file was not found, make sure it is in the directory that the ode file is running from.) Click on Go (or the forward button |> in WinPP) and the animation should run. There are 3 different animations going simultaneously. At the bottom is a picture of the physical device. The upper left is the time evolution of y(t) in purple and y'(t) in orange. The upper right panel is a representation of the phase-plane with a green circle showing the projection in the phase plane. Thus, you can match the physical pendulum with the phase-space projection and with the time series.