Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def derivative(f, x, h=0.0001):
- return (f(x + h) - f(x)) / h
- def square(x):
- return x**2
- print("Pochodna sin(x) w punkcie 1:", derivative(math.sin, 1))
- print("Pochodna sin(x) w punkcie 0:", derivative(math.sin, 0))
- print("Pochodna x^2 w punkcie 1 z przyrostem 0.00001:", derivative(square, 1, h=0.00001))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement