Loss in kinetic energy of a raindrop hitting the sea.

Code: Select all

function ke(m as double,v as double) as double

return .5*m*v^2

end function

function momentum(m as double,v as double) as double

return m*v

end function

dim as double pi=4*atn(1)

dim as double radius_raindrop=3e-3 'metres

dim as double mass_raindrop=1000*(4/3)*pi*radius_raindrop^3 'density * volume kg

dim as double mass_earth=5.9e24 'kg

dim as double velocity_raindrop,velocity_earth,resultant_velocity

velocity_raindrop=10 'terminal velocity (metres per second) of a raindrop

velocity_earth=0 'velocty of earth with reference to itself.

dim as double ke1=ke(mass_raindrop,velocity_raindrop) + ke(mass_earth,velocity_earth)

color 15

print "Before impact"

color 3

print "Total knetic energy ";ke1;" joules"

color 15

dim as double mom1=momentum(mass_raindrop,velocity_raindrop)

dim as double mom2=momentum(mass_earth,velocity_earth)

dim as double system_momentum=mom1+mom2

print "total momentum ";system_momentum;" kg.m/s"

print ". . ."

print "after impact"

print ". . ."

' system_momentum=(mass_raindrop+mass_earth)*resultant_velocity where resultant_velocity is the new combined velocity

'so:

resultant_velocity=system_momentum/(mass_raindrop+mass_earth)

dim as double ke2=ke(mass_raindrop+mass_earth,resultant_velocity) 'new kinetic energy

print "Total knetic energy ";ke2;" joules"

print "Total momentum ";momentum(mass_raindrop+mass_earth,resultant_velocity);" (conserved)";" kg.m/s"

color 3

print "Loss in knetic energy ";ke1-ke2;" joules"

color 15

print "Done"

sleep

Freebasic double doesn't catch the miniscule differences.