如何对包含 python 中 r 的一阶导数的 r 函数求积分?

How to integrate a function of r that contains the first derivative of r in python?

我必须对包含该变量的导数的变量求函数积分。

我正在使用 jupyter,这是我的代码:

from sympy import *
m, p, g, a, t=symbols('m, p, g, a, t')
r=Function('r')
integrate((r*(p**2/(m**2*r**4)-2*a*g)-r(t).diff(t)**2*4*a**2*r)/(1+4*a**2*r**2),r)

r(t).diff(t) 是我尝试编写 \dot{r}.

的笨拙方式

我收到以下错误:

TypeError: unsupported operand type(s) for ** or pow(): 'UndefinedFunction' and 'int'

如有任何帮助,我们将不胜感激。

您需要 r(t) 而不是 r。尝试以下操作:integrate((r(t)*(p**2/(m**2*r(t)**4)-2*a*g)-r(t).diff(t)**2*4*a**2*r(t))/(1+4*a**2*r(t)**2), r(t))