





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_keras_nlp_available,
    is_tensorflow_text_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowerCAmelCase_												=       {
    '''configuration_gpt2''': ['''GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPT2Config''', '''GPT2OnnxConfig'''],
    '''tokenization_gpt2''': ['''GPT2Tokenizer'''],
}

try:
			if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			lowerCAmelCase_												=       ['''GPT2TokenizerFast''']

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			lowerCAmelCase_												=       [
			    '''GPT2_PRETRAINED_MODEL_ARCHIVE_LIST''',
			    '''GPT2DoubleHeadsModel''',
			    '''GPT2ForQuestionAnswering''',
			    '''GPT2ForSequenceClassification''',
			    '''GPT2ForTokenClassification''',
			    '''GPT2LMHeadModel''',
			    '''GPT2Model''',
			    '''GPT2PreTrainedModel''',
			    '''load_tf_weights_in_gpt2''',
			]

try:
			if not is_tf_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			lowerCAmelCase_												=       [
			    '''TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST''',
			    '''TFGPT2DoubleHeadsModel''',
			    '''TFGPT2ForSequenceClassification''',
			    '''TFGPT2LMHeadModel''',
			    '''TFGPT2MainLayer''',
			    '''TFGPT2Model''',
			    '''TFGPT2PreTrainedModel''',
			]

try:
			if not is_keras_nlp_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			lowerCAmelCase_												=       ['''TFGPT2Tokenizer''']

try:
			if not is_flax_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			lowerCAmelCase_												=       ['''FlaxGPT2LMHeadModel''', '''FlaxGPT2Model''', '''FlaxGPT2PreTrainedModel''']

if TYPE_CHECKING:
			from .configuration_gpta import GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTaConfig, GPTaOnnxConfig
			from .tokenization_gpta import GPTaTokenizer

			try:
						if not is_tokenizers_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_gpta_fast import GPTaTokenizerFast

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_gpta import (
						    GPT2_PRETRAINED_MODEL_ARCHIVE_LIST,
						    GPTaDoubleHeadsModel,
						    GPTaForQuestionAnswering,
						    GPTaForSequenceClassification,
						    GPTaForTokenClassification,
						    GPTaLMHeadModel,
						    GPTaModel,
						    GPTaPreTrainedModel,
						    load_tf_weights_in_gpta,
						)

			try:
						if not is_tf_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_tf_gpta import (
						    TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST,
						    TFGPTaDoubleHeadsModel,
						    TFGPTaForSequenceClassification,
						    TFGPTaLMHeadModel,
						    TFGPTaMainLayer,
						    TFGPTaModel,
						    TFGPTaPreTrainedModel,
						)

			try:
						if not is_keras_nlp_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_gpta_tf import TFGPTaTokenizer

			try:
						if not is_flax_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_flax_gpta import FlaxGPTaLMHeadModel, FlaxGPTaModel, FlaxGPTaPreTrainedModel

else:
			import sys

			lowerCAmelCase_												=       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)







from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
lowerCAmelCase_												=       9.80_665






def   lowerCamelCase_		(       _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   lowerCamelCase_		(       _UpperCamelCase				,       _UpperCamelCase				)	->		float:






				"""simple docstring"""


				check_args(_UpperCamelCase				,       _UpperCamelCase				)
				snake_case_		:					List[str]			    =						angle_to_radians(2 * angle				)
				return round(init_velocity**2 * sin(_UpperCamelCase				) / g				,       2				)






def   lowerCamelCase_		(       _UpperCamelCase				,       _UpperCamelCase				)	->		float:






				"""simple docstring"""


				check_args(_UpperCamelCase				,       _UpperCamelCase				)
				snake_case_		:					Tuple			    =						angle_to_radians(_UpperCamelCase				)
				return round(init_velocity**2 * sin(_UpperCamelCase				) ** 2 / (2 * g)				,       2				)






def   lowerCamelCase_		(       _UpperCamelCase				,       _UpperCamelCase				)	->		float:






				"""simple docstring"""


				check_args(_UpperCamelCase				,       _UpperCamelCase				)
				snake_case_		:					Optional[Any]			    =						angle_to_radians(_UpperCamelCase				)
				return round(2 * init_velocity * sin(_UpperCamelCase				) / g				,       2				)






def   lowerCamelCase_		(       )	->		None:






				"""simple docstring"""


				snake_case_    ,							snake_case_		:					Dict			    =						25, 20
				assert horizontal_distance(_UpperCamelCase				,       _UpperCamelCase				) == 40.97
				assert max_height(_UpperCamelCase				,       _UpperCamelCase				) == 3.73
				assert total_time(_UpperCamelCase				,       _UpperCamelCase				) == 1.74


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]''')
