




from __future__ import annotations

from collections.abc import Callable


def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase    ,						lowerCAmelCase    ,						lowerCAmelCase = 100    ,						)->	float:
		SCREAMING_SNAKE_CASE_					      =							x_start
		SCREAMING_SNAKE_CASE_					      =							fnc(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_					      =							0.0
		for _ in range(lowerCAmelCase ):
				# Approximates small segments of curve as linear and solve
				# for trapezoidal area
				SCREAMING_SNAKE_CASE_					      =							(x_end - x_start) / steps + xa
				SCREAMING_SNAKE_CASE_					      =							fnc(lowerCAmelCase )
				area += abs(fxa + fxa ) * (xa - xa) / 2
				# Increment step
				SCREAMING_SNAKE_CASE_					      =							xa
				SCREAMING_SNAKE_CASE_					      =							fxa
		return area


if __name__ == "__main__":


						def 					_a							(					lowerCAmelCase )->	Optional[int]:
								return x**3 + x**2

						print('''f(x) = x^3 + x^2''')
						print('''The area between the curve, x = -5, x = 5 and the x axis is:''')
						SCREAMING_SNAKE_CASE:     Any									= 1_0
						while i <= 1_0_0_0_0_0:
												print(f"""with {i} steps: {trapezoidal_area(f, -5, 5, i)}""")
												i *= 1_0





def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase )->	List[str]:
		SCREAMING_SNAKE_CASE_					      =							[1]
		for i in range(2    ,						lowerCAmelCase ):
				factorials.append(factorials[-1] * i )
		assert 0 <= k < factorials[-1] * n, "k out of bounds"

		SCREAMING_SNAKE_CASE_					      =							[]
		SCREAMING_SNAKE_CASE_					      =							list(range(lowerCAmelCase ) )

		# Find permutation
		while factorials:
				SCREAMING_SNAKE_CASE_					      =							factorials.pop()
				SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							divmod(lowerCAmelCase    ,						lowerCAmelCase )
				permutation.append(elements[number] )
				elements.remove(elements[number] )
		permutation.append(elements[0] )

		return permutation


if __name__ == "__main__":
						import doctest

						doctest.testmod()