"""simple docstring"""





def        a_  (   _lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				):





       '''simple docstring'''

       lowercase__    :	Dict     					=			[redshift, radiation_density, matter_density, dark_energy]
       if any(p < 0 for p in parameters  ):
              raise ValueError('All input parameters must be positive'  )

       if any(p > 1 for p in parameters[1:4]  ):
              raise ValueError('Relative densities cannot be greater than one'  )
       else:
              lowercase__    :	Union[str, Any]     					=			1 - (matter_density + radiation_density + dark_energy)

              lowercase__    :	List[Any]     					=			(
                  radiation_density * (redshift + 1) ** 4
                  + matter_density * (redshift + 1) ** 3
                  + curvature * (redshift + 1) ** 2
                  + dark_energy
              )

              lowercase__    :	Optional[int]     					=			hubble_constant * e_a ** (1 / 2)
              return hubble


if __name__ == "__main__":
       import doctest

       # run doctest
       doctest.testmod()

       # demo LCDM approximation
       _UpperCamelCase     :		Union[str, Any]											=					0.3

       print(
           hubble_parameter(
               hubble_constant=6_8.3,
               radiation_density=1e-4,
               matter_density=matter_density,
               dark_energy=1 - matter_density,
               redshift=0,
           )
       )


"""simple docstring"""





from collections.abc import Sequence





def        a_  (   _lowerCAmelCase						:				Sequence[float]     ,				_lowerCAmelCase						:				float  ):





       '''simple docstring'''

       return sum(c * (x**i) for i, c in enumerate(_lowerCAmelCase  )  )





def        a_  (   _lowerCAmelCase						:				Sequence[float]     ,				_lowerCAmelCase						:				float  ):





       '''simple docstring'''

       lowercase__    :	int     					=			0.0
       for coeff in reversed(_lowerCAmelCase  ):
              lowercase__    :	List[Any]     					=			result * x + coeff
       return result


if __name__ == "__main__":
       _UpperCamelCase     :		int											=					(0.0, 0.0, 5.0, 9.3, 7.0)
       _UpperCamelCase     :		Dict											=					1_0.0
       print(evaluate_poly(poly, x))
       print(horner(poly, x))

