



"""simple docstring"""






from __future__ import annotations






def 			snake_case_    ( A_   :						float,							A_   :						float,							A_   :						float		):


       '''simple docstring'''





       if days_between_payments <= 0:
              raise ValueError('''days_between_payments must be > 0'''		)
       if daily_interest_rate < 0:
              raise ValueError('''daily_interest_rate must be >= 0'''		)
       if principal <= 0:
              raise ValueError('''principal must be > 0'''		)
       return principal * daily_interest_rate * days_between_payments






def 			snake_case_    ( A_   :						float,							A_   :						float,							A_   :						float,							):


       '''simple docstring'''





       if number_of_compounding_periods <= 0:
              raise ValueError('''number_of_compounding_periods must be > 0'''		)
       if nominal_annual_interest_rate_percentage < 0:
              raise ValueError('''nominal_annual_interest_rate_percentage must be >= 0'''		)
       if principal <= 0:
              raise ValueError('''principal must be > 0'''		)

       return principal * (
           (1 + nominal_annual_interest_rate_percentage) ** number_of_compounding_periods
           - 1
       )






def 			snake_case_    ( A_   :						float,							A_   :						float,							A_   :						float,							):


       '''simple docstring'''





       if number_of_years <= 0:
              raise ValueError('''number_of_years must be > 0'''		)
       if nominal_annual_percentage_rate < 0:
              raise ValueError('''nominal_annual_percentage_rate must be >= 0'''		)
       if principal <= 0:
              raise ValueError('''principal must be > 0'''		)

       return compound_interest(
           __lowerCAmelCase,							nominal_annual_percentage_rate / 3_65,							number_of_years * 3_65		)


if __name__ == "__main__":
   import doctest

   doctest.testmod()




from collections.abc import Callable






def   lowerCamelCase__							(							__lowerCAmelCase    :    Callable[[float], float]       ,				__lowerCAmelCase    :    float       ,				__lowerCAmelCase    :    float							):




			"""simple docstring"""


			lowerCAmelCase_         =      a
			lowerCAmelCase_         =      b
			if function(__lowerCAmelCase							) == 0:  # one of the a or b is a root for the function
						return a
			elif function(__lowerCAmelCase							) == 0:
						return b
			elif (
			    function(__lowerCAmelCase							) * function(__lowerCAmelCase							) > 0
			):  # if none of these are root and they are both positive or negative,
						# then this algorithm can't find the root
						raise ValueError("could not find root in given interval."							)
			else:
						lowerCAmelCase_         =      start + (end - start) / 2.0
						while abs(start - mid							) > 10**-7:  # until precisely equals to 10^-7
									if function(__lowerCAmelCase							) == 0:
												return mid
									elif function(__lowerCAmelCase							) * function(__lowerCAmelCase							) < 0:
												lowerCAmelCase_         =      mid
									else:
												lowerCAmelCase_         =      mid
									lowerCAmelCase_         =      start + (end - start) / 2.0
						return mid






def   lowerCamelCase__							(							__lowerCAmelCase    :    float							):




			"""simple docstring"""


			return x**3 - 2 * x - 5


if __name__ == "__main__":
			print(bisection(f, 1, 10_00))

			import doctest

			doctest.testmod()



