Computer Program for Dog Chasing Rabbit

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

The discussion focuses on developing a computer algorithm in C to simulate the path of a dog chasing a rabbit, modeled as a differential equation. The dog runs at a constant speed greater than the rabbit's, and the goal is to calculate the positions of both animals over time without relying on analytical solutions. Participants emphasize the need for a numerical approach to solve the differential equation governing the chase dynamics, specifically detailing the steps to compute the dog's velocity and update positions incrementally.

PREREQUISITES
  • Understanding of differential equations and their numerical solutions
  • Proficiency in C programming language
  • Familiarity with algorithms for simulating motion
  • Knowledge of basic physics concepts related to velocity and acceleration
NEXT STEPS
  • Research numerical methods for solving differential equations, such as Euler's method
  • Learn about implementing simulation algorithms in C for real-time motion tracking
  • Explore graphical libraries in C for visualizing the simulation, such as SDL or OpenGL
  • Investigate optimization techniques for improving simulation performance and accuracy
USEFUL FOR

This discussion is beneficial for computer programmers, particularly those interested in algorithm development, applied mathematics, and simulation modeling. It is especially relevant for individuals looking to enhance their skills in C programming and numerical analysis.

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
2K
  • · 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 6 ·
Replies
6
Views
3K