我试图运行一个SymPy集成,在这里我创建了自己的变量,积分是
import numpy as np
import seaborn
import math
import pandas as pd
import matplotlib as plt
import scipy.integrate as integrate
import scipy.special as special
from sympy import init_session
init_session()
%matplotlib inline
dP, dT = symbols('dP dT', real = True, positive = True)
dr = symbols('dr', real = True, positive = True)
T_9, T = symbols('T_9 T', real = True, positive = True)
rho, mu, m_u, k, P, gamma = symbols('rho mu m_u k P gamma', real = True, positive = True)
r, R_solar, R = symbols('r R_solar R', real = True, positive = True)
G, M_solar, M = symbols('G M_solar M', real = True, positive = True)
a, c, kappa = symbols('a c kappa', real = True, positive = True)
F = symbols('F', real = True, positive = True)
cc = (T / (rho * k * T / (mu * m_u)) * (1 - (1 / gamma)) * ((-rho * G * M / r**2)))
r_int = integrate(((cc), (0, r, R)))
我试图更改限制以指定我想要的内容,但是我仍然得到了相同的错误:ValueError: specify dummy variables for (T / (rho * k * T / (mu * m_u)) * (1 - (1 / gamma)) * ((-rho * G * M / r**2)))
。
发布于 2022-10-28 19:38:59
你写错了集成命令。对于一个定积分,它应该是这样的:integrate(expr, (symbol, lower, upper))
。假设r
是集成变量,您的示例如下:
r_int = integrate(cc, (r, 0, R))
https://stackoverflow.com/questions/74234274
复制相似问题