Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NDSolve[{-x^2 f'[x] + f[x] (a[x] - x/(1 - x)) == 0, f[x]^2 - x^2 a'[x] + a[x] x/(1 - x) == 1,
- f[0] == 1, f[1] == 0}, {f,a}, {x, 0, 1}]
- NDSolve[{f[x]^2 + x^4 (f'[x]/f[x])^2 - x^4 f''[x]/f[x] + x^3 (1/(1 - x) - 2) f'[x]/f[x] - 1 == 0,
- f[0] == 1, f[1] == 0}, f, {r, 0, 1}]
- eq = {-f[x]^2 + f[x]^4 +
- x^4 Derivative[1][f][x]^2 + (x^3) /(-1 + x)
- f[x] ((1 - 2 x) f'[x] - (-1 + x) x f''[x]) == 0, f[1/10] == 1,
- f'[1/10] == -1/10};
- eq // Column // TraditionalForm
- s = NDSolve[eq, f, {x, 1/10, 9/10}];
- Plot[Evaluate[f[x] /. s], {x, 1/10, 9/10}, PlotRange -> All]
- eq1 = D[f[r], r] + f[r] (a[r] - 1/r);
- eq2 = f[r]^2 + D[a[r], r] + a[r]/r - 1;
- arule = Solve[eq1 == 0, a[r]][[1, 1]];
- darule = D[%, r] // Simplify;
- eq3 = -f[r] (eq2 /. {arule, darule}) // Simplify
- (* f[r] - f[r]^3 + Derivative[1][f][r]/r - Derivative[1][f][r]^2/f[r] +
- Derivative[2][f][r] *)
- Series[eq3 /. Thread[Rule[#, # /. f -> Function[{r}, Sum[c[i] r^i, {i, 4}]]] & /@
- {f[r], Derivative[1][f][r], Derivative[2][f][r]}], {r, 0, 2}] // Normal
- (* c[2] + r (c[1] - c[2]^2/c[1] + 4 c[3]) +
- r^2 (c[2] + c[2]^3/c[1]^2 - (4 c[2] c[3])/c[1] + 9 c[4]) *)
- r0 = 10^-5; r1 = 50;
- sEvent = ParametricNDSolveValue[{eq3 == 0, f[r0] == f'[r0] r0,
- f'[r0] == b, WhenEvent[f'[r] < 0, "StopIntegration"],
- WhenEvent[f[r] > 1, "StopIntegration"]}, f, {r, r0, r1}, {b}, WorkingPrecision -> 45];
- dist[b_?NumericQ] := sEvent[b]["Domain"][[1, 2]]
- FindMaximum[dist[b], {b, 8529/10000}, WorkingPrecision -> 45];
- {dmax, b0} = {First@%, b /. Last[%]}
- (* {19.7939826947595284038626883012992096669595719,
- 0.853177865433588923966572213040425596262318851} *)
- Plot[sEvent[b0][r], {r, r0, dmax}, PlotRange -> All, AxesLabel -> {r, f}]
- arule[[2]] // Apart
- (* 1/r - Derivative[1][f][r]/f[r] *)
- Plot[1/r - sEvent[b0]'[r]/sEvent[b0][r], {r, r0, dmax}, AxesLabel -> {r, a}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement