A Space & astronomy forum. SpaceBanter.com

Go Back   Home » SpaceBanter.com forum » Others » UK Astronomy
Site Map Home Authors List Search Today's Posts Mark Forums Read Web Partners

OT simple and probably dumb math question



 
 
Thread Tools Display Modes
  #1  
Old December 6th 03, 11:05 AM
Dazzer
external usenet poster
 
Posts: n/a
Default OT simple and probably dumb math question

I figure one of you guys would know this ... apologies for the not very on
topic'ness

How do i work out how far a something has travelled if all i know is it has
a constant acceleration and i know how long its been accelerating for ...
ie. to keep it almost astronomy related ... a body falling to earth
accelerating at 9.8m/s/s falls for 10 seconds ... how far (excluding
complicated stuff like drag) .. will it have travelled in those 10 seconds
....

i've been thinking that if i graphed a constant speed (not acceleration)
over time, that maybe the area underneath the plotted line would be the
distance covered ?? this feels like it might be correct ...

i then thought if the above is true then it must apply to a plot of a
constantly accelerating body .. .. now the area covered by the plot would be
triangle ... so this would mean that the distance covered would be:

length of time * acceleration/2

this seemed ... erm ... a bit too simplistic to be true .. so i'm guessing
i'm wrong on my initial assumption or wrong in thinking it applies to both
constant speed over time and constant acceleration over time as well ...

any help much appreciated... before i start dropping things out of the
window and timing them .. .. and be gentle ... please .. ..thanks


  #2  
Old December 6th 03, 11:25 AM
Mark McIntyre
external usenet poster
 
Posts: n/a
Default

On Sat, 6 Dec 2003 11:05:59 +0000 (UTC), in uk.sci.astronomy ,
"Dazzer" wrote:

I figure one of you guys would know this ... apologies for the not very on
topic'ness

How do i work out how far a something has travelled if all i know is it has
a constant acceleration and i know how long its been accelerating for ...


from the basic equiations of motion, for instance
s=ut+0.5at^2
where s= distance, u = start velocity, a is acceleration and t is
time.

--
Mark McIntyre
CLC FAQ http://www.eskimo.com/~scs/C-faq/top.html
CLC readme: http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  #3  
Old December 6th 03, 11:46 AM
Martin
external usenet poster
 
Posts: n/a
Default


"Mark McIntyre" wrote in message
...
On Sat, 6 Dec 2003 11:05:59 +0000 (UTC), in uk.sci.astronomy ,
"Dazzer" wrote:

I figure one of you guys would know this ... apologies for the not very

on
topic'ness

How do i work out how far a something has travelled if all i know is it

has
a constant acceleration and i know how long its been accelerating for ...


from the basic equiations of motion, for instance
s=ut+0.5at^2
where s= distance, u = start velocity, a is acceleration and t is
time.

--
Mark McIntyre


That gave me horrible flash back of those boring old Physics lessons.
Please no more!!!!!!!!!!!!!!

Martin



  #4  
Old December 6th 03, 12:56 PM
Dave Rose
external usenet poster
 
Posts: n/a
Default

"Martin" wrote in message
...

"Mark McIntyre" wrote in message
...
On Sat, 6 Dec 2003 11:05:59 +0000 (UTC), in uk.sci.astronomy ,
"Dazzer" wrote:

I figure one of you guys would know this ... apologies for the not very

on
topic'ness

How do i work out how far a something has travelled if all i know is it

has
a constant acceleration and i know how long its been accelerating for

....

from the basic equiations of motion, for instance
s=ut+0.5at^2
where s= distance, u = start velocity, a is acceleration and t is
time.

--
Mark McIntyre


That gave me horrible flash back of those boring old Physics lessons.
Please no more!!!!!!!!!!!!!!

Martin


And who can remember counting the dots on those ticker-tape recorders :-)

Dave


  #5  
Old December 6th 03, 03:03 PM
Dazzer
external usenet poster
 
Posts: n/a
Default


"Mark McIntyre" wrote in message
How do i work out how far a something has travelled if all i know is it

has
a constant acceleration and i know how long its been accelerating for ...


from the basic equiations of motion, for instance
s=ut+0.5at^2
where s= distance, u = start velocity, a is acceleration and t is
time.


Thanks ... i think i was barking up the right tree ... cheers for the
assistance ....


  #6  
Old December 6th 03, 03:34 PM
Fleetie
external usenet poster
 
Posts: n/a
Default

