Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

How to make a function that finds the derivative using python? Is there a built-in one?

Functions
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

Just create a recursive function that multiplies the factor by the exponential and then decrements the exponent with each call.
Binding variables as if you want to find the area of a circle use this >>>> pi = 3.14159 >>>> radius = 11.2 >>>> area = pi( radius ** 2) >>>> area = 394.081
Huh? Did I miss something?

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

@chris2332: That doesn't work for other functions... only polynomials.
maybe!!
Something like that? def derivative(f): ....""" ....Computes the numerical derivative of a function. ....""" ....def df(x, h=0.1e-5): ........return ( f(x+h/2) - f(x-h/2) )/h ....return df
Uh... no
Then what derivative do you want?
The mathematical definition of the derivative of a function f(x) at point x is to take a limit as "h" goes to zero of the following expression: ( f(x+h) - f(x) ) / h An example is given below: the red curve is the function f(x) and the green curve is the tangent line at x (with same slope as the derivative). The blue curve is a line going through x whose slope equals that of the above formula with a non-zero value of h. A better way of numerically computing the derivative for the same value of "h" is by taking a symmetrical interval around x as follows: ( f(x + h/2) - f(x - h/2) ) / h This is illustrated in the next picture. As you can see, the two straight lines have much more similar slopes - hence, the value computed for the derivative is going to be more accurate. The corresponding python code is as follows: def derivative(f): ....""" ....Computes the numerical derivative of a function. ....""" ....def df(x, h=0.1e-5): ........return ( f(x+h/2) - f(x-h/2) )/h ....return df And we use it as follows: # sample function def g(x): return x*x*x # first derivative dg = derivative(g) # second derivative d2g = derivative(dg) # == derivative(derivative(g)) # printing the value computed at a given point: print dg(3) print dg(3, 0.001) print dg(3, 1e-10) # smaller h is not always more precise source : http://aroberge.blogspot.in/2005/04/computing-derivatives-using-python.html
Exactly... that's where I got the snippet from!
@ParthKohli where u r??
from sympy import init_printing, symbols, ln, diff init_printing() x,y = symbols('x y') f = x**2 / y + 2 * x - ln(y) diff(f,x) -> 2*x/y +2
I am assuming u do not want to reinvent the wheel, so just use sympy....
The next Pset in 6.00x has one problem in which to find the derivative of polynomials written as lists. I would show you the program I wrote but I don't want to give out the answer before the due date.
Heh, I'm not following that course.
then I will pm my code to you, but don't give it to anyone taking the course
Yup! I discovered this Python group so thought I'd ask...
numPy/sciPy are good too....

Not the answer you are looking for?

Search for more explanations.

Ask your own question