import math #Example 13_1
#To find the maximum velocity and acceleration and the same when x=10cm
xo=0.4 #Units in Meters
k=24.5 #Units in N/M
m=2 #Units in Kg
vmax=xo*(math.sqrt(k/m)) #Units in meters/sec
print "Maximum velocity is Vmax=",round(vmax,1)," Meter/sec\n"
amax=(k*xo)/m #Units in meter/sec**2
print "Maximum acceleration is Amax=",round(amax,1)," meter/sec**2\n"
x=0.1 #Units in meters
v=math.sqrt((k/m)*(xo**2-x**2)) #Units in meters/Sec
print "Velocity at x=0.1 meters is= ",round(v,2)," meters/sec\n"
a=-(k*x)/m #Units in meter/sec**2
print "Acceleration at x=0.1 meters is= ",round(a,2)," meters/sec**2\n"
import math #Example 13_2
#To find the frequency of the vibrations
spring=24.5 #Units in N/m
m=2 #Units in Kg
f=(1/(2*math.pi))*math.sqrt(spring/m) #Units in Hz
print "The frequency of vibrations is f=",round(f,2)," Hz"
import math #Example 13_3
#To find the tension required in string
m=0.002 #Units in Kg
l=0.6 #Units in meters
v=300 #Units in meters/sec
T=(m/l)*v**2 #Units in N
print "Tension required in the string is T=",round(T)," N"
import math #Example 13_4
#To draw a picture on the first three resonance frequencies
l=6 #Units in meters
n=1
lamda1=(2*l)/n #Units in meters
n=2
lamda2=(2*l)/n #Units in meters
n=3
lamda3=(2*l)/n #Units in meters
speed=24 #Units in meters/sec
f1=speed/lamda1 #Units in Hz
f2=speed/lamda2 #Units in Hz
f3=speed/lamda3 #Units in Hz
print "The first resonance frequency is F1=",round(f1)," Hz\n"
print "The second resonance frequency is F2=",round(f2)," Hz\n"
print "The third resonance frequency is F3=",round(f3)," Hz\n"
import math #Example 13_5
#To find the speed of the wave
l=300*10**-2 #Units in Meters
lamda3=(l*2)/3 #Units in meters
f=20 #Units in sec**-1 or Hz
v=f*lamda3 #Units in meters/sec
print "The speed of the wave is v=",round(v)," meters/sec"
import math #Example 13_6
#To find the youngs modulus
lamda=1.85 #Units in meters
f=2700 #units in sec**-1
v=lamda*f #Units in meters/sec
density=7.86*10**3 #Units in Kg/meter**3
y=v**2*density #Units in N/meters**2
print "The youngs modulus is Y="
print round(y,-8),"N/meters**2"