本文整理汇总了Python中sympy.Eq.doit方法的典型用法代码示例。如果您正苦于以下问题:Python Eq.doit方法的具体用法?Python Eq.doit怎么用?Python Eq.doit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Eq
的用法示例。
在下文中一共展示了Eq.doit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Eq
# 需要导入模块: from sympy import Eq [as 别名]
# 或者: from sympy.Eq import doit [as 别名]
subs = {}
eqs = []
# rate of x
rate_expr = k_f*Y*(Z-x) - k_b*x
rate_eq = Eq(Derivative(x,t), rate_expr)
eqs.append(rate_eq)
integrand = 1/rate_expr
inte_eq_lhs = Integral(integrand.subs({x: chi}), (chi,0,x))
inte_eq_rhs = Integral(1, (tau,0,t))
inte_eq = Eq(inte_eq_lhs, inte_eq_rhs)
eqs.append(inte_eq)
expl_in_x_eq = inte_eq.doit().simplify()
eqs.append(expl_in_x_eq)
expl_in_t_eq = Eq(x, solve(expl_in_x_eq, x)[0])
eqs.append(expl_in_t_eq)
alt_expl_in_t = Z*k_f*Y/(k_f*Y+k_b)*(1-exp(-t*(k_f*Y+k_b)))
assert (expl_in_t_eq.rhs - alt_expl_in_t).simplify() == 0
alt_expl_in_t_eq = Eq(x, alt_expl_in_t)
eqs.append(alt_expl_in_t_eq)
def main():
# GENERATES WITHOUT ARGUMENTS: rev_unary_1.tex rev_unary_rate.tex rev_unary_k_b.c rev_unary_K_eq.c
from sympy.printing.latex import latex
示例2: Eq
# 需要导入模块: from sympy import Eq [as 别名]
# 或者: from sympy.Eq import doit [as 别名]
eqs = []
# rate of x
rate_expr = k_f * (Y - x) * (Z - x)
rate_eq = Eq(Derivative(x, t), rate_expr)
eqs.append(rate_eq)
integrand = k_f / rate_expr
inte_eq_lhs = Integral(integrand.subs({x: chi}), (chi, 0, x))
inte_eq_rhs = Integral(k_f, (tau, 0, t))
inte_eq = Eq(inte_eq_lhs, inte_eq_rhs)
eqs.append(inte_eq)
expl_in_x_eq = inte_eq.doit(manual=True).simplify()
eqs.append(expl_in_x_eq)
expl_in_t_eq = Eq(x, solve(expl_in_x_eq, x)[0])
alt_expl_in_t = Y * (1 - exp(k_f * t * (Z - Y))) / (Y / Z - exp(k_f * t * (Z - Y)))
assert (alt_expl_in_t - expl_in_t_eq.rhs).simplify() == 0
alt_expl_in_t_eq = Eq(x, alt_expl_in_t)
eqs.append(alt_expl_in_t_eq)
def main():
# GENERATES WITHOUT ARGUMENTS: irrev_binary_1.tex irrev_binary_2.tex irrev_binary_rate.tex irrev_binary_k_b.c irrev_binary_K_eq.c
from sympy.printing.latex import latex
open("irrev_binary_1.tex", "wt").write(as_align_env(eqs[:2]))