


from math import atan, cos, radians, sin, tan

from .haversine_distance import haversine_distance

_lowerCAmelCase						:   int		=   6_3_7_8_1_3_7.0
_lowerCAmelCase						:   Union[str, Any]		=   6_3_5_6_7_5_2.3_1_4_2_4_5
_lowerCAmelCase						:   int		=   6_3_7_8_1_3_7



def 						lowerCAmelCase		(		_lowerCAmelCase							:   float						,							_lowerCAmelCase							:   float						,							_lowerCAmelCase							:   float						,							_lowerCAmelCase							:   float	):




 """simple docstring"""







 UpperCAmelCase__							 =						(AXIS_A - AXIS_B) / AXIS_A
 # Parametric latitudes
 # https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
 UpperCAmelCase__							 =						atan((1 - flattening) * tan(radians(_lowerCAmelCase	)	)	)
 UpperCAmelCase__							 =						atan((1 - flattening) * tan(radians(_lowerCAmelCase	)	)	)

 # Compute central angle between two points
 # using haversine theta. sigma =  haversine_distance / equatorial radius
 UpperCAmelCase__							 =						haversine_distance(_lowerCAmelCase						,							_lowerCAmelCase						,							_lowerCAmelCase						,							_lowerCAmelCase	) / EQUATORIAL_RADIUS

 # Intermediate P and Q values
 UpperCAmelCase__							 =						(b_lata + b_lata) / 2
 UpperCAmelCase__							 =						(b_lata - b_lata) / 2

 # Intermediate X value
 # X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
 UpperCAmelCase__							 =						(sin(_lowerCAmelCase	) ** 2) * (cos(_lowerCAmelCase	) ** 2)
 UpperCAmelCase__							 =						cos(sigma / 2	) ** 2
 UpperCAmelCase__							 =						(sigma - sin(_lowerCAmelCase	)) * (x_numerator / x_demonimator)

 # Intermediate Y value
 # Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
 UpperCAmelCase__							 =						(cos(_lowerCAmelCase	) ** 2) * (sin(_lowerCAmelCase	) ** 2)
 UpperCAmelCase__							 =						sin(sigma / 2	) ** 2
 UpperCAmelCase__							 =						(sigma + sin(_lowerCAmelCase	)) * (y_numerator / y_denominator)

 return EQUATORIAL_RADIUS * (sigma - ((flattening / 2) * (x_value + y_value)))


if __name__ == "__main__":
  import doctest

  doctest.testmod()











import math



def 						lowerCAmelCase		(		_lowerCAmelCase							:   int	):




 """simple docstring"""







 UpperCAmelCase__							 =						math.loga(math.sqrt(4 * positive_integer + 1	) / 2 + 1 / 2	)

 return exponent == int(_lowerCAmelCase	)



def 						lowerCAmelCase		(		_lowerCAmelCase							:   float = 1 / 1_2345	):




 """simple docstring"""







 UpperCAmelCase__							 =						0
 UpperCAmelCase__							 =						0

 UpperCAmelCase__							 =						3
 while True:
  UpperCAmelCase__							 =						(integer**2 - 1) / 4
  # if candidate is an integer, then there is a partition for k
  if partition_candidate == int(_lowerCAmelCase	):
   UpperCAmelCase__							 =						int(_lowerCAmelCase	)
   total_partitions += 1
   if check_partition_perfect(_lowerCAmelCase	):
    perfect_partitions += 1
  if perfect_partitions > 0:
   if perfect_partitions / total_partitions < max_proportion:
    return int(_lowerCAmelCase	)
  integer += 1


if __name__ == "__main__":
  print(F'''{solution() = }''')





