from math import pi, sin, sqrt
# Given
E = 1.024e-3 # total energy of particle in J
T = 2 * pi # time period of S.H.M. in sec
x = 0.08 * sqrt(2) # distance of partile in meter
t = pi / 4 # time in second
#Calculations
A = x / sin((2 * pi * t) / T)
M = (E * T**2) / (2 * pi**2 * A**2)
#Result
print "Amplitude = %.2f meter\nMass of particle = %.f g"%(A,M/1e-3)
from math import pi
# Given
A = 0.05 # amplitude in meter
T = 10 # time period of S.H.M. in sec
#Calculations
v = (A * 2 * pi) / T
#Result
print "Maximum amplitude of velocity = %.4f meter/sec"%v
from math import pi, sqrt
# Given
E = 9 # total energy of particle in J
U = 5 # potential energy in J
A = 1 # amplitude in meter
m = 2. # mass of harmonic oscillator in kg
#Calculations
kE = E - U# calculation for kinetic energy
k = (2 * kE) / A**2# calculation for force constant
T = (2 * pi) * sqrt(m / k)# calculation for time period
#Result
print "Force constant = %.f J/m\nTime period = %.2f sec"%(k,T)
from math import asin, sin, pi
# Given
A = 0.06 # amplitude in meter
T = 6 # time period of S.H.M. in sec
x = 0.03 # position of particle in meter
#Calculations
delta = asin(1) # by the formula x=Asin(wt+delta) and (at t = 0,x=A)
t = x / (A * sin(((2 * pi) / T) + delta))
#Result
print "Time taken by the particle = %.f sec"%t
from math import pi
# Given
A = 0.05# amplitude in meter
T = 10 * pi # time period of s.h.m. in sec
#Calculations
v = A * (2 * pi / T)
a = A * (2 * pi / T)**2
#Result
print "Maximum velocity = %.e meter/sec\nacceleration = %.e m/sec^2"%(v,a)
from math import pi
# Given
A = 0.06# amplitude in meter
T = 10 * pi # time period of s.h.m. in sec
#Calculation
v = A * (2 * pi / T)
#Result
print "Maximum velocity = %.1e meter/sec"%v
from math import sqrt, pi
# Given
k = 16 # stiffness constant of spring n/m
m = 1 # mass of particle in kg
#Calculations
n = sqrt(k / m) / (2 * pi)
#Result
print "natural frequency = %.2f Hz"%n
from math import sqrt, pi
# Given
l = 1 # length of pendulum in meter
m = 2 # mass of particle in kg
g = 9.8 # acceleration due to gravity in m/sec^2
#Calculation
T = 2 * pi * sqrt(l / g)
#Result
print "The time period of pendulum = %.f sec"%T
from math import sqrt, pi
# Given
m = 100. # mass of particle in gm
#Calculation
n = (1 / (2 * pi)) * sqrt(10 / m) # by using given formula
#Result
print "Frequency = %.2f Hz"%n
from math import sqrt, pi
# Given
f = 3 # acceleration of pendulum in m/sec^2
l = 1 # length of pendulum in meter
g = 9.8 # acceleration due to gravity in m/sec^2
#calculatiom
T = 2 * pi * sqrt(l / (g + f))
#Result
print "Time period of pendulum = %.2f sec"%T
from math import sqrt, pi
# Given
x = 0.3 # stretch in spring in meter
m1 = 6 # mass of first body in kg
m2 = 1 # mass of second body in kg
g = 9.8 # gravitational acceleration of earth in m/sec^2
#Calculations
k = (m1 * g) / x
T = (2 * pi) * sqrt(m2 / k)
#Result
print "Time period of motion = %.2f sec "%T
from math import sqrt, pi
# Given
x = 0.1 # compression in spring in m
F = 10 # restoring force in N
m = 4 # mass of body in kg
g = 9.8 # acceleration due to gravity in m/sec^2
#Calculations
k = F / x
F_ = m * g
x_ = F_ / k
T = (2 * pi) * sqrt(m / k)
#Result
print "Time period of motion = %.2f sec \nCompression of the spring due to the weight of the body = %.3f m "%(T,x_)
from math import exp
# Given
t = 50. # relaxation time in sec
r = 1 / exp(1) # falls in amplitude and energy
#Calculations
s = 1 / (2 * t)
T = 1 / s # by using formula A=A_exp(-st) and using r=A/A_
#Result
print "Time = %.f sec"%T
from math import pi, exp
# Given
n = 260 # frequency in Hz
Q = 2000 # quality factor
r = 1 / (exp(1)**2) # decrease in amplitude
#Calculations
tou = Q / (2 * pi * n)
t = 2 * tou # by using formula A=A_exp(-st) and using r=A/A_
#Result
print "Time = %.3f sec"%t