from __future__ import division
from math import sqrt, pi
# FREQUENCY AND TIME PERIOD
#format('v',6)
#ph=50*x**2+100 in joule/kg
m=10 #mass in kg
f=10**3/m #joule/kg
w=sqrt(f) #oscillations
fr=w/(2*pi) #oscillations/sec
tp=1/fr #seconds
print "Frequency of oscillation = %0.1f oscillations/seconds "%fr
print "Time period = %0.3f seconds " %tp
# ENERGY
ke=5 #joule
pe=5 #joule
rep=10 #joule
eo=rep+ke+pe #joule
print "Energy of the oscillator = %0.f J" %eo
#peroid ,maximum velocity and acceleration
a=3 #cm
b=4 #cm
A=sqrt(a**2+b**2) #cm
w=2 #sec**-1
T=(2*pi)/w #seconds
um=w*A #cm/s
am=w**2*A #cm/s**2
print "Time period = %0.f seconds" %T
print "Maximum velocity = %0.f cm/s" %um
print "Maximum acceleration = %0.f cm/s2 " %am
from math import pi
# maximum velocity and acceleration
A=5 #cm
T=31.4#seconds
w=(2*pi)/T #sec**-1
um=w*A #cm/s
am=w**2*A #cm/s**2
print "Maximum velocity = %0.f cm/s" %um
print "Maximum acceleration = %0.1f cm/s2 " %am
from math import pi, sqrt
# Period
#given data :
g=9.8 # constant
l=1 # in m
theta_m1=60 # in degree
theta_m=pi/3 # in radians
T0=round(2*pi*sqrt(l/g))
print "(a) Time period for small displacement, T0 = %0.f seconds " %T0
T=T0*(1+(theta_m**2/16))
print "(b) Time period, T = %0.1f seconds " %T
# ENERGY
es=1 #joule
l=2 #metre
am=3 #cm
am1=5 #cm
e1=(am1**2/am**2)*es #joules
l2=1 #meter
e2=(l/l2)*es #joules
print "Energy in first case = %0.3f J" %e1
print "Energy in second case = %0.1f J" %e2
from math import sqrt, pi
# Period of motion
#given data :
x=0.16 # in m
m1=4 # in kg
g=9.8
K=m1*g/x
m=0.50 # in kg
T=2*pi*sqrt(m/K) #
print "The period of motion, T = %0.2f seconds " %T
# answer is wrong in textbook
from math import sqrt
#foce constant,displacement , acceleration and energy
#given data :
x1=.10 # in m
F1=4 # in N
K=F1/x1
x2=0.12 # in m
print "(a) The force constant, K = %0.2f N/m" %K
F=-K*x2
print "(b) The force, F = %0.2f N" %F
m=1.6 # in kg
T=2*pi*sqrt(m/K)
print "(c) Period of oscillation, T = %0.3f s " %T
A=x2
print "(d) Amplitude of motion, A = %0.2f m " %A
alfa=A*K/m
print "(e) Maximum acceleration, alfa = %0.2f m/s2 " %alfa
x=A/2 # in m
w=sqrt(K/m)
v=w*sqrt(A**2-x**2)
a=w**2*x # in m/s**2
KE=(1/2)*m*v**2 # in J
PE=(1/2)*K*x**2 # in J
TE=KE+PE
print "(f) Velocity = %0.2f m/s " %v
print "(f) Acceleration = %0.2f m/s2 " %a
print "(f) Kinetic energy = %0.2f J " %KE
print "(f) Potential energy = %0.2f J" %PE
print "(g) Total energy of the oscillating system, TE = %0.2f J" %TE
# In textbook part f is inculded in the part e so their is the numbeing error in parts
from math import sin
from sympy import symbols, pi
# ENERGY
t=8/3 #seconds
v=-10*pi*sin((35*pi)/6)#cm/s
print "Velocity =",v,"cm"
from math import sqrt, pi
#given data :
K1=3 # in N/m
K2=2 # in N/m
m=0.050 # in kg
w=sqrt((K1+K2)/m)
n=w/(2*pi)
print "(i) The frequency, n = %0.2f oscillations/sec " %n
A=0.004 # in m
E=(1/2)*A**2*(K1+K2)
print "(ii) The energy, E = %0.e J " %E
v=sqrt(2*E/m)
print "(iii) The velocity, v = %0.2f m/s" %v
# Rotational inertia
#given data :
M=0.1 # in m
l=0.1 # in m
I1=M*l**2/12 # in kg-m**2
T1=2 # in s
T2=6 # in s
I2=(I1*T2**2)/T1**2
print "Rotational inertia, I2 = %0.1e kg-m2 " %I2
from math import sqrt
# Time period
#given data :
M=4 # in kg
R=0.10 # in m
I=(2/5)*M*R**2 # in kg.m**2
C=4*10**-3 # in Nm/radian
T=2*pi*sqrt(I/C)
print "Time period, T = %0.2f s " %T
# answer is wrong in textbook
from math import sqrt, pi
# Energy
#given data :
L=10*10**-3 # in H
C=20*10**-6 # in F
n=1/(2*pi*sqrt(L*C))
V=10 #in V
U=(1/2)*C*V**2
print "Frequency, n = %0.2f cycles/s " %n
print "Energy of oscillations,U = %0.1e J " %U
#answer of frequency is calculated wrong in textbook
# distance,binding energy and force constant
print "Equilibrium inter-nuclear distance correspondes to lowest potential enegy is ro= 2*Å"
pet=0 #eV
peb=-4 #eV
be=pet-peb #eV
x1=-2 #eV
x2=-4 #eV
V=x1-x2 #eV
e=1.6*10**-19 #electronic charge
x=0.5 #armstrong
K=((2*V)/x**2) #eV/Å**2
k1=(K*e)/(10**-10)**2 #joule/m**2
print "Binding energy = %0.2f eV " %be
print "Force constant = %0.2f N/m " %k1
# possible values and energy
r1=2 #from graph
r2=4.5 #units from graph
print "Possible values of r are",r1,"units and",r2,"units."
osc=1-(-2.5) #units
print "Maximum energy of oscillations for r=2 units is",osc,"units."
osc1=0.5-(-1) #units
print "Maximum energy of oscillations for r=4.5 units is",osc1,"units."
t=1 #from graph
v=0 #from graph
e=t+v #
print "Total energy = %0.2f unit " %e
print "At infinity V =",v,"therefore T =",t,"unit."
from math import sqrt, pi
# Frequency
#given data :
m1=10 # in g
m2=90 # in g
K=10**3 # in N/m
mu=m1*m2*10**-3/(m1+m2)
n=round(sqrt(K/mu)/(2*pi))
print "The frequency, n = %0.2f oscillations/sec " %n
x1=0 #
x2=10 #cm
xb=((m1*x1+m2*x2)/(m1+m2)) #cm
mo=(m1*10**-3)*(xb*10**-2)**2+(m2*10**-3)*(1*10**-2)**2 #
print "Moment of inertia = %0.1e kg-m2 " %mo
from math import sqrt, pi
# frequency and amplitude
c=10**-4 #N-m
m1=9 #gm
m2=1 #gm
mu=((m1*m2)/(m1+m2))*10**-3 #kg
r=20 #cm
I=mu*(r*10**-2)**2 #kg-m**2
fr=((1/(2*pi))*sqrt(c/I)) #vibrations/sec
print "Frequency of vibration = %0.2f vibrations/s " %fr
e=10**-2 #joule
thmax=sqrt((2*e)/c) #radians
print "Amplitude = %0.2f radians " %thmax
from math import sqrt
# frequency ,energy and maximum velocity
c=1 #N-m
m1=6 #gm
m2=2 #gm
mu=((m1*m2)/(m1+m2))*10**-3 #kg
fr=((1/(2*pi))*sqrt(c/mu)) #vibrations/sec
print "Frequency of oscillations = %0.1f vibrations/s " %fr
td= 1+(1/3) #cm
e=((1/2)*c*(td*10**-2)**2) #joule
print "Energy = %0.1e J " %e
y=((1/2)*m2*10**-3)+((1/2)*(1/3)**2*m1*10**-3) #
v1=sqrt((e/y)) #m/sec
print "Maximum velocity of smaller mass = %0.2f m/s" %v1
#velocity is calculated wrong in the book
from math import sqrt, pi
# frequency
k=100 #N/m
m=100 #gm
n1=((1/(2*pi))*sqrt(k/(m*10**-3))) #sec**-1
m1=100 #gm
m2=200 #gm
mu=((m1*m2)/(m1+m2))*10**-3 #kg
fr=((1/(2*pi))*sqrt(k/mu)) #sec**-1
print "In first case frequency = %0.f sec^-1 "%n1
print "In second case frequency = %0.1f sec^-1 "%fr
# force constant and work done
m1=1 #assume
m2=19 #assume
mh=1.66*10**-27 #kg
mu=((m1*m2)/(m1+m2))*mh #kg
w=7.55*10**14 #radians/sec
k=mu*(w)**2 #N/m
print "Force constant = %0.1f N/m " %k
x=0.5 #arngstrom
wh=((1/2)*k*(x*10**-10)**2) #joule
print "Work done = %0.3e J" %wh
from math import sqrt
# frequency
m1=1 #a.m.u
m2=35 #a.m.u
mu1=((m1*m2)/(m1+m2)) #a.m.u
m3=2 #
mu2=((m3*m2)/(m3+m2)) #a.m.u
n1=8.99*10**13 #cycle/sec
n2=(sqrt(mu1/mu2))*n1 #c/s
print "Frequecy of vibrations = %0.2e c/s " %n2