Mathematica程序里这是什么意思?

来源:百度知道 编辑:UC知道 时间:2024/05/16 01:35:51
In[1]:=s1=NDSolve[{y′[x]= =x^2+y[x]^2,y[0]= =0},
y,{x,-2,2}]
Out[1]={{y→InterpolatingFunction[{{-2.,2.}},< >]}}
In[2]:= y=y / . s1[[1]]
Out[2]=InterpolatingFunction[{{-2.,2.}},< >]

其中:In[2]:= y=y / . s1[[1]]是什么意思?

:In[1]:=s1=NDSolve[{x′[t]= = y[t] -(x[t]^3/3 - x[t]),
y′[t]= = - x[t],x[0]= =0,y[0]= =1},
{x,y},{t,-15,15}]
Out[1]={{x→InterpolatingFunction[{{-15.,15.}},< >],
y→InterpolatingFunction[{{-15.,15.}},< >]}}
In[2]:= x=x / . s1[[1,1]]
y=y / . s1[[1,2]]
Out[2]=InterpolatingFunction[{{-15.,15.}},< >]
Out[3]=InterpolatingFunction[{{-15.,15.}},< >]

In[2]:= x=x / . s1[[1,1]]
y=y / . s1[[1,2]]是什么意思?
prairie1这位老大,有mathematica资料或者好的网站论坛吗?你补充一下我再加点分。
跪求中~~ 邮箱yin.yaping@163.com

/.在mathematica里表示取代(Replaceall),也就是表示赋值,赋予规则的意思。比如:
①赋值取代:
f = z^2 + 1; f /. z -> 2
得到:5
②规则取代:
如你所举例子,微分方程的数值解实际得到了函数y和变量x的对应规则s1。此处 y=y / . s1[[1]]就是说y(x)的对应规则(映射)变化为s1.
至于s1的下标,应该是对应规则数目标示。你的第一个例子只有一个函数,不要下标也可以。第二个有两个函数,所以表示出它在数组中的位置。