Guest User

Untitled

a guest
Feb 25th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. def xSquared(x):
  2. return x**2
  3.  
  4. def getDeriv(func, x):
  5. h = 0.0001
  6. return (func(x+h) - func(x)) / h
  7.  
  8. x = 3
  9. derivative = getDeriv(xSquared, x)
  10. actual = 2*x
  11.  
  12. derivative, actual = 6.0001, 6
Add Comment
Please, Sign In to add comment