Computer Program for Dog Chasing Rabbit

  • Thread starter Thread starter corey2014
  • Start date Start date
  • Tags Tags
    Computer Program
corey2014
Messages
22
Reaction score
0
Hey all, I am trying to work on my programming skills. I write programs in C, and I am attempting to write a computer algorithm such that for some small t. Let's call it dt we get the position of a dog, and the position of a rabbit, as the dog chases the rabbit. This is being asked on a mathematics portion because its a differential equation. The prototypical Dog chases a rabbit with some velocity greater than the rabbits, and we want to know what path the Dog takes. I have a program written such that all I need is to plug in points and it will graph the path... The only problem I am running into is how to create an algorithm for this... Any and ALL help is appreciated!

I know the analysis equation, and how that would make this much easier, however, being an applied Mathematics type person I want to write a computer script without using that.
 
Physics news on Phys.org
The only problem I am running into is how to create an algorithm for this

What exactly is this? Calculating the points of where the rabbit and dog are? When you say you know the analysis equation I don't really know what that means, but I'm unclear on how you're going to calculate where the dog is without some sort of equation.

It would help if you spell out your specific problem with more detail: it sounds like you have a differential equation that you just want to calculate the solution of numerically but I really can't be sure
 
Consider a rabbit which sits a distance L east of a dog. At time t = 0 the rabbit
starts running north (in y-direction) at constant speed v. The dog starts chasing the
rabbit at constant speed 2v, and always changes its running direction towards the
rabbit. The rabbit always runs north and never changes direction.

Basically I want a program that goes toward the rabbit other than the easy y=2/3*L{1-(x/2L+1)*sqrt(1-x/L)} and I understand it will never become zero... But I want to simulate this...
 
If you have the current position of the rabbit and of the dog, there are two steps

1 calculate the velocity of the dog

2 assume some small time 1/100 if a second say, had passed and add 1/100th of the signs velocity to his position, and similarly for the rabbit
 
Back
Top