Computer Program for Dog Chasing Rabbit

  • Context: Undergrad 
  • Thread starter Thread starter corey2014
  • Start date Start date
  • Tags Tags
    Computer Program
Click For Summary

Discussion Overview

The discussion revolves around creating a computer program to simulate the movement of a dog chasing a rabbit, framed within the context of differential equations. Participants explore algorithmic approaches to calculate the positions of both the dog and the rabbit over time, focusing on numerical methods rather than analytical solutions.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant seeks assistance in developing an algorithm to simulate the dog's path as it chases a rabbit, emphasizing a desire to avoid analytical solutions.
  • Another participant questions the specifics of the problem, suggesting that a differential equation is likely involved and requesting clarification on how the positions will be calculated without an equation.
  • A third participant proposes a scenario where the rabbit moves north at a constant speed while the dog chases it at a higher speed, indicating a desire to simulate this chase rather than relying on a known analytical solution.
  • A later reply outlines a two-step process for updating the positions of the dog and rabbit based on their velocities and a small time increment.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the best approach to implement the algorithm, and multiple views on how to calculate the positions remain. The discussion is ongoing and unresolved.

Contextual Notes

There are limitations regarding the assumptions made about the velocities and directions of the dog and rabbit, as well as the specific mathematical formulation of the differential equation involved.

Who May Find This Useful

This discussion may be useful for individuals interested in programming simulations, numerical methods for differential equations, or modeling dynamic systems in a computational context.

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
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 102 ·
4
Replies
102
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
2
Views
6K
  • · Replies 7 ·
Replies
7
Views
4K