Hot answers tagged

13

Some explanations first The substitution in the question introduces the reduced wave function $u(r)$ by solving the original radial equation in polar coordinates, $$-\frac{1}{2}\left(R''(r)+\frac {1}{r}R'(r)\right) - \frac{1}{r}R(r) + \frac {m^2}{2r^2}R(r) = E R(r)$$ using the ansatz $$R(r)\equiv \frac{1}{\sqrt{r}}u(r)$$ The apparently divergent ...


10

The following is not particularly fast and could be more accurate but does make progress toward the goals set in the Question. To begin, consider the analytical properties of f, as defined in the Question. By observation, it has branch points at {I Sqrt[6/5] ξ, I Sqrt[2/5] ξ} and their conjugates. Poles are obtained by p /. ...


7

You can find the value of $x_{b}$ by using NDSolve and a stopping condition: Reap[ NDSolve[{x'[t] == Sin[t], x[0] == 0, WhenEvent[x[t] == 1, Sow[t]; "StopIntegration"]}, x, {t, Infinity}]][[2, 1, 1]] (* 1.5708 *) Just to verify: Integrate[Sin[t], {t, 0, 1.5708}] (* 1. *)


6

The way to deal with this is to use the special setting Method -> "InterpolationPointsSubdivision" of NIntegrate[], which will automagically split the integrand so that an integration rule (by default, "GlobalAdaptive") is only applied within each piecewise polynomial interval of the InterpolatingFunction[] involved. This is akin to the functionality of ...


6

The oddity in this case comes from NSum which is being called in a certain way from NIntegrate. This is a simple example that has roughly the same behavior (note in this case the exact result is known to be $\mp \ln 2$): NSum[(-1)^n/n, {n, 1, Infinity}, Method -> {"AlternatingSigns", Method -> "WynnEpsilon"}, WorkingPrecision -> 32] (* ...


5

Here is a simple example for the default method (LSODA) that shows a couple of the issues related to the situation in the question: $$y' = \exp(-10 \, x^2), \quad y(-20) = 1, \quad -20 \le x \le 20$$ The exact solution is a scaled error function (Erf), which has a sigmoid graph going from $y(-20)=1$ to $y(20) \approx 1.5605$. For $|x|$ large, $y'$ is ...


4

The problem is that Expectation does not evaluate to a numeric result in all cases. It's also quite slow. You could replace it by NExpectation in the final integrand. I threw in an extra N for just to be sure. It takes so long to evaluate, I didn't have time to experiment. AverageProbSuccess[B_, \[Lambda]_] := Block[{n = 0, i, Expectation}, ...


4

TechSupport acknowledged and proposed a simple workaround by putting inert expression, e.g. empty string, inside the { }: NDSolve[{x'[t] == x[t], x[0] == 1, WhenEvent[Mod[t, 1] == 0, {""}]}, x, {t, 0, 3}]


3

If you are willing to accept some error you can get a faster result by fitting the data to function. Other than at each extreme the data looks like a shifted and scaled Sinh function. Using your data (i.e., not re-copied) sol = FindFit[data, a Sinh[(x - x0)/b], {{a, 0.000015}, {b, 15}, {x0, 100}}, x] (* {a -> 0.0000140493, b -> 14.3721, x0 -> ...


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

In this BVP, Mathematica uses the shooting method, and you're shooting at an unstable solution. You can iteratively approach the solution, extending the interval of integration at each step, but at machine precision, you can extend it only so far. I'll set up bc to depend on symbolic min and max, so we can fiddle with them at each iteration: (*Boundary ...


2

Difficulties encountered in solving the dispersion relation in the Question are due not so much to convergence of the integral as to the branch point in complex γ- space, which occurs where the argument of ArcTanh[] is equal to 1. Based on the related article cited in a comment above, the integration contour {γ, 1, Infinity} must pass below all non-analytic ...


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

It's from the Bessel factor: Cosh[(1 - ϵ) x] /. x -> 10.`40^16 Note that the Bessel function evaluates to Underflow[]:


2

It seems that this might be a bug or maybe a weakness of the NDSolvemachinery. One can observe, that with the option "SimplifySystem" -> False the issue does not arise. In fact a lot of settings will cause no problem at all. As far as I can see, the culprit is the option DependentVariables as it seems to influence the sequence of equation simplifications ...


2

For small k, xs = 10^-4; xm = 12; s = ParametricNDSolve[{y''[x] + 3 y'[x]/x - y[x] + 3/2 y[x]^2 - k y[x]^3/2 == 0, y'[xs] == 0, y[xm] == 0}, y, {x, xs, xm}, {k, ys}, Method -> {"Shooting", "StartingInitialConditions" -> {y[xs] == ys, y'[xs] == 0}}]; f = y[.2, 5.2] /. s; f[xs] Plot[f[x], {x, xs, xm}, AxesLabel -> {x, y}, PlotRange ...


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

What you have, I guess, is DAE in the variable t. If you specify the initial condition g[x, 0] == Cosh[x]/Cosh[Pi], NDSolve will compute a "solution," but warns that "an insufficient number of boundary conditions have been specified for the direction of independent variable x." It then computes different initial values, that lead g to be almost identically ...


1

Most recent edit This seems to work (tested exactly what is posted here in a fresh kernel), however it does complain a little. α = 4; μ = 10; k = 1; τ = 1; δ = 1/2; s[r_] := (μ r^α)/Pm f[h_] = FullSimplify[ Exp[2 k] (k + 1)/τ Exp[-k - (k + 1) h/τ] BesselJ[0, Sqrt[4 k (k + 1) h/τ]] ]; int[r_, h_] = Integrate[(1 - Exp[-s[r] Pm h ...



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