comp.lang.ada
 help / color / mirror / Atom feed
* determine the approximate instantaneous value
@ 2003-04-24  3:37 juelee
  0 siblings, 0 replies; 2+ messages in thread
From: juelee @ 2003-04-24  3:37 UTC (permalink / raw)


Hi everyone,

Many grateful thanks, my question is that,
I am trying to write a program to determine the instantaneous speed of a
runner. This would be similar to the speedometer of the car, where it will
always display the instantaneous speed of the car.

When we want to determine the speed, the method is to get the distance the
runner ran, and divide it by the time taken. My case is that, I know the
distance that the runner has run, and the start time of when he started to
run. However, I do not know his end time. This makes it difficult to
determine the time taken.

Another information about the runner problem is that, this runner will not
just run one time. He will run many times, and everytime he run, it will be
of different distances and I can determine every single distance that he has
run. In addition, I know each and every start time of his runs. The problem
is, the end time of each and every of his runs cannot be determined.

The gap between each and every of his runs will be varying too. For a period
of time, a large number of his runs will be very close together. Then, there
will be a long gap of time before he start to run another series of runs,
which are very close to each other.
I draw a diagram below to illustrate better.

y-axis (meters)
|
|    B1    B2                              B3
|    |    |  |    |                              |    |
|    |    |  |    |                              |    |
|    |    |  |    |                              |    |
|    |    |  |    |                              |    |
|__|__|_|__|_______________|__|____________x-axis (time)
   s1 e1 s2 e2                           s3 e3

I am trying to determine the instantaneous speed of the runner. It does not
need to be exact because we do not have the end time. However, it must be a
close approximate value. I hope you can give me some ideas or suggestions
how to go about this. Many many grateful thanks in advance.








^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: determine the approximate instantaneous value
       [not found] <30aln-egd.ln1@beastie.ix.netcom.com>
@ 2003-04-24 17:55 ` tmoran
  0 siblings, 0 replies; 2+ messages in thread
From: tmoran @ 2003-04-24 17:55 UTC (permalink / raw)


with Ada.Text_IO;
procedure Print_Speed is
  Slowest : Float := 0.0;
begin
  -- A 10 second 100 yard dash is a little faster than 20 mph
  Ada.Text_IO.Put_Line("The best estimate is about 20 mph.");
  Ada.Text_IO.Put_Line("It is definitely less than 186,000 mph.");
  -- code here to find the shortest time between the start of one
  -- race and the end of the previous one, and calculate how slow
  -- he could have run to just barely be ready for the later race.
  Slowest := ...
  Ada.Text_IO.Put_Line("And no slower than" & Float'image(Slowest));
end Print_Speed;



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-04-24 17:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <30aln-egd.ln1@beastie.ix.netcom.com>
2003-04-24 17:55 ` determine the approximate instantaneous value tmoran
2003-04-24  3:37 juelee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox