Python Forum
Numerically determining the highest a ball travels when shot straight up
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Numerically determining the highest a ball travels when shot straight up
#1
Hi all, I'm very new to python and I have no prior experience with other coding languages, so my main issues are with the formatting and finding the appropriate vocabulary. 

My goal is to determine the maximum height a ball reaches when thrown straight up.  I already wrote the code for the visual of the ball, but I don't know how to find and display a maximum value.  Any other advice or suggestions in regards to the code I already have would also be greatly appreciated.

Thanks!  Smile

from visual import *

myuniv = display(range = vector(3,3,3))

So = vector(0,1,0)
Vo = vector(0,6,0)
a = vector(0,-9.8,0)
s = vector(0,2,0)

dt = 0.1
t = 0.0

ball = sphere(pos = s, radius = 0.25, color = color.cyan)

while s.y > -2.0:
    rate(25)
    s = .5*a*t**2 + Vo*t + So
    v = a*t + Vo
    t = t + dt
    ball.pos = s
    ballghost = sphere(pos = s, radius = .2)
Reply


Messages In This Thread
Numerically determining the highest a ball travels when shot straight up - by JakeWitten - Apr-21-2017, 02:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Fit straight line to pandas time series data with semilog plot schniefen 2 1,544 Mar-10-2023, 01:08 PM
Last Post: jefsummers
  Determining the Percentage of Voter Population Than999 5 3,936 Dec-29-2019, 09:37 AM
Last Post: DeaD_EyE
  Methods that return the highest score from the list erfanakbari1 7 7,175 Mar-26-2019, 08:32 PM
Last Post: aankrose
  Ball bouncing down a ramp Envyiae 2 2,193 Jan-31-2019, 08:02 PM
Last Post: marienbad
  how to get the highest monthly average temperature? nikhilkumar 2 7,053 Jul-25-2017, 02:33 PM
Last Post: DeaD_EyE
  Returning the highest value out of 3 values ComputerSkillet 2 3,866 Apr-28-2017, 03:16 AM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020