






'''simple docstring'''







from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
UpperCamelCase_					=				9.8_0_6_6_5






def  lowerCAmelCase__		(					a_  :     float			,						a_  :     float			)   -> None:

       # Ensure valid instance
       if not isinstance(a_			,						(int, float)			):
              raise TypeError('''Invalid velocity. Should be a positive number.'''			)

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

       # Ensure valid angle
       if angle > 9_0 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  lowerCAmelCase__		(					a_  :     float			,						a_  :     float			)   -> float:
       check_args(a_			,						a_			)
       UpperCAmelCase__	:   List[Any]												=	angle_to_radians(2 * angle			)
       return round(init_velocity**2 * sin(a_			) / g			,						2			)






def  lowerCAmelCase__		(					a_  :     float			,						a_  :     float			)   -> float:
       check_args(a_			,						a_			)
       UpperCAmelCase__	:   Optional[Any]												=	angle_to_radians(a_			)
       return round(init_velocity**2 * sin(a_			) ** 2 / (2 * g)			,						2			)






def  lowerCAmelCase__		(					a_  :     float			,						a_  :     float			)   -> float:
       check_args(a_			,						a_			)
       UpperCAmelCase__	:   Union[str, Any]												=	angle_to_radians(a_			)
       return round(2 * init_velocity * sin(a_			) / g			,						2			)






def  lowerCAmelCase__		(					)   -> None:
       UpperCAmelCase__							,							UpperCAmelCase__	:   Dict												=	2_5, 2_0
       assert horizontal_distance(a_			,						a_			) == 40.97
       assert max_height(a_			,						a_			) == 3.73
       assert total_time(a_			,						a_			) == 1.74


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

  testmod()

  # Get input from user
  UpperCamelCase_					=				float(input("Initial Velocity: ").strip())

  # Get input from user
  UpperCamelCase_					=				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]')







'''simple docstring'''







import math

import torch
from torch import nn
from torch.nn import init

from .binarizer import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer




class 					__UpperCAmelCase (		nn.Linear	):

      '''simple docstring'''





      def __init__(					self  ,		_UpperCAmelCase  ,		_UpperCAmelCase  ,		_UpperCAmelCase = True  ,		_UpperCAmelCase = "constant"  ,		_UpperCAmelCase = 0.0  ,		_UpperCAmelCase = "topK"  ,		):
             super(_UpperCAmelCase  ,		self						).__init__(in_features=_UpperCAmelCase  ,		out_features=_UpperCAmelCase  ,		bias=_UpperCAmelCase						)
             assert pruning_method in ["topK", "threshold", "sigmoied_threshold", "magnitude", "l0"]
             UpperCAmelCase__	:   Union[str, Any]												=	pruning_method

             if self.pruning_method in ["topK", "threshold", "sigmoied_threshold", "l0"]:
                    UpperCAmelCase__	:   Union[str, Any]												=	mask_scale
                    UpperCAmelCase__	:   Optional[int]												=	mask_init
                    UpperCAmelCase__	:   List[str]												=	nn.Parameter(torch.empty(self.weight.size()						)						)
                    self.init_mask()




      def 							lowerCamelCase     (					self						):
             if self.mask_init == "constant":
                    init.constant_(self.mask_scores  ,		val=self.mask_scale						)
             elif self.mask_init == "uniform":
                    init.uniform_(self.mask_scores  ,		a=-self.mask_scale  ,		b=self.mask_scale						)
             elif self.mask_init == "kaiming":
                    init.kaiming_uniform_(self.mask_scores  ,		a=math.sqrt(5						)						)




      def 							lowerCamelCase     (					self  ,		_UpperCAmelCase  ,		_UpperCAmelCase						):
             # Get the mask
             if self.pruning_method == "topK":
                    UpperCAmelCase__	:   Union[str, Any]												=	TopKBinarizer.apply(self.mask_scores  ,		_UpperCAmelCase						)
             elif self.pruning_method in ["threshold", "sigmoied_threshold"]:
                    UpperCAmelCase__	:   List[Any]												=	'''sigmoied''' in self.pruning_method
                    UpperCAmelCase__	:   Tuple												=	ThresholdBinarizer.apply(self.mask_scores  ,		_UpperCAmelCase  ,		_UpperCAmelCase						)
             elif self.pruning_method == "magnitude":
                    UpperCAmelCase__	:   Optional[int]												=	MagnitudeBinarizer.apply(self.weight  ,		_UpperCAmelCase						)
             elif self.pruning_method == "l0":
                    UpperCAmelCase__							,							UpperCAmelCase__							,							UpperCAmelCase__	:   int												=	-0.1, 1.1, 2 / 3
                    if self.training:
                           UpperCAmelCase__	:   Optional[int]												=	torch.zeros_like(self.mask_scores						).uniform_().clamp(0.00_01  ,		0.99_99						)
                           UpperCAmelCase__	:   Tuple												=	torch.sigmoid((u.log() - (1 - u).log() + self.mask_scores) / b						)
                    else:
                           UpperCAmelCase__	:   Any												=	torch.sigmoid(self.mask_scores						)
                    UpperCAmelCase__	:   List[Any]												=	s * (r - l) + l
                    UpperCAmelCase__	:   Optional[int]												=	s_bar.clamp(min=0.0  ,		max=1.0						)
             # Mask weights with computed mask
             UpperCAmelCase__	:   Union[str, Any]												=	mask * self.weight
             # Compute output (linear layer) with masked weights
             return nn.functional.linear(_UpperCAmelCase  ,		_UpperCAmelCase  ,		self.bias						)