def bisection_method(func,a,b,error_accept): """ This function solves for an unknown root of non-linear funktion given the function, the initial root boundaries, and an acceptable level of error. Parameters ---------- func : The user defined function, witch needs to be entered as a string. a : The inital lower root boundray. b : The inital upper root boundray. error_accept : The user's acceptable level of error Returns ------- f : The root boundraies and the error at the final iteration. """
def f(x): f=eval(func) return f
error=abs(b-a)
while error > error_accept: c=(b+a)/2
if f(a)*f(b)>=0: print("No root multiple roots present, therefore, the bisection method will not work!") quit()
You Sir just explained in 3 minutes stuff that my professor tried to explain for 30 minutes and nobody understood. Thank you!
Im glad you found the video helpful! Thanks for watching!
It is insane how well this video is made
Thank you very much, im glad you found the video helpful!
def bisection_method(func,a,b,error_accept):
"""
This function solves for an unknown root of non-linear funktion given the function, the initial root boundaries,
and an acceptable level of error.
Parameters
----------
func : The user defined function, witch needs to be entered as a string.
a : The inital lower root boundray.
b : The inital upper root boundray.
error_accept : The user's acceptable level of error
Returns
-------
f : The root boundraies and the error at the final iteration.
"""
def f(x):
f=eval(func)
return f
error=abs(b-a)
while error > error_accept:
c=(b+a)/2
if f(a)*f(b)>=0:
print("No root multiple roots present, therefore, the bisection method will not work!")
quit()
elif f(c)*f(a)
I will use this video as a reference to my project
Sir is it possible to create a user input for the equation that users want to give?
Nice video. I feel it would have been nice if it just printed the final root out
And also please can you provide the code
Outside the while loop use this statement : root = (a + b) / 2 and also include print(root) this will give u the final root also.
what if I need to use cos(x) and sin(x) in my function? does the eval work? Thanks for the video.
how to determine a and b programmaticaly
Very nice explanation!
I’m glad you found the video helpful Christian!
@@StudySessionYT hi
thank you for the video
nice work man
Which editer did u use it
Pycharm
AYe thanks !
💙Thank alot that is amazing, thank you for your time 💙
KT'den saygılarla
⁹