import numpy as np
import sympy as sym
from numpy import sin
from sympy import symbols, diff
func = lambda x: sin(x)
x = symbols('x')
print diff(func(x),x)
This works if I replace my function with a polynomial or if I put the trigger function directly in the diff statement. But in this format, I get AttributeError: sin.
Basically, I think python cannot recognize func as just a trigger function that knows how to integrate symbolically. I could just have a simplex import sin, and then everything will work, but then I was stuck with func referring to sin in the sympy namespace, and there are future things that I want to do with func that require them to be defined using sin in the numpy namespace,
Thoth source
share