Animate math equations in python

Viewed 35

I need to get an input from the user and graph this equation onto a pool table. The equation will allow a cue ball to follow the equation entered. For example, y = sin(X). I am thinking of differentiating the equation in order to find the gradient and then using Pygame, but I'm not sure this is the best solution. I have looked through Pygame, and only found functions for straight lines or arcs rather than equations. I also plan on using functions such as: exponential, absolute and trigonometric equations. I have also considered using Desmos API, however, I don't need to show a graphs but rather allow a cue ball to follow an equation.

  1. Is Pygame the best library to use?
  2. What should I do to the equation first? (Should I differentiate or leave it)
  3. Should I work out the angle of the equation? (Like graphwars)

Overall question: How or what is the best way to make a cue ball follow a trajectory of a math equation on a pool table?

0 Answers
Related