Play with my little code, dude. It's an ongoing project and it seems
to do the right stuff so far but I am having problems with collisions.
Once the masses get too close, the maths blows up, and they're flung off
at ridiculous speeds - sometimes superluminally! I still need to decide
how to handle this.

I'm having fun with it so far. Oh, and I discovered CygWin which is VERY
nice if you can't be bothered to install Linux. (I needed a free C compiler
and went for gcc, of course, but ended up installing CygWin, and very nice it
is, too.)

This runs TEN times faster on my Athlon 2000 than on the really-not-bad-at-
all Sun machine at work. That machine sucks at floating point.


Martin
------
/*
grav_sim.c M.A.Poyser, 20031127 Thu. - 20031206 Sat.

This is a code to perform discrete-time-step simulations of gravitational
interactions between particles.

Each particle has a mass, and an initial position and velocity in (x,y,z).

The program computes the positions of the particles as a function of time,
as they are influenced by each other's gravitational attraction.

All quantities are in S.I. units.
*/


#include stdlib.h
#include stdio.h
#include math.h


#define FALSE 0
#define TRUE 1

#define G 6.672e-11 /* Gravitational Constant */


#define DIM_X 10 /* Dimension of lattice */
#define DIM_Y 10
#define DIM_Z 10

#define MAX_PARTICLES DIM_X*DIM_Y*DIM_Z


#define TIME_INTERVAL 1.0 /* Between recalculations for particles */
#define ITERS_PER_PRINT 10 /* Number of cycles between position reprints */
#define SIMULATION_DURATION 100.0 /* Length of simulated time to run for */


#define XMAX 1000 /* Dimensions of output graphics files, in pixels */
#define YMAX 1000

typedef unsigned long long int LONGINT;
typedef double REAL;


typedef struct
{
REAL

r, /* radius */ /* Not used at present */

m, /* mass */

x, /* position */
y,
z,

v_x, /* velocity */
v_y,
v_z;

int
type; /* For colour-coding different types of particles when visualising, etc. */

} part_type;


part_type parts[MAX_PARTICLES]; /* The array of particles */


void separation(part_type *,part_type *,REAL *, REAL *);
int run_sumulation();


int main()
{
unsigned long int i,j,k,m;

LONGINT n;


/* Initialise the array of particles */
for (i=0;iDIM_X;i++)
{
for (j=0;jDIM_Y;j++)
{
for (k=0;kDIM_Z;k++)
{
n=(i*DIM_Y*DIM_Z)+(j*DIM_Z)+k;
parts[n].x=i*1.0;
parts[n].y=j*1.0;
parts[n].z=k*1.0;
parts[n].m=1.0;
parts[n].r=0.01;
parts[n].v_x=0.0;
parts[n].v_y=0.0;
parts[n].v_z=0.0;
parts[n].type=1;
}
}
}


(void)run_simulation();

return(0);

} /* main() */


