I am trying to numerically solve the following differential equation
Clear[wmax, g, G, wsol]
wmax = 0.726714; (* define me please *)
{tinf, tmax} = {0.05, 2.05}; (* define me as well please *)
g[t_] :=
func[t]; (* give me the full version or a standalone toy-version \
instead *)
G[t_] := (t - tinf)/(tmax - tinf)
wsol = NDSolve[{
w'[t]==Sqrt[2/(G[w[t]]*(1 - G[w[t]])) Integrate[g[x](1-x),{x,w[t],w[tmax]}]],
w[tmax] == wmax},
w, {t,tinf,tmax}]
where G
is a cdf, for instance G[t]=(t-tinf)/(tmax-tinf)
and the boundary value wmax
is given (equal to 0.726714
with a uniform distribution on [2,4] for G
).
NDSolve
always returns the trivial solution w[t]=w[tmax]
. I am certain that there exists other solutions with a strictly positive derivative, but I cannot find a way to obtain them.
I have tried with the Shooting
option but unsuccessfully so far, partly because I don't understand the syntax.
Any help would be greatly appreciated. Thanks
Edit: Here is the code I'm using. Thanks for your input! PS: I take a uniform distribution on [0,csup] for G here. My goal is to test different distributions.
Clear["Global`*"];
Clear[\[Theta], w, c0, k, G, g, \[Theta]sup, \[Theta]inf, x, y, \[Lambda], \[Eta], \[Mu], Q0, Q1, Qfb, Qm, csup, wtilde, temp, wm];
Qfb[\[Theta]_] := \[Theta] - c0;
Qm[\[Theta]_] := 2 \[Theta] - \[Theta]sup - c0;
\[Theta]inf = 3;
\[Theta]sup = 4;
G[t_] := t/csup;
g[t_] = D[G[t], t];
csup = 2;
c0 = 1;
k = 1;
wm = x /. Solve[c0*k == x + G[x]/g[x], x][[1]] // FullSimplify
(* assumptions that must be satisfied *)
c0*k < csup
\[Theta]inf - c0 >= k
2*\[Theta]inf - \[Theta]sup - c0 >= 0
wm < c0*k
wm > 0
(*Step 1: computation of the boundary value w[\[Theta]sup] through an indepedent requirement*)
Clear[\[Mu], sol\[Mu]];
\[Mu][w_, w\[Theta]sup_] := Sqrt[2 G[w]*(1 - G[w])*
Integrate[g[wtilde] (c0*k - wtilde), {wtilde, w, w\[Theta]sup}]];
sol\[Mu] = Solve[\[Mu][w, w\[Theta]sup] == (\[Theta]sup - \[Theta]inf)*G[w], w];
wnot[w\[Theta]sup_] = w /. sol\[Mu][[2]][[1]];
Clear[temp0];
\[Mu][wtilde_, w\[Theta]sup_] = Sqrt[2 G[wtilde]*(1 - G[wtilde])*Integrate[g[x] (c0*k - x), {x, wtilde, w\[Theta]sup}]];
temp0[w\[Theta]sup_?NumericQ] := (\[Theta]sup - \[Theta]inf) -NIntegrate[(G[wtilde]*(1 - G[wtilde]))/\[Mu][wtilde, w\[Theta]sup], {wtilde, wnot[w\[Theta]sup], w\[Theta]sup}];
w\[Theta]supsol = w\[Theta]sup /. FindRoot[temp0[w\[Theta]sup], {w\[Theta]sup, wm}]
(*Out: w[\[Theta]sup]=0.726714*)
(*Step 2: computing w[\[Theta]]*)
wsol = NDSolve[{w'[\[Theta]] == Sqrt[2/(G[w[\[Theta]]]*(1 - G[w[\[Theta]]])) Integrate[g[wtilde] (c0*k - wtilde), {wtilde, w[\[Theta]], w\[Theta]supsol}]], w[\[Theta]sup] == w\[Theta]supsol}, w, {\[Theta], \[Theta]inf, \[Theta]sup}]
(*Out: I always end up with the trivial solution w[\[Theta]]=w[\[Theta]sup]. But others should exist...*)