

'''simple docstring'''



from collections.abc import Callable
def 						__lowerCamelCase	(       __snake_case					:		Callable[[float], float],		__snake_case					:		float,		__snake_case					:		float	)	->							float:






						"""simple docstring"""





						A__					:       float     =a
						A__					:       float     =b
						if function(__snake_case	) == 0:  # one of the a or b is a root for the function
												return a
						elif function(__snake_case	) == 0:
												return b
						elif (
						    function(__snake_case	) * function(__snake_case	) > 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:
												A__					:       float     =start + (end - start) / 2.0
												while abs(start - mid	) > 10**-7:  # until precisely equals to 10^-7
																		if function(__snake_case	) == 0:
																								return mid
																		elif function(__snake_case	) * function(__snake_case	) < 0:
																								A__					:       Tuple     =mid
																		else:
																								A__					:       Any     =mid
																		A__					:       str     =start + (end - start) / 2.0
												return mid
def 						__lowerCamelCase	(       __snake_case					:		float	)	->							float:






						"""simple docstring"""





						return x**3 - 2 * x - 5


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

		import doctest

		doctest.testmod()




'''simple docstring'''



def 						__lowerCamelCase	(       __snake_case					:		int	)	->							bool:






						"""simple docstring"""





						if p < 2:
												raise ValueError("""p should not be less than 2!"""	)
						elif p == 2:
												return True

						A__					:       Any     =4
						A__					:       int     =(1 << p) - 1
						for _ in range(p - 2	):
												A__					:       Dict     =((s * s) - 2) % m
						return s == 0


if __name__ == "__main__":
		print(lucas_lehmer_test(7))
		print(lucas_lehmer_test(11))