/*
This only prints the positions of 5 of the particles at the moment. Normally you'd
have graphical rendering of the particles here, or a dump of the positions of all the
particles.
*/
void display_positions(LONGINT iters)
{

LONGINT i;

for (i=0;i5;i++)
{
fprintf(stderr,"i=%lld, x=%8.10f, y=%8.10f, z=%8.10f, v_x=%9.6f, v_y=%9.6f,
v_z=%9.6f\n",i,parts[i].x,parts[i].y,parts[i].z,parts[i].v_x,parts[i].v_y,parts[i].v_z);
}

fprintf(stderr,"\n");

} /* display_positions() */


/* This is the function that does all the work. */
int run_simulation()
{
int
stop;

LONGINT
i,
j,
iters=0;

REAL
t,
xi,
yi,
zi,
dx,
dy,
dz,
r,
r_sq,
r_sq_r,
f_recip_r_sq_r,
recip_m,
half_delta_t_sq,
Gm_i,
a_x,
a_y,
a_z,
delta_t,
tot_f_x,
tot_f_y,
tot_f_z;

part_type
*part_i,
*part_j;


t=0.0; /* Time starts at zero */
delta_t = TIME_INTERVAL;

stop=FALSE;

while (!(stop))
{

if ((iters % ITERS_PER_PRINT)==0)
{
fprintf(stderr,"iters=%lld, time=%f, delta_t=%f\n",iters,t,delta_t);
display_positions(iters);
}

/*
New set of computations for each particle
*/
for (i=0;iMAX_PARTICLES;i++)
{
part_i=parts+i;

/* Zero the total net force components */
tot_f_x=
tot_f_y=
tot_f_z=0.0;

/* For optimisation, compute G * parts[i].m here, and call it Gm_i */
Gm_i=G*part_i-m;

xi=part_i-x;
yi=part_i-y;
zi=part_i-z;

/*
Compute net force due to all OTHER particles
*/
for (j=0;jMAX_PARTICLES;j++)
{
if (j==i) continue; /* Ignore this particle itself! */

part_j=parts+j;

/*
The code here has been optimised by hand a little, because
this is a "tight" loop, and we really can't afford to waste cycles
here, so it's not mathematically as legible as it was originally.
*/

dx=part_j-x - xi;
dy=part_j-y - yi;
dz=part_j-z - zi;

r_sq = dx*dx + dy*dy + dz*dz;
r = sqrt(r_sq);
r_sq_r=r_sq*r;

/*
To resolve f into x,y,z components, the direction of the vector
points TOWARDS j, and the x component is f * ((x_j - x_i)/r), etc.
*/
f_recip_r_sq_r=(Gm_i * part_j-m)/r_sq_r;

/*
Add force contribution on particle i from particle j. This will
accumulate the net force on particle i from all other particles.
*/
tot_f_x+=dx*f_recip_r_sq_r;
tot_f_y+=dy*f_recip_r_sq_r;
tot_f_z+=dz*f_recip_r_sq_r;

} /* for (j=0,jMAX_PARTICLES;j++) */

/*
We now have the net force on particle i, resolved into x,y,z components.
Now set the acceleration x,y,z components for particle i. F=ma.
*/
recip_m=1.0/part_i-m;
a_x = tot_f_x * recip_m;
a_y = tot_f_y * recip_m;
a_z = tot_f_z * recip_m;

/* Here we have the notional "Wait" period, or time interval, of delta_t. */

/*
Now, after the time interval, calculate the particle's new position, from
its previous position, and its velocity at the start of the time interval.
s = u.t + 0.5 . a . t^2
*/
half_delta_t_sq=0.5*delta_t*delta_t;
part_i-x+=part_i-v_x * delta_t + (a_x * half_delta_t_sq);
part_i-y+=part_i-v_y * delta_t + (a_y * half_delta_t_sq);
part_i-z+=part_i-v_z * delta_t + (a_z * half_delta_t_sq);

/*
Now calculate the velocity of particle i after time interval delta_t,
in order to arrive at the particle's new velocity. v = u + at.
*/
part_i-v_x += a_x * delta_t;
part_i-v_y += a_y * delta_t;
part_i-v_z += a_z * delta_t;

/*
Now we have the particle's new position and velocity, which will act as
the "inputs" for its next cycle.
*/

/*
We should now do some "collision detection", to handle cases where
particles get too close to each other. This is not as simple as it may
first appear!

Particle i has a radius, and every other particle has a radius. Check
every OTHER particle j, and if it is closer to particle i than the sum of
their radii, do something to make things "safer" and stop the maths
blowing up. There are various possibilities he

You could construct an imaginary line between their centres, and reposition
them so that both their centres remain on that line, but their separation
increases to the sum of their radii. However this seems unsafe, because
what if that moves one or both particles too close to some _other_
particle(s)?

You could eliminate both particles from the simulation. This is the
simplest possibility.

You could "freeze" both particles where they are and not allow them to
move further. This is similar to the above possibility.

You could kind of "coalesce" them into one new particle with total mass
equal to the sum of its constituents' masses, compute a new velocity based
on the velocities and masses of the constituents, and set the density
equal to the (weighted) mean of the densities of the constituents. Then
erase particle j, modify particle i to be this new particle. Then break
out of, and restart the inner loop j, considering particle i to be this
new particle. This is necessary because particle i has now increased in
size, and may now be overlapping with other particles. Although somewhat
fanciful, this does seem like the best, most realistic possibility, though
it is the most elaborate to code.

Add this code later.
*/
} /* for (i=0;in_parts;i++) */


iters++;
t+=delta_t;

stop=(tSIMULATION_DURATION);

} /* while(!(stop)) */


return(0);

} /* run_sumulation() */





  #7  
Old December 6th 03, 04:43 PM
Martin
external usenet poster
 
Posts: n/a
Default


"Dave Rose" wrote in message
...
"Martin" wrote in message
...

"Mark McIntyre" wrote in message
...
On Sat, 6 Dec 2003 11:05:59 +0000 (UTC), in uk.sci.astronomy ,
"Dazzer" wrote:

I figure one of you guys would know this ... apologies for the not

very
on
topic'ness

How do i work out how far a something has travelled if all i know is

it
has
a constant acceleration and i know how long its been accelerating for

...

from the basic equiations of motion, for instance
s=ut+0.5at^2
where s= distance, u = start velocity, a is acceleration and t is
time.

--
Mark McIntyre


That gave me horrible flash back of those boring old Physics lessons.
Please no more!!!!!!!!!!!!!!

Martin


And who can remember counting the dots on those ticker-tape recorders :-)

