微分方程数值解的介绍
| NDSolve[eqns,y,{x,xmin,xmax}] | 求微分方程中函数 y 的数值解,其中自变量 x 的变化范围从 |
| NDSolve[eqns,{y1,y2,...},{x,xmin,xmax}] | |
| 求关于 | |
| In[1]:= |
| Out[1]= |
| In[2]:= |
| Out[2]= |
像
这样的代数方程,其
的解是一个数. 而微分方程的解是一个函数. 例如,对方程
,用户想要得到的是函数
在自变量
的某区间上的近似值.
Mathematica 把函数的数值近似值表示为 InterpolatingFunction 对象. 当给自变量
一个特定的值时,该对象返回
在该点处的近似值. InterpolatingFunction 存储着
的一个值表,然后对该值进行插值,求出在特定
处
的近似值.
| y[x]/.solution | 对函数 y 使用规则列表来得到 |
| InterpolatingFunction[data][x] | 计算插值函数在点 x 处的值 |
| Plot[Evaluate[y[x]/.solution],{x,xmin,xmax}] | |
| 画微分方程的解曲线 | |
使用 NDSolve 给出的结果.
| In[3]:= |
| Out[3]= |
| In[4]:= |
| Out[4]= |
| In[5]:= |
| Out[5]= | ![]() |
| NDSolve[eqn,u,{x,xmin,xmax},{t,tmin,tmax},...] | |
| 求解偏微分方程 | |

