"""simple docstring"""







import math as m



def       A__    (	lowercase_     :	Any      , lowercase_     :	Dict      , lowercase_     :	Optional[Any]=0.0_0_1						)  ->							Union[str, Any]:
   return (f(a + h						) - f(a - h						)) / (2 * h)



def       A__    (	lowercase_     :	Dict      , lowercase_     :	Optional[Any]=0      , lowercase_     :	Any=100      , lowercase_     :	Any=0.0_0_0_1      , lowercase_     :	Optional[int]=1e-6      , lowercase_     :	List[Any]=False						)  ->							Optional[int]:
   __lowerCamelCase    		=					xa  # set the initial guess
   __lowerCamelCase    		=					[a]
   __lowerCamelCase    		=					abs(f(lowercase_						)						)
   __lowerCamelCase    		=					lambda lowercase_						: calc_derivative(lowercase_      , lowercase_      , h=lowercase_						)  # noqa: E731  Derivative of f(x)
   for _ in range(lowercase_						):
      if fa(lowercase_						) == 0:
         raise ValueError('No converging solution found'						)
      __lowerCamelCase    		=					a - f(lowercase_						) / fa(lowercase_						)  # Calculate the next estimate
      if logsteps:
         steps.append(lowercase_						)
      if error < maxerror:
         break
   else:
      raise ValueError('Iteration limit reached, no converging solution found'						)
   if logsteps:
      # If logstep is true, then log intermediate steps
      return a, error, steps
   return a, error


if __name__ == "__main__":
     from matplotlib import pyplot as plt

     _SCREAMING_SNAKE_CASE	:		str   =   lambda x: m.tanh(x) ** 2 - m.exp(3 * x)  # noqa: E731
     _SCREAMING_SNAKE_CASE  ,  _SCREAMING_SNAKE_CASE  ,  _SCREAMING_SNAKE_CASE	:		Optional[Any]   =   newton_raphson(
         f, xa=1_0, maxiter=1_0_0_0, step=1e-6, logsteps=True
     )
     plt.plot([abs(f(x)) for x in steps])
     plt.xlabel('''step''')
     plt.ylabel('''error''')
     plt.show()
     print(F"solution = {{{solution:f}}}, error = {{{error:f}}}")














from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
__lowerCamelCase						= 9.8_06_65






def    UpperCamelCase__  (   UpperCAmelCase    ,	UpperCAmelCase     )     ->		None:







							"""simple docstring"""





							if not isinstance(UpperCAmelCase    ,	(int, float)     ):
														raise TypeError('''Invalid velocity. Should be a positive number.'''     )

							if not isinstance(UpperCAmelCase    ,	(int, float)     ):
														raise TypeError('''Invalid angle. Range is 1-90 degrees.'''     )

							# Ensure valid angle
							if angle > 90 or angle < 1:
														raise ValueError('''Invalid angle. Range is 1-90 degrees.'''     )

							# Ensure valid velocity
							if init_velocity < 0:
														raise ValueError('''Invalid velocity. Should be a positive number.'''     )






def    UpperCamelCase__  (   UpperCAmelCase    ,	UpperCAmelCase     )     ->		float:







							"""simple docstring"""





							check_args(UpperCAmelCase    ,	UpperCAmelCase     )
							_a  :    Dict			=						angle_to_radians(2 * angle     )
							return round(init_velocity**2 * sin(UpperCAmelCase     ) / g    ,	2     )






def    UpperCamelCase__  (   UpperCAmelCase    ,	UpperCAmelCase     )     ->		float:







							"""simple docstring"""





							check_args(UpperCAmelCase    ,	UpperCAmelCase     )
							_a  :    Union[str, Any]			=						angle_to_radians(UpperCAmelCase     )
							return round(init_velocity**2 * sin(UpperCAmelCase     ) ** 2 / (2 * g)    ,	2     )






def    UpperCamelCase__  (   UpperCAmelCase    ,	UpperCAmelCase     )     ->		float:







							"""simple docstring"""





							check_args(UpperCAmelCase    ,	UpperCAmelCase     )
							_a  :    str			=						angle_to_radians(UpperCAmelCase     )
							return round(2 * init_velocity * sin(UpperCAmelCase     ) / g    ,	2     )






def    UpperCamelCase__  (   )     ->		None:







							"""simple docstring"""





							_a		,					_a  :    Any			=						25, 20
							assert horizontal_distance(UpperCAmelCase    ,	UpperCAmelCase     ) == 4_0.9_7
							assert max_height(UpperCAmelCase    ,	UpperCAmelCase     ) == 3.7_3
							assert total_time(UpperCAmelCase    ,	UpperCAmelCase     ) == 1.7_4


if __name__ == "__main__":
						from doctest import testmod

						testmod()

						# Get input from user
						__lowerCamelCase						= float(input('Initial Velocity: ').strip())

						# Get input from user
						__lowerCamelCase						= float(input('angle: ').strip())

						# Print results
						print()
						print('Results: ')
						print(F'''Horizontal Distance: {horizontal_distance(init_vel, angle)!s} [m]''')
						print(F'''Maximum Height: {max_height(init_vel, angle)!s} [m]''')
						print(F'''Total Time: {total_time(init_vel, angle)!s} [s]''')