Equations to model tennis ball motion

In summary, the conversation discusses the challenges of modeling ball motion in a tennis game and the difficulty of finding equations that take into account the ball's current velocity. The speaker suggests breaking down the problem into smaller steps, such as first getting the equations right and then focusing on coding. They also mention searching for equations with air resistance included and the possibility of neglecting air resistance and Magnus force for simplicity. The speaker has been doing extensive research on the topic but has not yet found equations that factor in the ball's current velocity.
  • #1
mariano_donat
8
0
I'm creating a tennis game and at this point I'm trying to model ball motion. I found multiple lectures on projectiles equations of motion which seem to apply well for when ball is not moving, but they do not take into account the velocity may have at the time of impact. For example, I found a function that gives me the angle of launch so ball can impact a target point at a given speed. If the ball is not moving, it works well, however if it is, it yields incorrect results. So how would one go about plugging current velocity in projectile equations of motion? For reference, this is how the function to calculate the angle looks like:

Code:
func launchAngle(speed: Float, distance: Float, yOffset: Float, gravity: Float, angle0: inout Float, angle1: inout Float) -> Bool {
        angle0 = 0
        angle1 = 0
  
        let speedSquared = speed * speed
        let operandA = powf(speed, 4)
        let operandB = gravity * (gravity * (distance * distance) + (2 * yOffset * speedSquared))
  
        if operandB > operandA {
            return false
        }
  
        let root = sqrt(operandA - operandB)
  
        angle0 = atan((speedSquared + root) / (gravity * distance))
        angle1 = atan((speedSquared - root) / (gravity * distance))
  
        return true
    }
 
Physics news on Phys.org
  • #2
If I were doing this, I would first get the equations right and then launch into the coding. Trying to do it all in one step is likely to be fraught, particularly if you are discussing the problem with a third party. The first thing anyone on PF would need to do is to unpack your code and write it in algebraic form so it would be the courteous thing to present your question in algebraic form.
Have you done any searching on Google for ballistics with air resistance included? There are hundreds of hits with the equations in.
 
  • #3
For now, I was neglecting air resistance + Magnus force to keep things simple. Equations are right, it's just that I don't seem to be able to find those taking into account ball's current velocity. All of them act from the perspective of "launching" a projectile in rest. I've been watching Sebastian Lague videos on youtube which were really helpful to get the basic equations to work, but even those do not contemplate current motion. So yes, I've been searching/reading a lot for the last couple of weeks and still couldn't find such equations. Doing a search with ballistics also does not seem to yield equations taking this into account.
 

Related to Equations to model tennis ball motion

1. How do you use equations to model the motion of a tennis ball?

To model the motion of a tennis ball, we use equations from classical mechanics, specifically the equations of motion. These equations describe the relationship between an object's position, velocity, and acceleration over time.

2. What are the key variables in the equations for tennis ball motion?

The key variables in the equations for tennis ball motion are the initial position, initial velocity, acceleration due to gravity, and time. These variables are used to calculate the position and velocity of the ball at any given time.

3. How does air resistance affect the equations for tennis ball motion?

Air resistance can significantly affect the motion of a tennis ball, especially at high speeds. It creates a force that opposes the ball's motion, slowing it down and changing its trajectory. To account for air resistance, we can add a drag force term to our equations.

4. Can the equations for tennis ball motion be used to predict a ball's bounce?

Yes, the equations for tennis ball motion can be used to predict a ball's bounce. By considering the initial conditions and the properties of the ball, we can calculate the height and velocity of the ball after each bounce. However, factors such as the surface and temperature of the court can also affect the bounce.

5. Are there any limitations to using equations to model tennis ball motion?

While equations can provide accurate predictions for the motion of a tennis ball, they do have limitations. These equations assume ideal conditions and do not account for factors such as air resistance, spin, and other external forces. Additionally, the equations may not accurately predict the motion of a ball when it collides with other objects on the court.

Similar threads

Replies
10
Views
2K
Replies
4
Views
969
Replies
2
Views
1K
Replies
1
Views
218
Replies
3
Views
971
Replies
8
Views
5K
Replies
4
Views
6K
  • Introductory Physics Homework Help
Replies
16
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
18
Views
4K
Back
Top