import math
#(a)
#variable Declaration
k=50.0 #Spring constant
m=0.005 # mass in kg
#calculation
wn=math.sqrt(k/m)
#result
print('(a)\nNatural frequency(wn)= %d rad/s' %wn)
#(b)
#calculation
Cc=2*(m*k)**(0.5)
#result
print('\n(b)\nCc=%d' %Cc)
#(a)
import math
#variable Declaration
Cc=1.0 # damping ratio
C=0.7*Cc # Critical damping ratio
m=0.005 # mass
k=50.0 # spring constant
#calculation
w=math.sqrt((k/m)-(C/(2*m))**2)
#result
print('(a)\nw=%.1f rad/s' %w)
#(b)
#variable Declaration
w1=250.0 # angular velocity
#calculation
theta=C*w1/(k-m*w1**2)
print('\ntheta=%f' %theta)
fi=math.atan(-theta)
fi=fi*180.0/math.pi
#result
print('\nfi = %d°'%fi)
import math
#variable Declaration
m=0.005 # mass
c=0.7 # damping ratio
#calculation
y=-math.log(0.01)
t=y*2*m/c
#result
print('t=%.4f Secs' %t)
#variable Declaration
rg1=1200.0 #resistance in Ohm
rg2=1200.0 #resistance in Ohm
rg3=1200.0 #resistance in Ohm
rg4=1200.0 #resistance in Ohm
#calculation
D1=rg1*5.0/100.0
D2=rg2*5.0/100.0
D3=rg3*5.0/100.0
D4=rg4*5.0/100.0
E=12.0
v=E*(((rg1+D1)/(rg1+D1+rg2-D2))-((rg4-D4)/(rg3+D3+rg4-D4)))
v=v*1000.0
#result
print('V0=%d mV' %v)
#variable declaration
g=0.06 # voltage sensitivity
#calculation
t=2.5*10**-3
p=20*9.8*10**4
E=g*t*p
#Result
print('E=%d V' %E)
#resistance in Ohm
c0=25.0 # capacitance in pF
x0=0.5 # distance between plates
x1=0.05 # steady state displacement
#calculations
c1=c0*x0/(x0-x1)
c2=c0*x0/(x0+x1)
#result
print('C1=%.2f pF\nC2=%.2f pF'%(c1,c2))
#(a)
sg_at_60=1.02
#calculation
API=(141.5/sg_at_60)-131.5
#result
print('(a)\nDegrees API = %.2f°API' %API)
#(b)
#calculation
Be=145-145/sg_at_60
#result
print('\n(b)\nDegrees Baume(heavy) = %.1f°Be' %Be)
#(c)
#calculation
Bk=(sg_at_60-1)*1000
#result
print('\n(c)\nDegrees Barkometer = %d°Bk' %Bk)
#(d)
#calculation
Q=(sg_at_60-1)*1000
#result
print('\n(c)\nDegrees Quevenne = %d°Q' %Q)
#(e)
#calculation
Tw=200*(sg_at_60-1.0)
#result
print('\n(d)\nDegrees Twaddel = %d°Tw' %Tw)
import math
#variable Declaration
T=0.5 # Torque Tube Force
sg1=1.02 # Maximum spe.gravity to be measured
sg2=0.98 # Minimum spe.gravity to be measured
wt=1000*10**-6
#calculation
v=T/((sg1-sg2)*wt)
v=math.ceil(v)
#result
print('V=%d cm^3' %v)
import math
#variavle declaration
sg1=0.85 # Maximum spe.gravity to be measured
sg2=0.8 # Minimum spe.gravity to be measured
span=150.0 # D/P cell span
#a
#calculation
H=span/(sg1-sg2)
#result
print('(a)\nH=%d mm = %dm' %(H,H/1000))
#b
#calculation
span_min=1500.0
span2=span_min*(sg1-sg2)
span2=math.ceil(span2)
#result
print('\n(b)\nD/P span = %d mm' %span2)
#variable declaration
Ww=12-2 # Width of water
dw=1000.0 # density of water
#calculation
v=Ww/dw
dx=(10-2)/v
sg=dx/dw
#result
print('Specific Gravity of X =%.1f' %sg)
#(a)
#variable declaration
wt=1.5 # weight of object
#calculation
v_obj=2.0/1000
dx=wt/v_obj
sg=dx/1000
#result
print('(a)\nSpecific Gravity = %.2f' %sg)
#(b)
sgl=0.8 # specific grav of liquid
dens=800.0 # density
#calculation
W1=dens*v_obj-wt
#result
print('\n(b)\nW1 = %.1f kg' %W1)
#(c)
#variable declaration
sg2=1.2 # spe. grav.
dens2=1200.0 # density
#calculation
W2=dens2*v_obj-wt
#result
print('\n(c)\nW2 = %.1f kg' %W2)