【发布时间】:2018-03-24 03:30:33
【问题描述】:
我想最小化两个非线性 ODE 数值解之间的绝对误差。这是我使用的代码:
\[Epsilon] = 10^-6;
Delta[t_] := 1/(Sqrt[\[Pi]] \[Epsilon]) Exp[-(t/\[Epsilon])^2]
f[t_] := 1/2 (1 + Tanh[100 t])
solw = NDSolve[{w''[t] + (w[t] + w[t]^2) w'[t] == f[t], w[0] == 0,
w'[0] == 0}, w, {t, 0, 2 \[Pi]}, Method -> "MethodOfLines"];
wsol[t_] := Evaluate[w[t] /. solw]
solG = ParametricNDSolve[{G''[t] + (G[t] + G[t]^2) G'[t] ==
s2 Delta[t], G[0] == 0, G'[0] == 0}, G, {t, 0, 2 \[Pi]}, {s2},
Method -> "MethodOfLines"];
GGreen[t_, s2_] := Evaluate[G[s2][t] /. solG]
Gsol[t_, s1_, s2_] :=
s1 NIntegrate[GGreen[\[Tau], s2] f[t - \[Tau]], {\[Tau], 0, t},
Method -> "LocalAdaptive"]
然后,我将绝对误差及时离散化:
Table[Abs[wsol[t] - Gsol[t, s1, s2]], {t, 0, 1, 0.1}]
并使用命令:
NMinimize[
Max[Table[
Abs[wsol[t] - Gsol[t, s1, s2]], {t, 0, 1, 0.1}]], s1, s2]
但是,这不起作用,因为 s2 未在 Gsol 的 NIntegrate 中指定。
有没有办法最小化
Table[Abs[wsol[t] - Gsol[t, s1, s2]], {t, 0, 1, 0.1}]]
关于s1 和s2 同时?
为简单起见,s2 可以限制为[-2,2]。
【问题讨论】:
-
你应该在mathematica.stackexchange.com上发布这个
标签: wolfram-mathematica differential-equations minimize