#calculate change in pot. energy per unit mass and total change in pot. energy
# variables
g=9.81; #m/s^2 acc. due to gravity
dh=23.; #m change in height
# calculation and result
dpe=g*dh #m^2/s^2 change in pot energy per unit mass
print "change in pot. energy per unit mass is %f m^2/s^2"%dpe
m=10.; #kg
dPE=m*dpe #kgm^2/s^2 or J change in pot. energy
print "The total change in potential energy is %f J"%dPE
#calculate the kinetic energy of bullet
# variables
m=0.01; #lbm mass of bullet
v=2000.; #ft/s
# calculation
KE=(m*v**2/2)*(1.356/32.2) #J
# result
print "the kinetic energy of bullet is %f J"%KE
#Calculate the kinetic energy of bullet fired from a airplane
# variables
v_bp=2000.; #ft/s vel of bullet wrt plane
v_p=-1990.; #ft/s
v_b=v_bp+v_p #ft/s vel of bullet wrt ground
m=0.01; #lbm
# calculation
KE=(m*v_b**2/2)*(1.356/32.2) #J
# result
print "the kinetic energy of bullet fired from a airplane is %f J"%KE
#calculate the change in internal energy of the system
# variables
p=14.7; #lbf/in^2 atmospheric pressure
dV=1.; #ft^3 change in volume
# calculation
dW=p*dV*(144/778.) #Btu work done
dQ=-42.; #Btu heat removed from the system
dU=dQ-dW #Btu change in internal energy of the system
# result
print "the change in internal energy of the system is %f Btu"%dU
#calculate the work done
#work done=change in pot. energy + change in kinetic energy considering steady flow and adiabatic conditions
# variables
v_in=3.; #m/s
v_out=10.; #m/s
dke=(v_in**2-v_out**2)/2.0; #m^2/s^2
g=9.81; #m/s^2
dh=15.; #m change in height in inlet and outlet
# calculation
dpe=g*dh; #m^2/s^2
W=dpe+dke #J/kg
# result
print "The work done is %f J/Kg"%W
#calculate the mass consumed in a nuclear reactor per unit time
# variables
#let D=d/dt
DQ=-13.*10**8; #J/s
DW=7*10.**8; #J/s
#Dm=(DQ-DW)/c^2 where c is velocity of light sice E=mc^2
c=3.0*10**8; #m/s
c1=3.0; #velocity of light without power
p=8. #power of 10 in speed of light
# calculation
Dm=float(DW-DQ)/c/c1 #kg/s
# result
print "the mass consumed in a nuclear reactor per unit time is %f * 10^(-%d) kg/s"%(Dm,p)