h5ex4: Loops, standard library, mathematical functions
You cannot submit for this problem because the homework's deadline is due.
Description
A projectile is fired into the air at an initial speed \(v_0\) and an initial angle \(\theta_0\), with an initial height \(h_0\). Its trajectory can be expressed as
\[y=h_0+\tan(\theta_0)x-\left(\frac{g}{2v_0^2\cos^2\theta_0}\right)x^2,\]
where \(g = 9.81\) is the gravitational acceleration constant.
Implement the bisection method to determine when the projectile touches the ground. Use the constant FLT_EPSILON
as the convergence tolerance and \([75, 85]\) as the initial interval for the bisection method.
Hint 1: FLT_EPSILON
is defined in <float.h>
file and the mathematical functions are defined in <math.h>
.
Hint 2: the trigonometric functions expect angles in radians.
Format
Files
You should submit a tar file containing a c source file ex4.c
Input
one line with a space separated list in the order \(v_0\) \(\theta_0\) height
range_min
range_max
Output
one line showing the result with six decimals
Sample 1
Input
30 30 1.5 75 85
Output
81.970131
Limitation
1s, 32MiB for each test case.
Assignment 5
- Status
- Finished
- Problems
- 4
- Open Since
- 2018-06-21 00:00
- DDL
- 2018-06-28 14:00
- Extension
- 240.0 hour(s)