Tag Info

10

Code phasePortrait[f_, {{xmin_, xmax_}, {ymin_, ymax_}}] := Plot[ f[x], {x, xmin, xmax}, Frame -> True, PlotStyle -> Directive[Black, Thick], ImageSize -> 500, PlotRange -> {{xmin, xmax}, {ymin, ymax}}, Epilog -> {getMarkers[f], getArrows[f, {xmin, xmax}]} ] right = Triangle[{{2, 0}, {-1, 1}, {-1, -1}}]; left = Triangle[{{-2, 0}, ...

5

Albert Retey has demonstrated in a similar situation that you can use "EventLocator" to detect an event in NDSolve. For example: eqn = {\!$$\*SubscriptBox[\(∂$$, $$t$$]$$u[t, x]$$\) == 1/100 \!$$\*SubscriptBox[\(∂$$, $$x, x$$]$$u[t, x]$$\) - u[t, x] \!$$\*SubscriptBox[\(∂$$, $$x$$]$$u[t, x]$$\), u[0, x] == Sin[2 π x], u[t, 0] == u[t, 1]}; ...

3

A slight variant of the code in the question yields s = Simplify[k[q] /. DSolve[{(1/2)*σ^2*k''[q] + μ*k'[q] - λ*k[q] == 0, k'[0] == -mc, k'[b] == me}, k[q], q][[1, 1]]] (* (E^(-((q (μ + Sqrt[μ^2 + 2 λ σ^2]))/σ^2)) (E^((2 q Sqrt[μ^2 + 2 λ σ^2])/σ^2) mc λ σ^2 + E^((2 q Sqrt[μ^2 + 2 λ σ^2] + b (μ + Sqrt[μ^2 + 2 λ σ^2]))/σ^2) me λ σ^2 + E^((2 b ...

3

I have found my mistake. It was on the initial condition if we take $$\phi(zi)=0$$ and $$\phi'(zi)=0$$ the both methods will give the exact same solution.

3

I guess this is worth explaining a little better. Here is what I get running the exact code: You can see the error message and the domain say the integration stopped around 0.0473. The trouble arises here, if you don't notice that and plot over your specified range Plot[h[r] /. First@sol, {r, 10^-18, 1}] you get a plot, but its just garbage past ...

2

If I understand your question correctly, you could solve one PDE over the entire region and have different PDE coefficients active in different parts of the region, like so: sol = NDSolveValue[{Inactive[ Div][-If[x <= 1, {{10}}, {{1}}].Inactive[Grad][ u[x], {x}], {x}] == 1, DirichletCondition[u[x] == 0, True]}, u, {x, 0, 2}]; ...

2

NDSolve returned interpolation functions which come from the FEM will evaluate to Indeterminate if queried outiside of the region. In this case, for example: RegionMember[\[CapitalOmega], {10, 50}] (*False*) sol[10, 50] (*InterpolatingFunction::dmval: "Input value {10.,50.} lies outside the range of data in the interpolating function. Extrapolation will be ...

2

Update: If you use r[t] instead of r as the second argument of NDSolve you get the desired functions directly: sol2 = NDSolve[{(1 + (4 A t^2)/(r[t]^2 (r[t]^2 - Zh^2)) + Zh^2/(r[t]^2 - Zh^2) + (4 A Zh^4 t^2)/(r[t]^2 (r[t]^2 - Zh^2)^3) + (8 A Zh^2 t^2)/(r[t]^2 (r[t]^2 - Zh^2)^2))* r'[t]^2 + ((-4 A t)/(r[t] (r[t]^2 - Zh^2)) - ...

2

Here is one way to do it. With[{A = 2.23818*^8, Zh = 1*^11, a = 1.496*^11, M = 1.33*^20}, {rLo, rHi} = NDSolve[ {(1 + (4 A t^2)/(r[t]^2 (r[t]^2 - Zh^2)) + Zh^2/(r[t]^2 - Zh^2) + (4 A Zh^4 t^2)/(r[t]^2 (r[t]^2 - Zh^2)^3) + (8 A Zh^2 t^2)/(r[t]^2 (r[t]^2 - Zh^2)^2)) r'[t]^2 + ((-4 A t)/(r[t] (r[t]^2 - Zh^2)) ...

2

A method is to write a message handler, like in this answer. The handler is passed an argument of the form Hold[Message[...], boolean] where the boolean tells the handler if the message is to be displayed, or not. Since you are looking to capture the info passed to NDSolve::ndsz, I would write the handler like Clear[messageHandler, vals]; vals = {}; ...

1

NDSolve stops itself when it believes that it has encountered stiffness. To take advantage of this, rewrite test as test = ParametricNDSolveValue[{(Derivative[2][t][r] + (2/r)* Derivative[1][t][r] - D[Potential[x], x] /. x -> t[r]) == 0, t[10^(-12)] == d, Derivative[1][t][10^(-12)] == 0}, t, {r, 10^(-12), 1}, {d}] In other words, obtain the ...

1

You can use ScalingFunctions. It appears in red but works. ParametricPlot[{{x, Erfc[x]}, {x, Erf[x]}}, {x, .05, 10}, PlotRange -> All, ScalingFunctions -> {"Log", Identity}, Frame -> True, AspectRatio -> 0.6]

1

The integro-differential equation can be rewritten as s = NDSolve[{x'[t] == Integrate[x[q], {q, t - 10, t - 1}], x[t /; t <= 0] == 1}, x, {t, 0, 20}] In itself, this transformation does not help. But, it does suggest a course of action. First, note that x'[0] == 9. Then note that the DDE can be differentiated to give s = NDSolve[{x''[t] == x[t ...

1

As mentioned in the comments that DSolve will be unable to solve this nonlinear coupled system of two ODE's. Instead you can use NDSolve. Here is my try omega = 1.83465945; a0 = 0; epsilon = 0.5; Eq1 = y1''[x] == (Sqrt[(1 - epsilon^2)/((Sqrt[1 + a0^2] + y2[x])^2 - epsilon^2*(1 + y1[x]^2))]/epsilon^2 - omega^2) y1[x]; Eq2 = y2''[x] == (Sqrt[(1 - ...

1

I Have finally found what was causing the problem. it was with notation. I define my constant a_o but in the equation I have used a_0. Once I changed that it was working.

1

On the other hand, we can use DifferentialRootReduce[] on LegendreP[1/2 (-1 + Sqrt[17]), x] to see what linear differential equation is satisfied by it: Operate[FullSimplify, DifferentialRootReduce[LegendreP[1/2 (-1 + Sqrt[17]), x], x]] DifferentialRoot[Function[{y, x}, {-4 y[x] + 2 x y'[x] + (-1 + x^2) y''[x] == 0, y[0] == ...

Only top voted, non community-wiki answers of a minimum length are eligible