Squares

General FreeBASIC programming questions.
dodicat
Posts: 5913
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Postby dodicat » Jun 22, 2019 10:43

Some tedious physics (but it has to be done)
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.
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 22, 2019 16:46

@Richard

For the water collision energy:

E = Mass * Drag * velocity ^ 2 = MDV^2 : derived from Newtons E = MV^2

Drag has to be greater than 0 , else the formula results in 0...
Drag has to be equal to or greater than 1.
Fractions , less than 1 , would result in abnormally large or small energies.( false report )

So you would need to create a "Drag Scale".. And call the object , with the least drag = drag 1.
All other objects have drag 1 + ?

Where a perfectly streamlined shape is drag 1 , A vertical plate , the height and width of the perfectly streamlined shape , is drag 1 x ??

So:
Drag 1 , would exhibit resistance "n" grams , per mph wind speed..
Drag 2 , would exhibit resistance "n" grams * 2 , per mph wind speed.
Drag 3 , etc....

Maybe the D in MDV^2 could be replaced with the "n" grams "Resistance" per mph wind speed = MRV^2

The grams "R" resistance would compound the the "M" mass

======================================================================================
Richard wrote:
There is no magical "me" threshold in physics. Outputs are proportional to inputs.
“Joules per second” is the rate of flow of energy, which is called power, the unit is the watt.

Richard : If i put a spoon in water and move it in slow motion , it won't create a wake. ( the water can absorb the motion.)
If i accelerate to a certain velocity , ( between 1/2 and 1 mph ) it creates a wake.. ( pressure wave in front and vacuum behind.)
The Joules it takes , to create the slightest wake , is the "me" Joules of water ( me = maximum energy )..
Anything over "me" Joules results in bigger and bigger waves.

If water has an "me" threshold , of 1 joule , and i impart 2 joules of energy to the water , the water will absorb 1 joule of energy , the other joule causes a pressure wave to rise up.
You might be able to calculate the height and speed of the pressure wave... by knowing "me" joules...
You might be able to calculate "me" joules, by knowing the dimensions and speed of a flat plate to make the slightest wake...
badidea
Posts: 1461
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Squares

Postby badidea » Jun 22, 2019 19:16

Sounds like: "I reject your reality and substitute it with my own."
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 22, 2019 19:34

If i drop a pin into water , tip first. It takes "n2" seconds to submerge to it's top. So the Joules are spread out over a time span
If i drop a pin into water , horizontally. It takes "n1" seconds to submerge to it's top. So the Joules are spread out over a shorter time span.

The pin dropping in tip first , makes a lesser wave than the pin dropping in horizontally...
For some unknown reason ; the pin dropping in at a 45 degree angle makes a bigger wave than dropping in horizontally..

With the pin dropping in diagonally, the wave is focused to the direction of the top of the pin..

If you want to make waves in the swimming pool..
Falling in flat makes a 1 foot high wave and hurts like crazy.
if you curl into a ball and drop in butt first it makes like a 2 foot wave

if you drop in at a 45 degree angle , it makes the biggest wave. ( but , can cause a concussion). But the wave is focused towards your head. So you can direct the wave towards the person you want to hit with the wave...( the splatters will go out 10 or more feet)
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 22, 2019 21:10

I'm not sure that water has a certain joules a second of "me" (max energy)

I think it might be a certain velocity per second , and maybe mass ; doesn't play a role.

if i move a pin through the water , at a certain velocity , it will create a wake.
I think that a square inch plate , would have to move at the same velocity , to make a wake.

The wake might be different sizes based on volume displacement or area , but i think its the "acceleration" that causes the smallest wake.

Any size raindrop will cause a ripple.. The bigger the drop the bigger the ripple.
But if you slow the drops down to a certain velocity , the water won't be disturbed by the drops falling in. regardless of their mass and volume.

So: i think maybe , waves are a result of velocity , and not mass or volume.

If i lay a hammer on glass, it won't vibrate , no matter the weight and mass of the hammer..
I have to accelerate the hammer to a certain velocity to make waves in the glass.. Same with water.

Waves are caused by velocity or acceleration..

If i put two boats in the water of different displacements , they won't cause waves no matter how big or small , it requires a velocity to make waves..
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 22, 2019 21:54

With the water ( rain ) drops.. If i slow the velocity of the drop , down to like .001 milli-meters a second..
The drops will enter the water without making ripples in it..

It requires a certain velocity to cause ripples or vibrations..

Energy only comes into play to determine the amplitude and maybe speed of the ripple..
Energy "e" , causes volume "x" of water to rise up in the collision in "t" milliseconds. = amplitude and speed.

