Guest User

Untitled

a guest
Mar 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. ε = 10^-6;
  2.  
  3. solw = NDSolve[{w''[t] + (w[t] + w[t]^2) w'[t] == 1/2 (1 + Tanh[100 t]), w[0] == 0,
  4. w'[0] == 0}, w, {t, 0, 2 π}, Method -> "MethodOfLines"];
  5. wsol[t_] := Evaluate[w[t] /. solw]
  6.  
  7. solG[s2_] :=
  8. NDSolve[{G''[t] + (G[t] + G[t]^2) G'[t] == s2 1/(Sqrt[π] ε) Exp[-(t/ε)^2], G[0] == 0,
  9. G'[0] == 0}, G, {t, 0, 2 π}, Method -> "MethodOfLines"]
  10. Gsol[t_] := Evaluate[G[t] /. solG[s2]]
  11. approx[t_] :=
  12. s1 NIntegrate[Gsol[t - τ] 1/2 (1 + Tanh[100 τ]), {τ, 0, t}, Method -> "DoubleExponential"]
  13.  
  14. tab = Table[Abs[wsol[t] - Gsol[t]], {t, 0, 1, 0.01}];
  15. NMinimize[Max[tab], s1, s2]
Add Comment
Please, Sign In to add comment