Hello,
Is it possible to lambdify the following:
# test code
mu, m_t, g = sp.symbols('mu, m_t, g')
class h_Kepler_two_body_polar(sp.Function):
nargs = (1, 2, 3, (4, 5, 6)) # *Is this correct? *
@classmethod
def eval(cls, r, p_r, p_phi, *args):
mu = args[0]
m_t = args[1]
g = args[2]
h = p_r**2/(2*mu) + p_phi**2/(2*mu*r**2) - g*mu*m_t/r
return h
My current attempt to lambdify
H_Ktb_polar_lf = sp.lambdify(
[r, p_r, p_phi, (mu, m_t, g)],
h_Kepler_two_body_polar(r, p_r, p_phi, (mu, m_t, g)), 'numpy')
returns the error message
TypeError: h_Kepler_two_body_polar takes at least 1 argument (4 given)
The reason for using *args is that later in the code I use fsolve from
SciPy with
func: callable f(x, *args) *and* fprime: callable f_prime(x, *args)
Any insight would be appreciated.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/98a6147c-a081-4432-8168-d0d6b5139247n%40googlegroups.com.