I try to solve an error minimization problem with respect to 2 parameters. The error is the absolute difference between the solutions of the ODEs
\[Epsilon] = 10^-6;
Delta[t_] := 1/(Sqrt[\[Pi]] \[Epsilon]) Exp[-(t/\[Epsilon])^2]
f[t_] := Delta[t]
sol = 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"];
and
solGreen[s2_] :=
NDSolve[{G''[t] + (G[t] + G[t]^2) G'[t] == s2 Delta[t], G[0] == 0,
G'[0] == 0}, G, {t, 0, 2 \[Pi]}, Method -> "MethodOfLines"]
I define
wsol[t_] := Evaluate[w[t] /. sol]
GGreen[t_] := Evaluate[G[t] /. solGreen[2]]
wGreen[t_] :=
s1 NIntegrate[GGreen[t - \[Tau]] f[\[Tau]], {\[Tau], 0, t},
Method -> "DoubleExponential"]
and store the error in a table
tab = Table[Abs[wsol[t] - wGreen[t]], {t, 0, 1, 0.01}];
Finally, I apply
NMinimize[Max[tab], s1]
for fixed s2. This algorithm finds the value of s1 minimizing the absolute difference between the solutions for fixed s2. Is there a way to modiy the above algorithm to minimize the error with respect to s1 and s2 simultaneously?
Attachments: