- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
出现问题是因为我想使用一个 PDE 的解作为初始条件来求解另一个。因为在 NDSolve 中,解是由 InterpolatingFunction 给出的,所以我必须在第二个 PDE 中使用 InterpolatingFunction。这可能吗?为什么我的电脑需要永远运行它?我的代码:
(*********************Parameters********************)
\[Gamma] = 10^(-5);
T = 500;
tm = -250;
\[Sigma] = 100;
L = 1;
L0 = -(L/2);
L1 = L0 + L;
c = 29.979;
\[Omega] = 1.32949/10^8;
\[Eta] = 1539.1;
\[Mu] = 6.27;
\[Beta] = 0.1334;
k = 40895.3;
(*********************1st PDE********************)
solS = NDSolve[{D[sS[z, t], t] == (-(\[Gamma] + I*\[Beta]*z))*sS[z, t]-I*\[Omega]*aS[z, t],
D[aS[z, t], z] + (1/c)*D[aS[z, t], t] == (-I)*\[Eta]*k*sS[z, t], sS[z, -T] == 0,
aS[z, -T] == E^(-((-T - tm)^2/(2*\[Sigma]^2))),
aS[L0, t] == E^(-((t - tm)^2/(2*\[Sigma]^2)))}, {sS, aS}, {z, L0, L1}, {t, -T, 0},
MaxSteps -> Infinity]
(*************take the result and plot**************)
iniR = solS[[1]][[1]][[2]]
Plot3D[Re[iniR[z, t]], {z, L0, L1}, {t, -T, 0}, PlotRange -> All]
(***********2nd PDE, with the 1st result as ini. con.***********)
solR = NDSolve[{D[sR[z, t], t] == (-(\[Gamma] - I*\[Beta]*z))*sR[z, t] - I*\[Omega]*aR[z, t],
D[aR[z, t], z] + (1/c)*D[aR[z, t], t] == (-I)*\[Eta]*k*sR[z, t],
sR[z, 0] == iniR[z, 0], aR[z, 0] == 0, aR[L0, t] == 0}, {sR, aR}, {z, L0, L1},
{t, 0, T}, MaxSteps -> Infinity]
最佳答案
首先:是的,您可以使用插值函数。这没有错。对于 Mathematica,InterpolatingFunction
仅具有一个插值多项式,应用于点集以产生中间点。事实上,生成的 InterpolatingFunction
是您可以使用的最准确的表示。
您的计算“永远”进行的原因是因为您将 MaxSteps
设置为无穷大。
这不是使用插值函数的问题。您正在进行的模拟对数值敏感,这是一个更大的问题。通过指定 MaxSteps->Infinity
,您告诉 Mathematica 花费尽可能多的时间来生成解决方案。
在这样做的过程中,它可能会将步长减小到非常小的程度,比如 10^-6,只是为了获得数值稳定的结果。这样做只是因为 MaxSteps->Infinity
设置。如果您删除它,它实际上可以产生一个解决方案,但它会警告您该解决方案很差。
您甚至会收到来自 Mathematica 的错误,提示解决方案会很糟糕:
NDSolve::eerr: Warning: Scaled local spatial error estimate of 559.4348244417077
at t = 3.808844111947534
in the direction of independent variable z is much greater than prescribed error tolerance. Grid spacing with 25 points may be too large to achieve the desired accuracy or precision. A singularity may have formed or you may want to specify a smaller grid spacing using the MaxStepSize or MinPoints method options. >>
关于wolfram-mathematica - 数学; ND求解;我可以使用 InterpolatingFunction 作为初始条件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7935351/
我记得 WRI 的某个人在 official newsgroup 中说出于兼容性目的,Mathematica 7 仍然有一个来自 Mathematica 5 的老式 Mathematica 帮助浏览器
除非巫师先生在度假,否则很难击败这种似乎具有无所不在和无所不知的现象。我们如何使用 Mathematica 和 StackOverflow API 超越他? 最佳答案 这是 Sjoerd 解决方案的一
您好,我无法理解以下函数的输出。 ListPointPlot3D[Table[Sin[x^2 + y], {x, 0, 3, 0.15}, {y, 0, 3
我在图形中显示了一组点: alt text http://img69.imageshack.us/img69/874/plc1k1lrqynuyshgrdegvfy.jpg 我想知道是否有任何命令可以
让 S是具有唯一元素的向量,并且 s它的一个子集,也有独特的元素;例如,S={1,2,3,4,5,6}和 s={1,3,4,6} .现在给出另一个向量 c={7,8,9,7} ,如何创建矢量 C=[7
我想知道如果给定多个替换规则,mma 如何确定在发生碰撞时首先应用哪个规则。一个例子是: x^3 + x^2*s + x^3*s^2 + s x /. {x -> 0, x^_?OddQ -> 2}
在mathematica 中(我使用的是 mma 5.0(猜猜很老)),如果我将以下内容作为一行输入: Needs["Graphics`Master`"]; Animate[Plot[Sin[n x]
如果我有一个字母表,假设 sigma = {1,2,3,4,a,b,c,d,e,f,g} 并且想要生成所有长度为 n 的单词,有没有办法做到这一点? 我可以做 Flatten[Outer[Functi
生成参数列表的素数列表的最简单函数是什么?想出这样的函数并不难,比如: foo[n_] := Block[{A = {}, p = 2}, While[p All] 关于wol
在此示例中,将函数定义为“functionB”时,这是一个奇怪的结果。有人可以解释吗?我想绘制functionB[x]和functionB[Sqrt[x]],它们必须不同,但是此代码显示functio
如何在 Mathematica 中对列表进行数值微分而不先将其拟合为数学表达式(即使用 FindFit )? 具体来说,我想在列表中找到最大斜率的点。 我已经考虑使用 Differences并找到最大
我正在寻找 Mathematica 中原子对象的完整列表(其中 AtomQ 产生 True)。 我知道 Symbol String Integer Real Rational Complex Spar
最近发现了一些old post在 MathGroup 上使用未记录的命令行选项 -batchinput和 -batchoutput显示: If test.mma contains the follo
Mathematica 似乎缺少此功能,或者无论如何我都找不到它。 Series function 可以对多个变量进行连续扩展,但它似乎无法进行完整的多元扩展。 有谁知道如何做到这一点? 谢谢 最佳答
我有兴趣运行相同的函数,该函数以并行方式在多核上使用不同的参数值进行一些蒙特卡罗评估。我还想确保整个函数在同一个内核上运行,而函数内的计算不会跨内核分布。例如,假设我有一个函数(故意简化) f[a_,
我怎样才能从 Range[96] 中不重复地获得 48 个随机对的两个不同元素?即 96 个元素只使用一次。 当我尝试将元组/子集与 Select 结合使用时,我觉得必须有一种更直接的方法来实现这一点
我正在评估 Wolfram Mathematica 8 的大学类(class)项目。 我很难定义目标编程模型。 首先是因为我在数学方面真的很匮乏 :) 其次,因为我在 official documen
我开发了一些代码来从 LogNormalDistribution 和 StableDistribution 的乘积生成随机变量: LNStableRV[{\[Alpha]_, \[Beta]_, \[
我有一个想要优化的字符串验证函数。该字符串的长度为 2n,由 0 和 1 组成,例如 str="100001"。我想测试一下: 1) 字符串中奇数索引位置的 1 的数量(必须不少于 1)是否等于偶数索
请考虑: Function[subID, pointSO[subID] = RandomInteger[{1, 4}, {5, 2}]] /@ {"subA", "subB"}; M
我是一名优秀的程序员,十分优秀!