Dave


Yes and that silly box with a bit of gold fag paper in it. We used to set
fire to the gas taps to create our own fun. And we once electrocuted out
Physics teacher as we had something like 500 volts across a wire that should
have only has about 12 and he put his finger on it. Boy did we laugh (he
was OK, before some Guardian reader whines) Good fun though!!!

Martin


  #8  
Old December 6th 03, 04:44 PM
Alan
external usenet poster
 
Posts: n/a
Default


"Dave Rose" wrote in message
...
"Martin" wrote in message
...

"Mark McIntyre" wrote in message
...
On Sat, 6 Dec 2003 11:05:59 +0000 (UTC), in uk.sci.astronomy ,
"Dazzer" wrote:

I figure one of you guys would know this ... apologies for the not

very
on
topic'ness

How do i work out how far a something has travelled if all i know is

it
has
a constant acceleration and i know how long its been accelerating for

...

from the basic equiations of motion, for instance
s=ut+0.5at^2
where s= distance, u = start velocity, a is acceleration and t is
time.

--
Mark McIntyre


That gave me horrible flash back of those boring old Physics lessons.
Please no more!!!!!!!!!!!!!!

Martin


And who can remember counting the dots on those ticker-tape recorders :-)

Dave



Yes I can remember those ..... and the 'friction compensated runway'. All to
demonstrate some relatively boring simple equations, which I would have
accepted and understood without tedious 'verification' by experiment :-)


  #9  
Old December 6th 03, 06:20 PM
Jonathan Silverlight
external usenet poster
 
Posts: n/a
Default

In message , Martin
writes

"Mark McIntyre" wrote in message
.. .
On Sat, 6 Dec 2003 11:05:59 +0000 (UTC), in uk.sci.astronomy ,
"Dazzer" wrote:

I figure one of you guys would know this ... apologies for the not very

on
topic'ness

How do i work out how far a something has travelled if all i know is it

has
a constant acceleration and i know how long its been accelerating for ...


from the basic equiations of motion, for instance
s=ut+0.5at^2
where s= distance, u = start velocity, a is acceleration and t is
time.

--
Mark McIntyre


That gave me horrible flash back of those boring old Physics lessons.
Please no more!!!!!!!!!!!!!!


Heresy! Haven't you read "Have Spacesuit, Will Travel"? Kip does that
calculation to be sure he's on Pluto, and remembers his Dad saying
"anyone who can't use a slide rule is a cultural illiterate and should
not be allowed to vote".
The slide rule is part of history, but the principle is sound.
--
Rabbit arithmetic - 1 plus 1 equals 10
Remove spam and invalid from address to reply.
  #10  
Old December 6th 03, 10:36 PM
Martin
external usenet poster
 
Posts: n/a
Default


"Jonathan Silverlight" wrote
in message ...
In message , Martin
writes

"Mark McIntyre" wrote in message
.. .
On Sat, 6 Dec 2003 11:05:59 +0000 (UTC), in uk.sci.astronomy ,
"Dazzer" wrote:

I figure one of you guys would know this ... apologies for the not

very
on
topic'ness

How do i work out how far a something has travelled if all i know is

it
has
a constant acceleration and i know how long its been accelerating for

....

from the basic equiations of motion, for instance
s=ut+0.5at^2
where s= distance, u = start velocity, a is acceleration and t is
time.

--
Mark McIntyre


That gave me horrible flash back of those boring old Physics lessons.
Please no more!!!!!!!!!!!!!!


Heresy! Haven't you read "Have Spacesuit, Will Travel"? Kip does that
calculation to be sure he's on Pluto, and remembers his Dad saying
"anyone who can't use a slide rule is a cultural illiterate and should
not be allowed to vote".
The slide rule is part of history, but the principle is sound.


No problems with Slide Rules, I still own two of them. What got me was that
when I did my O' levels we could use a slide rule in lessons but not in the
exams (remember log tables anyone?) What got me was that much of what was
taught as O' level was dumped at A' level. So why bother?

Martin








 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:24 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 SpaceBanter.com.
The comments are property of their posters.