home

Scientific Computing (Psychology 9040a)

Fall, 2020

Assignment 1

Due: Sep 29 by 11:55 pm (London ON time)


Given parabolic flight, the height \(y\) of a ball is given by the equation:

\[\begin{equation} y = x \tan(\theta) - \left[ \frac{1}{2 v_{0}^{2}} \right] \left[ \frac{g x^{2}}{cos(\theta)^{2}} \right] + y_{0} \end{equation}\]

where \(x\) is a horizontal coordinate (metres), \(g\) is the acceleration of gravity (metres per second per second), \(v_{0}\) is the initial velocity (metres per second) at an angle \(\theta\) (radians) with the x-axis, and \((0,y_{0})\) is the initial position of the ball (metres).

Write a program to compute the vertical height \(y\) of a ball. The program should ask the user to input values for \(g\), \(v_{0}\), \(\theta\), \(x\), and \(y_{0}\), and print out a sentence giving the vertical height of the ball.

Test your program with this example:

enter a value for g (m/s/s): 9.8
enter a value for v0 (m/s): 6.789
enter a value for theta (rad): 0.123
enter a value for x (m): 4.5
enter a value for y0 (m): 5.4
The vertical height of the ball is:  3.77057803072 m