首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在Mathematica中解决此NDSolve问题

如何在Mathematica中解决此NDSolve问题
EN

Stack Overflow用户
提问于 2019-05-07 21:31:38
回答 1查看 790关注 0票数 0

我在Mathematica中用NDSolve解决常微分方程问题时发现了一个令人困惑的问题,代码如下:我尝试了'Clear[Derivative]'并重启内核,但这些方法都不起作用。代码:

代码语言:javascript
运行
复制
   Clear[Derivative];
    ClearSystemCache;
    r = 0.3; a = 3; delta = 0.45; M0 = 0.975; T = 20;
    u[t] = 0.5*l[t]*delta*M[t];
    eql1 = M'[t] == r*M[t] Log[1/M[t]] - u[t]*delta*M[t];
    eql2 = l'[t] == -2 *a *M[t] - l[t]* r *Log[1/M[t]] + l[t]*r - 
        l[t]*u[t]*delta;
    condition = {M[0] == M0, l[T] == 0};
    sol = NDSolve[Flatten@{{eql1, eql2}, condition}, {M, l}, {t, 0, 20}]
The result is as follows:
    Power::infy: Infinite expression 1/0. encountered.
    Infinity::indet: Indeterminate expression 0. \[Infinity] encountered.
    Power::infy: Infinite expression 1/0. encountered.
    Infinity::indet: Indeterminate expression 0. \[Infinity] encountered.
    Power::infy: Infinite expression 1/0. encountered.
    General::stop: Further output of Power::infy will be suppressed during this calculation.
    Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.
    General::stop: Further output of Infinity::indet will be suppressed during this calculation.
    NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.

enter image description here

我不明白为什么会有"non-numerical value for a derivative at t == 0",t==0不应该有非数值,t<=20的时候整个Mt应该是>0的,我花了很多时间在这个问题上,还是找不到答案,请帮帮我。诚挚的问候!

EN

回答 1

Stack Overflow用户

发布于 2019-05-18 11:53:52

这些代码不能工作的原因是,mathematica不能解决具有奇异点和有界条件的常微分方程。我使用python编写Ronge-Kutta方法来解决这个问题,并且它是有效的。人生苦短,我用的是python :>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56023820

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档