Here is the code
import scipy.optimize
var('x')
f(x) = x^2 - 4*sin(x)
fp(x) = diff(f(x),x)
scipy.optimize.newton(f,1.5,fp)
and get type error
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''