

"""simple docstring"""




from math import isclose, sqrt




def  _lowerCAmelCase		(		_UpperCamelCase ,				_UpperCamelCase ,				_UpperCamelCase						):






  """simple docstring"""



  _lowercase:			str       =     point_y / 4 / point_x
  _lowercase:			List[Any]       =     2 * normal_gradient / (1 + normal_gradient * normal_gradient)
  _lowercase:			Optional[int]       =     (1 - normal_gradient * normal_gradient) / (
      1 + normal_gradient * normal_gradient
  )
  _lowercase:			Union[str, Any]       =     (sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

  # to find the next point, solve the simultaeneous equations:
  # y^2 + 4x^2 = 100
  # y - b = m * (x - a)
  # ==> A x^2 + B x + C = 0
  _lowercase:			Optional[int]       =     outgoing_gradient**2 + 4
  _lowercase:			Optional[Any]       =     2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
  _lowercase:			Dict       =     (point_y - outgoing_gradient * point_x) ** 2 - 100

  _lowercase:			Union[str, Any]       =     (
      -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term						)
  ) / (2 * quadratic_term)
  _lowercase:			str       =     (
      -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term						)
  ) / (2 * quadratic_term)

  # two solutions, one of which is our input point
  _lowercase:			int       =     x_minus if isclose(__UpperCamelCase ,				__UpperCamelCase						) else x_plus
  _lowercase:			Tuple       =     point_y + outgoing_gradient * (next_x - point_x)

  return next_x, next_y, outgoing_gradient




def  _lowerCAmelCase		(		_UpperCamelCase = 1.4 ,				_UpperCamelCase = -9.6						):






  """simple docstring"""



  _lowercase:			List[str]       =     0
  _lowercase:			int       =     first_x_coord
  _lowercase:			List[Any]       =     first_y_coord
  _lowercase:			int       =     (10.1 - point_y) / (0.0 - point_x)

  while not (-0.01 <= point_x <= 0.01 and point_y > 0):
    _lowercase ,				_lowercase ,				_lowercase:			Union[str, Any]       =     next_point(__UpperCamelCase ,				__UpperCamelCase ,				__UpperCamelCase						)
    num_reflections += 1

  return num_reflections


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


"""simple docstring"""




from __future__ import annotations

import numpy as np




def  _lowerCAmelCase		(		_UpperCamelCase						):






  """simple docstring"""



  _lowercase ,				_lowercase:			List[str]       =     np.shape(_UpperCamelCase						)
  if rows != columns:
    _lowercase:			int       =     (
        '''\'table\' has to be of square shaped array but got a '''
        f'''{rows}x{columns} array:\n{table}'''
    )
    raise ValueError(_UpperCamelCase						)

  _lowercase:			Tuple       =     np.zeros((rows, columns)						)
  _lowercase:			Tuple       =     np.zeros((rows, columns)						)
  for i in range(_UpperCamelCase						):
    for j in range(_UpperCamelCase						):
      _lowercase:			List[Any]       =     sum(lower[i][k] * upper[k][j] for k in range(_UpperCamelCase						)						)
      if upper[j][j] == 0:
        raise ArithmeticError('''No LU decomposition exists'''						)
      _lowercase:			Any       =     (table[i][j] - total) / upper[j][j]
    _lowercase:			Any       =     1
    for j in range(_UpperCamelCase ,				_UpperCamelCase						):
      _lowercase:			Optional[int]       =     sum(lower[i][k] * upper[k][j] for k in range(_UpperCamelCase						)						)
      _lowercase:			List[str]       =     table[i][j] - total
  return lower, upper


if __name__ == "__main__":
  import doctest

  doctest.testmod()
