Ultimately, my goal is to numerically differentiate the expression \'u\' (see code) with respect to t, with respect to X and three times with respect to X.
First ide
u
is sympy
expression. U
in python/numpy. The sp.sinh
etc are translated to np.sinh
etc.
U(Y)
evaluates this with the numpy
array, but t
is still a symbol. That produces a numpy
object dtype array, with some sort of mix of numbers and symbols. np.sinh(x)
is evaluated as [z.sinh() for z in x]
. Since most objects, including symbols don't have a sinh
method, this raises your error.
I'm not sure about this, but I suspect you need to lambdify
both X
and t
at once, and evaluate with (Y,T)
together, rather than in two steps.
(Later I may try to demonstrate this with a isympy
session.)