如何求解形式幂级数中的微分方程? [英] How to solve a differential equation in formal power series?

查看:35
本文介绍了如何求解形式幂级数中的微分方程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想先得到几个由微分方程隐式定义的形式幂级数的系数.

<块引用>

示例.

import sympy as spsp.init_printing() # 数学如乳胶from IPython.display 导入显示z = sp.Symbol('z')F = sp.Function('F')(z)F_ = sp.Derivative(F, z)方程 = sp.Eq(F**2 + 1 - F_, 0)显示(方程)

solution = sp.dsolve(equation)显示(解决方案)

sp.series(sp.tan(z), n = 8)

<块引用>

问题.如何在不使用初等函数明确求解的情况下计算 ODE 的形式幂级数解?

旁注.一些微分方程(甚至是线性的)只有发散幂级数的解,例如一个方程 L = z^2 + z^2 L + z^4 L'.有趣的是,sympy 是否支持这样的方程以及通常的方程.

相关.

当前问题是一个更简单问题的续集.

<块引用>

问题 1.如果我们想要更多项,甚至说 n = 10,该函数会工作很长时间(通常,我希望在几秒钟内有 20 个系数).组合地,可以为线性 ODE 编写非常快速的递归.不知道是不是在sympy中实现了.

问题 2. 这种技术似乎不适用于原始问题中提到的 Ricatti 方程 L = z^2 + z^2 L + z^4 L'.

如果有人知道更好的解决方案,热烈欢迎他!

I would like to have first several coefficients of formal power series defined implicitly by a differential equation.

Example.

import sympy as sp
sp.init_printing() # math as latex
from IPython.display import display
z = sp.Symbol('z')
F = sp.Function('F')(z)
F_ = sp.Derivative(F, z)
equation = sp.Eq(F**2 + 1 - F_, 0)
display(equation)

solution = sp.dsolve(equation)
display(solution)

sp.series(sp.tan(z), n = 8)

Question. How to compute formal power series solution of ODE without explicitly solving it in terms of elementary functions?

Sidenote. Some differential equations (even linear) have solutions in divergent power series only, for example an equation L = z^2 + z^2 L + z^4 L'. It is interesting to know whether sympy supports such equations along with usual ones.

Related.

The current question is a sequel of a more easy question.

Sympy: how to solve algebraic equation in formal power series?

解决方案

UPDATE: an answer to a similar question has been posted here. I use this second answer instead of the one presented below. The solution using standard functions from sympy works very slowly.


This seems to be (partially) possible in sympy-1.1.1. Be sure to update to the corresponding version first. I refer to official documentation part on ordinary differential equations

http://docs.sympy.org/latest/modules/solvers/ode.html

We can use the method dsolve with additional hints asking to represent the solution as formal power series. This is only possible for certain types of equations. For the above equation, we ask for possible hint types.

>>> sp.classify_ode(equation)

('separable',
'1st_exact',
'1st_power_series',
'lie_group',
'separable_Integral',
'1st_exact_Integral')

Continuing the example in the question, we specify the hint '1st_power_series' and initial conditions F(0) = 0:

solution = sp.dsolve(equation, hint='1st_power_series', ics={F.subs(z,0):0})
display(solution)

Issue 1. If we want more terms, even say n = 10, the function works for a very long time (normally, I expect 20 coefficients within several seconds). Combinatorially, one can write a very fast recurrence for linear ODE. I don't know whether it is implemented in sympy.

Issue 2. This technique doesn't seem to apply to Ricatti equations like the one mentioned in the original question L = z^2 + z^2 L + z^4 L'.

If someone knows a better solution, (s)he is warmly welcome!

这篇关于如何求解形式幂级数中的微分方程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