User Profile

Collapse

Profile Sidebar

Collapse
Viktor Sundelin
Viktor Sundelin
Last Activity: Sep 27 '10, 10:29 AM
Joined: Sep 25 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Viktor Sundelin
    replied to derivative and newton raphson
    Need help with derivative + solve

    Hello!
    (Newton-Raphson Method)
    Can anyone describe how this code work?
    What is depth, and how is solve working?
    The function derivative only give us the derivative of a function:
    for example:
    Code:
    >>> derivative(math.sin, math.pi, 0.0001)
    -0.9999999983354435
    But how is solve work?
    solve use derivative function....
    See more | Go to post

    Leave a comment:


  • Viktor Sundelin
    started a topic derivative of Newton-raphson

    derivative of Newton-raphson

    Hello!
    I can't get this code to work, what is wrong?


    If I type:
    Code:
    >>>derivative(math.sin, math.pi, 0.0001)
    Shouldn't I get a value in return?
    This is the error massage:

    TypeError: 'float' object is not callable

    This is the function definition: ->
    Code:
    def derivative (f,x,h):
        import math
        return float(1/(2*h)) * (f(x+h) - f(x-h))
    See more | Go to post
    Last edited by bvdet; Sep 25 '10, 04:31 PM. Reason: Fix code tags, indentation
No activity results to display
Show More
Working...