There has to be a maximum velocity , that a raindrop can fall at , before it causes a ripple.. maybe .01 millimeters a second?

A hammer of dimensions "xy" will cause a vibration in glass at the same velocity as a hammer of dimensions "xy*2"

So "energy" = mass per period , doesn't play a role...Only velocity.
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 23, 2019 1:09

@Richard

With Newtons formula E = mass times velocity squared

How would you write that , in computer formula ?

E = M * ( V ^ 2 )
or
E = ( M * V ) ^ 2

I think the two come out to different values??

That's a big problem for me.. How to turn the , formulas into computer jargon..
If you turn the formulas into computer jargon , with the appropriate parenthesis , i can understand them better...Providing the vars are explained in a legend..


With the drag thing,
I looked it up on the web , and it requires a "drag force" to find the drag coefficient..I think you would use the "drag force" in the E = MDV^2
Richard
Posts: 2953
Joined: Jan 15, 2007 20:44
Location: Australia

Re: Squares

Postby Richard » Jun 23, 2019 6:52

If a spherical droplet of water falls on a flat lake, and no one is there to hear it, does it make a noise?
https://researchonline.jcu.edu.au/2065/ ... ers1-2.pdf
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 23, 2019 16:00

@Richard

If i wave my hand around in the air it doesn't make a vibration..
If i bring my two hands together in a push or gently nudge , it doesn't make a sound.

I have to accelerate my hands together in a collision to cause a sound...

If i wave my hand in the air at a certain velocity it will make a vibration ( speed of sound in air )
If i wave my hand in water at a certain velocity it will make a ripple, ( speed of ?? in water )


===================================================================================
===================================================================================

For the water collision energy:
Energy = mass * drag force * velocity squared. E = MDV^2

Where "drag force" is in mass units per velocity..
If : mass is in pounds
if : velocity is in mph
"drag force" would have to be in pounds per mph ( in water ).

===================================================================================
===================================================================================
Last edited by albert on Jun 23, 2019 17:09, edited 2 times in total.
badidea
Posts: 1461
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Squares

Postby badidea » Jun 23, 2019 16:56

That is just because humans cannot hear pressure waves below 20 Hz.
badidea
Posts: 1461
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Squares

Postby badidea » Jun 23, 2019 17:35

Some ventilation code :-)

Code: Select all

const as single PI = 4 * atn(1)
const as integer W = 800, H = 600

screenres W, H, 32
dim as single angleShift, a1, a2
dim as single angleStep =  PI / 4
while inkey = ""
   screenlock
   line(0, 0)-(W-1, H-1), rgb(0, 0, 0), bf
   for angle as single = 0 to PI * 2 - (angleStep / 2) step angleStep
      for radius as single = 20 to 250 step 10
         a1 = angle + angleShift + (radius / 200) * (pi / 5)
         a2 = a1 + angleStep / 2
         circle (W \ 2, H \ 2), radius, rgb(250, 250, radius), a1, a2
      next
   next
   screenunlock
   sleep 15
   angleShift += PI / 200
wend
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 23, 2019 18:01

@badidea

Nice doodle!!
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 23, 2019 18:06

===================================================================================
===================================================================================

For the water collision energy:
Energy = mass * drag force * velocity squared. E = MDV^2

Where "drag force" is in mass units per velocity..
If : mass is in pounds
if : velocity is in mph
"drag force" would have to be in pounds per mph ( in water ).

===================================================================================
===================================================================================

You might have to calculate the actual speed of the drag???

E = m * ( drag force * v ) * v ^ 2
E = M (DV) V ^ 2

?? Not sure....

It would depend on : if the drag force goes up incrementally for each increase in mph of speed..
If a flat plate exhibits 1 pound of resistance at 1 mph, will it go up to 2 pounds at 2 mph , and 3 pound at 3 mph??
dodicat
Posts: 5913
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Postby dodicat » Jun 23, 2019 19:14

Richard wrote:If a spherical droplet of water falls on a flat lake, and no one is there to hear it, does it make a noise?
https://researchonline.jcu.edu.au/2065/ ... ers1-2.pdf


If it a physics question then yes.
Sound is a branch of physics and the laws of physics apply everywhere (So they say). Noise is indistinguishable from sound in physics.
If it is a philosophical question then it is much more tricky.

Nice badidea.
I am an extractor fan (sorry)
albert
Posts: 4952
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Postby albert » Jun 23, 2019 19:43

@Dodicat

How about a slow motion doodle , to show a raindrop hitting water?

If the raindrop is (width , height) and mass "n" and falls a the speed of gravity.. It submerges to its top in "t" milliseconds..

The raindrop would the displace mass "?" volume of water in time "?" , which would result in wave "height" at speed ?

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest