I wanted to just raise a comment, but dont have the reputation to do so...
I didnt get the same result as the python simulation, so ill just detail my thoughts below.
Some assumptions (do deal with riddle as probably intended, as opposed to a real world problem):
- Instantaneous acceleration to new speed when we hear an alarm.
- An alarm is the wave-front of the sound emission from a point source on the dogs tail.
- Alarms start behind the dog (ears are behind tail).
- The alarm propagates through air (earth-like atmosphere).
- The alarm does not register through the dog (reverberation through dog body not felt).
- Once an alarm reaches us, causing us to increase speed, this alarm will be considered in front of us (to avoid an acceleration dependent race condition on the wave that pushes us over speed of wave propagation).
We'll start at 5 m/s.
So long as we're slower than speed of sound(330 m/s), the wave will reach/pass us, and we will double speed.
The wave that causes us to break speed of sound, will be the last wave to pass us (last wave ahead of us that we may overtake).
So basically, we will double once ever 10 seconds:
Each comma above is a wave that passed us, causing us to double speed. There are 7 waves in front of us when we're traveling at 640 m/s.
We may potentially overtake all these.
This means doubling our initial speed 14 times.
5*(2^14) = 81920 m/s.
This max is achieved if all waves are overtaken in the 2 mins.
The first wave will be the furthest away, emitted at position 50m, and traveling as far as 36350m by the 2 min mark (50 + 330*(120-10)).
The dog breaks speed of sound at the 70sec mark, located at 6350m. From there, if it never speeds up again in the final 50 seconds, it will reach 38350m by the 2 min mark (6350 + 640*(120-70)).
Since 38350 > 36350, it will overtake all 7 waves in front of it (thereby going well past 38350m) and reach the cap of 81920 m/s.