Hooke’s Law: Difference between revisions
Line 23: | Line 23: | ||
L0=.1 #the natural length of the spring | L0=.1 #the natural length of the spring | ||
k=15 #spring constant | k=15 #spring constant | ||
#the holder is the top plate for the spring | #the holder is the top plate for the spring | ||
holder= box(pos=vec(-.1,.1,0), size=vec(.1,.005,.1)) | holder= box(pos=vec(-.1,.1,0), size=vec(.1,.005,.1)) | ||
#the ball and the spring should be obvious | #the ball and the spring should be obvious | ||
#note that the ball has a trail | #note that the ball has a trail | ||
ball=sphere(pos=vec(-.1,-L0+.1,0), radius=0.02, color=color.red, make_trail=true) | ball=sphere(pos=vec(-.1,-L0+.1,0), radius=0.02, color=color.red, make_trail=true) | ||
Line 36: | Line 39: | ||
t=0 | t=0 | ||
dt=0.01 #size of the time step | dt=0.01 #size of the time step | ||
#putting the loop as "while True" means it runs forever | #putting the loop as "while True" means it runs forever | ||
#you could change this to while t< 10: or something | #you could change this to while t< 10: or something | ||
while t<3: | while t<3: | ||
rate(100) #this says 100 calculations per second | rate(100) #this says 100 calculations per second | ||
#L is the length of the spring, from the holder to the ball | #L is the length of the spring, from the holder to the ball | ||
L=ball.pos-holder.pos | L=ball.pos-holder.pos | ||
#remember that mag(R) gives the magnitude of vector R | #remember that mag(R) gives the magnitude of vector R | ||
#remember that norm(R) gives the unit vector for R | #remember that norm(R) gives the unit vector for R | ||
Fs=-k*(mag(L)-L0)*norm(L) #this is Hooke's law | Fs=-k*(mag(L)-L0)*norm(L) #this is Hooke's law | ||
#this calculates the net force | #this calculates the net force | ||
F=Fs+ball.m*g | F=Fs+ball.m*g | ||
#update the momentum | #update the momentum | ||
ball.p=ball.p+F*dt | ball.p=ball.p+F*dt | ||
#update the position of the ball | #update the position of the ball | ||
ball.pos= ball.pos +ball.p*dt/ball.m | ball.pos= ball.pos +ball.p*dt/ball.m | ||
#this next line updates the spring | #this next line updates the spring | ||
spring.axis=ball.pos-holder.pos | spring.axis=ball.pos-holder.pos |
Revision as of 13:34, 10 April 2016
Vinutna Veeragandham
Hooke's Law: the force needed to extend or compress a spring by some distance is proportional to that distance.
The Main Idea
Hooke's Law demonstrates the relationship between forces applied to a spring and elasticity. It states that the force needed to extend or compress a spring by some distance is proportional to that distance. This law applies to many different materials such as balloons or strings; an elastic body to which Hooke's law applies is known as linear-elastic. Hooke's Law has been the basis for the modern Theory of Elasticity, led to creation of new inventions as well as been the foundation of many different branches of science such as seismology, molecular mechanics and acoustics.
A Mathematical Model
F = -kX
F - restoring force, force by which the free end of the spring is being pulled, SI Units: Newtons
k - spring constant, an inherent property of the string, SI Units: Meters
X - spring displacement from the spring's free end while at equilibrium position, SI Units: Newtons/Meters
A Computational Model
# GlowScript 1.1 VPython L0=.1 #the natural length of the spring k=15 #spring constant #the holder is the top plate for the spring holder= box(pos=vec(-.1,.1,0), size=vec(.1,.005,.1)) #the ball and the spring should be obvious #note that the ball has a trail ball=sphere(pos=vec(-.1,-L0+.1,0), radius=0.02, color=color.red, make_trail=true) spring=helix(pos=holder.pos, axis=ball.pos-holder.pos, radius=.02, coils=10) ball.m=0.1 #mass of the ball in kg ball.p=ball.m*vec(0,0,0) #starting momentum mass times velocity dr=vec(0,-0.05,0) #this is the displacement of the spring ball.pos=ball.pos+dr g=vec(0,-9.8,0) #gravitational field t=0 dt=0.01 #size of the time step #putting the loop as "while True" means it runs forever #you could change this to while t< 10: or something while t<3: rate(100) #this says 100 calculations per second #L is the length of the spring, from the holder to the ball L=ball.pos-holder.pos #remember that mag(R) gives the magnitude of vector R #remember that norm(R) gives the unit vector for R Fs=-k*(mag(L)-L0)*norm(L) #this is Hooke's law #this calculates the net force F=Fs+ball.m*g #update the momentum ball.p=ball.p+F*dt #update the position of the ball ball.pos= ball.pos +ball.p*dt/ball.m #this next line updates the spring spring.axis=ball.pos-holder.pos