Newton-Raphson Method | Numerical Computing in Python

Поділитися
Вставка
  • Опубліковано 20 гру 2024

КОМЕНТАРІ • 30

  • @mechtutorcom
    @mechtutorcom  Рік тому

    If you are interested, here's a free NumPy mini-course link: rb.gy/pk99l ... I hope you'll find it useful.

  • @souadmassi7683
    @souadmassi7683 5 років тому +6

    It is a long time, welcome again on UA-cam. Please, make more videos on Matlab

  • @ascorbic_b
    @ascorbic_b Рік тому

    You are the best man in the world. I spent one week for doing this shit. I love so much. Thank you

  • @MathPhysicsFunwithGus
    @MathPhysicsFunwithGus 4 роки тому +5

    Amazing video thank you helped me so much in my computational class!

  • @nsm1785
    @nsm1785 12 днів тому

    What to do if I don’t know the initial guesses, i know i can use range , but what if the roots are far apart from each other?

  • @bidhayakgoswami2564
    @bidhayakgoswami2564 3 роки тому +2

    Once I wrote this function to find the zero of any continuous and differentiable function
    def newton(fun,y): #A function_name and an initial guess is provided as arguments of the function 'newton'
    n=len(y);epsilon=10**(-12);
    e=np.eye(n)*epsilon;
    fval=fun(y);i=1
    while (np.linalg.norm(fval))>1e-10 and i

  • @juliomurillo1850
    @juliomurillo1850 4 роки тому +3

    Dear mechtutor, I would like to apply the same code, but for a list of elements, It means my initial values are X0 = {1,2,3,4,5,6} and my functions give me a result for each of these initial values it means f = f(x0), same my derivative f'=f'(x0). So as you see at the end I will get a list of values. Do you think is possible?

    • @AJ-et3vf
      @AJ-et3vf 2 роки тому +1

      Yes, it is possible. You will have to modify your code such that if a list of values were given, the code would loop through the values given. You would also need to allocate for another list/array where you would store the roots that were found.
      Your use case is interesting, but most root-solver codes don't have a "vectorized" implementation as the one you're asking. They only take one input guess at a time. So if you want to find the root for a given initial values, just put the Newton solver function inside a loop that loops through your given initial values.

  • @AJ-et3vf
    @AJ-et3vf 2 роки тому

    Awesome video sir! Thank you!

  • @alvarocarrillo4410
    @alvarocarrillo4410 4 роки тому +2

    How can I do it but for the unreal roots?

    • @mechtutorcom
      @mechtutorcom  4 роки тому +6

      Because this method works only in the real domain, you cannot use it for complex roots. The alternative way is to use the function
      Scipy.optimize.fsolve()
      Thanks for your comment.

  • @googlegoogle1610
    @googlegoogle1610 2 роки тому

    the best explanation ever :)

  • @biswarajpalit
    @biswarajpalit 4 роки тому +2

    Zoom ur code...really appearing small

  • @fahadtufailsahib
    @fahadtufailsahib Рік тому

    How to solve an equation with logx

  • @amirahsalsabila7782
    @amirahsalsabila7782 3 роки тому

    Terimakasih bapak

  • @SS-zq5sc
    @SS-zq5sc 2 роки тому

    thank you very much that was so helpful and well explained.

  • @ccuuttww
    @ccuuttww 4 роки тому

    how do u add the bee sound every time u run the program

  • @mechtutorcom
    @mechtutorcom  Рік тому

    Hi friends. I have launched a new course. To learn about it, click here please: mechtutor.thinkific.com/courses/python-for-science-and-engineering

  • @amalabdallah568
    @amalabdallah568 4 роки тому +2

    That was really useful 🧡👍🏼

    • @dellpi3911
      @dellpi3911 3 роки тому

      ua-cam.com/video/kxftUHk7NDk/v-deo.html

  • @kaasbaas5906
    @kaasbaas5906 3 роки тому +1

    any laptopassignment 2 calculusers?

    • @TPLCompany
      @TPLCompany 3 роки тому

      did you just like your own comment?

    • @kaasbaas5906
      @kaasbaas5906 3 роки тому

      @@TPLCompany i did not, imagine having so little to do in life, till the point where you mock others for doing so

    • @TPLCompany
      @TPLCompany 3 роки тому

      @@kaasbaas5906 damn

  • @Dusadof
    @Dusadof 2 роки тому

    What if I have 7 nonlinear equations

  • @fairouzbadis7975
    @fairouzbadis7975 4 роки тому

    YOU SAVED ME

  • @thshm2938
    @thshm2938 Рік тому

    import numpy as np
    from scipy.misc import derivative
    def f(x):
    return 2*x**3-9.5*x+7.5
    x1 = 2
    x = np.linspace(0.2, 2, 500)
    m = derivative(f, x1, dx=0.1)
    for n in range(20):
    xn = x1 -( f(x1) / m)
    print(xn)
    x1 = xn

  • @ulisesalejandrogutierrezsa8334
    @ulisesalejandrogutierrezsa8334 4 роки тому

    ♥♥♥♥♥♥♥♥♥♥♥♥♥♥

  • @shardulpingale2431
    @shardulpingale2431 2 роки тому

    def newton_approximation(f,appr):
    x = sym.Symbol('x')
    fprime = sym.diff(f,x)
    f = sym.lambdify(x,f)
    fprime = sym.lambdify(x,fprime)
    steps = 0
    x = appr
    for i in range(0,100):

    new_x = x - (f(x) / fprime(x))
    steps+=1
    if round(x,8) == round(new_x, 8):
    break
    else: x = new_x

    return new_x, steps
    x = sym.Symbol('x')
    f = x**2 - 104
    print("Total steps taken in order to approximate the root {0} are {1}".format(*newton_approximation(f,3)))