

"""simple docstring"""






lowerCamelCase__				:  Union[str, Any]													=  10_00
def       UpperCamelCase					(			_lowerCAmelCase     :						float )				->			float:
	return x * x
def       UpperCamelCase					(			_lowerCAmelCase     :						Optional[int],  _lowerCAmelCase     :						float,  _lowerCAmelCase     :						float,  _lowerCAmelCase     :						int = 4 )				->			float:
	assert callable(
	    _lowerCAmelCase ), f'''the function(object) passed should be callable your input : {function}'''
	assert isinstance(_lowerCAmelCase,  (float, int) ), f'''a should be float or integer your input : {a}'''
	assert isinstance(function(_lowerCAmelCase ),  (float, int) ), (
	    "the function should return integer or float return type of your function, "
	    f'''{type(_lowerCAmelCase )}'''
	)
	assert isinstance(_lowerCAmelCase,  (float, int) ), f'''b should be float or integer your input : {b}'''
	assert (
	    isinstance(_lowerCAmelCase,  _lowerCAmelCase ) and precision > 0
	), f'''precision should be positive integer your input : {precision}'''

	# just applying the formula of simpson for approximate integration written in
	# mentioned article in first comment of this file and above this function

	_UpperCAmelCase    :							Any									=					(b - a) / N_STEPS
	_UpperCAmelCase    :							List[Any]									=					function(_lowerCAmelCase ) + function(_lowerCAmelCase )

	for i in range(1,  _lowerCAmelCase ):
		_UpperCAmelCase    :							int									=					a + h * i
		result += function(_lowerCAmelCase ) * (4 if i % 2 else 2)

	result *= h / 3
	return round(_lowerCAmelCase,  _lowerCAmelCase )


if __name__ == "__main__":
						import doctest

						doctest.testmod()








"""simple docstring"""






def       UpperCamelCase					(			_lowerCAmelCase     :						int )				->			str:
	_UpperCAmelCase    :							Any									=					1
	_UpperCAmelCase    :							List[str]									=					0
	_UpperCAmelCase    :							str									=					1
	_UpperCAmelCase    :							Union[str, Any]									=					1
	_UpperCAmelCase    :							int									=					3
	_UpperCAmelCase    :							int									=					3
	_UpperCAmelCase    :							List[str]									=					limit
	_UpperCAmelCase    :							Optional[Any]									=					0

	_UpperCAmelCase    :							Any									=					""""""
	while counter != decimal + 1:
		if 4 * q + r - t < n * t:
			result += str(_lowerCAmelCase )
			if counter == 0:
				result += "."

			if decimal == counter:
				break

			counter += 1
			_UpperCAmelCase    :							str									=					10 * (r - n * t)
			_UpperCAmelCase    :							List[Any]									=					((10 * (3 * q + r)) // t) - 10 * n
			q *= 10
			_UpperCAmelCase    :							int									=					nr
		else:
			_UpperCAmelCase    :							Any									=					(2 * q + r) * l
			_UpperCAmelCase    :							str									=					(q * (7 * k) + 2 + (r * l)) // (t * l)
			q *= k
			t *= l
			l += 2
			k += 1
			_UpperCAmelCase    :							List[Any]									=					nn
			_UpperCAmelCase    :							Optional[int]									=					nr
	return result
def       UpperCamelCase					(			)				->			None:
	print(f'''{calculate_pi(50 ) = }''' )
	import doctest

	doctest.testmod()


if __name__ == "__main__":
						main()





