A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

# Tag Info

20

The most hard part of OP's questions is the latter half of 1st one i.e. solve the problem in a little faster or not so demanding-in-memory way. I've found 2 solutions, one is easy but hard to extend, the other is advanced but general. Let me talk about the simple one first. Simple solution Go back to v8. v7 and v6 probably works, too. Clearly there ...

16

(This is not an answer, but only a phenomenon I observed. And I think it might be a bug.) I think in version 9, Mathematica fails to compile the Fold for $n\geq 166$ where $n$ is the integer number in Range. The precise threshold may be different from OS to OS, but I suspect this phenomenon exists in all version 9. Note the default "FoldCompileLength" is ...

15

This is best I can do so far. The system is linear so LinearSolve is a natural thing to try. arrays = CoefficientArrays[eqs, vars] (* {SparseArray[< 2 >, {9}], SparseArray[< 35 >, {9, 9}]} *) solv1 = Thread[ vars -> LinearSolve[arrays[[2]], -arrays[[1]], Method -> "CofactorExpansion"]]; // AbsoluteTiming (* {0.28347, Null} ...

15

The reason for this behavior is that autocompilation always uses settings equivalent to "RuntimeOptions" -> {"Quality", "WarningMessages" -> False}. As previously noted in Silvia's answer, the automatic compilation is invoked for input exceeding SystemOptions["CompileOptions" -> "FoldCompileLength"] (* {"CompileOptions" -> {"FoldCompileLength"...

14

Is there anyway to get NSolve to solve this equation in V11.1? Adding Complexes makes it work NSolve[BesselJ[0, x] == 0 && 0 < x < 20, x, Complexes]

14

The defect is known since March 2018. According to the support, it will be addressed in future versions (perhaps the next one - my guess). If you want to use the legacy converter: Import["fö.xlsx", {"DataLegacy"}] or Import["fö.xlsx", {"SheetsLegacy"}] For me, the new import functionality seemed to be better so I changed the paths & filenames ...

13

It is a bug in V11.1. As a workaround, you can put the following in your init.m file. ReduceRealTNRoots; nonElementaryQ[f_] := Module[{x}, !ListQ[SimplifyFunctionSingularities[f[x], x, "ELEM"]]] SystemTRootsDumpNIntervalRoots[f_?nonElementaryQ, ii_, prec_] := $Failed This will disable the offending code for non-elementary functions. In[4]:= NSolve[... 12 You can force NDSolve to use the finite element method: uif = NDSolveValue[{-u''[x] == UnitBox[(x - 0.5) 0.5/0.2], u[0] == 0, u'[1] == 0}, u, {x, 0, 1}, Method -> {"PDEDiscretization" -> "FiniteElement"}]; Possibly, this might be the default. In any case if you compare to the analytical solution: aif = DSolveValue[{Rationalize[-u''[x] == ... 10 Having put in some time trying to see what's going, I've found a few things, but I don't have a perfectly clear picture. I believe the issue is with the large InterpolatingFunction in the integrand and not with NIntegrate per se. The time it takes for NIntegrate to set up the integration is much longer in V10, but the integration itself runs in about the ... 9 Here a one-liner twitterable solution: Expand@Normal@Series[Hypergeometric2F1[1, 1 - eps/2, 3 - eps, x], {eps,0,0}]/.x->(1/2) giving 4 - 4 Log[2] 9 It's a backslide introduced since v9: and another issue of "DiscontinuityProcessing" so we at least have 2 workarounds. One is to turn off the "DiscontinuityProcessing": eq1 = {y'[x] == Piecewise[{{z[x], x < 5}, {y[x], 8 > x > 5}, {2 z[x], x > 8}}]}; eq2 = {z'[x] == Piecewise[{{2 z[x] + 1, x < 5}, {2 y[x] + 1, x > 5}}]}; eqs = {eq1, eq2, ... 8 Vb3[x_] := If[x < -L, 10^10, If[-0.1*L < x < 0.1*L, U, 0]]; u = NDSolve[{(-hbar^2/(2*me)) f''[x] == (2.40986*^-20 - Vb3[x]) f[x], f[L] == 0, f'[-L] == 0.1}, f, {x, -L, L}, Method -> {"DiscontinuityProcessing" -> False}] Plot[f[k] /. u, {k, -L, L}] 8 This does indeed work flawlessly with Mathematica version 8. But in version 10, I had to resort to the following workaround: AbsoluteTiming[ Series[Normal[ Series[Hypergeometric2F1[1, 1 - eps1, 3 - eps, 1/2], {eps1, 0, 1}, {eps, 0, 1}]] /. eps1 -> (eps/2), {eps, 0, 0}]] (* ==> {0.016225, SeriesData[eps, 0, {2 (EulerGamma + PolyGamma[0, ... 7 This is just an extended comment. I'm not quite certain what's going on as we can easily implement a shooting method manually here. (Shooting method, in short: parametrize in terms of u'[0] and very the parameter until u'[1] has the desired value.) fun = ParametricNDSolveValue[{-u''[x] == UnitBox[(x - 0.5) 0.5/0.2], u[0] == 0, u'[0] == ud}, u, {x, 0, 1}, ... 7 This question is being automatically bumped as unanswered. However, we have an authoritative answer in comments: Investigating as a regression. You can put a "bugs" tag on it if you like. --Daniel Lichtblau 7 Not a solution, more of an extended comment. Clearly there are real solutions, the curves below do cross ContourPlot[ Evaluate[{D[P[T, V], {V, 1}] == 0, D[P[T, V], {V, 2}] == 0}], {V, -10, 10}, {T, -10, 10}, PlotPoints -> 40] You can get the real-valued solutions version 9 gave via Solve[{N@D[P[T, V], {V, 1}] == 0, N@D[P[T, V], {V, 2}] == ... 7 Please report this issue to Wolfram support. It seems that LinearSolve has a bug related to the new in M12 handling of machine number underflow. As an example, the following extracts the LinearSolve call that doesn't work in M12, but does in M11.1: ls = Reap[ TracePrint[ SpheroidalS2Prime[0, 0, -I, 0.], _LinearSolve, ... 6 This is an extended comment that constrains the problem a bit. I reported the problem [CASE:4174000] with the following simplified example. Reproducing the problem p = Array[{{1, 1}, #/11} &, 10]; ump[coords_, weight_] := { weight coords + (1 - weight) MousePosition["Graphics", coords], weight } Labeled[ Graphics[ Disk @@@ p ... 6 You can use any of the alternative methods found here: Methods for NSolve For example: NSolve[{D[P[T, V], {V, 1}] == 0, D[P[T, V], {V, 2}] == 0}, {T, V}, Reals, Method -> "Legacy"] (* {{T -> 0.0943287, V -> 7.66613}, {T -> -9.67712, V -> -2.35529}, {T -> -5.12191, V -> -0.778707}} *) The other alternatives seem to work, too.... 6 There is an approach that works to all orders—and I expect would be useful for other expressions arising in 1-loop integrals in QFT. Using a Hypergeometric2F1 integral definition, e.g. Gamma[c]/(Gamma[b] Gamma[c - b]) * Integrate[(t^(b - 1)*(1 - t)^(c - b - 1))/(1 - z*t)^a, {t, 0, 1}] the sum you are examining, Hypergeometric2F1[1, 1 - eps, 3 - eps, ... 6 As is well known, and has been discussed extensively in this forum, there may be problems in general with Integrate[] and the fundamental theorem of calculus, mostly due to discontinuities or other singularities in the antiderivative. But not in this case for version 8:$Version (* Out[1]= "8.0 for Microsoft Windows (64-bit) (October 7, 2011)" *) The ...

6

Your reply to Jens's answer suggests that you do not want to manually replace variables. This function just automates the method in Jens answer... cme[hgm_, symb_: c] := Module[ { places, symbs }, places = Position[hgm, eps]; symbs = Array[symb, Length[places]]; FullSimplify[Normal[Series[ ReplacePart[hgm, (Rule @@ # &) /@ Transpose[{places, symbs}]],...

6

Looks like you have to fool around with the precision on a case by case basis. N[SpheroidalS2[0, 0, -I, I/2]] (*-0.6890905745631529 + 0.*I*) works, but N[SpheroidalS2[0, 0, -I, I/10]] gets an overflow. However, N[SpheroidalS2[0, 0, -I, I/10], 50] -1.13893813158018132761330789352859720024513682988326 + 0.*10^-51 I works. In any case, I would always ...

5

I've had difficulty before with UnitBox, although I've forgotten the exact context. UnitStep usually works better. sol = NDSolve[{-u''[x] == UnitStep[x - 0.3] - UnitStep[x - 0.7], u[0] == 0, u'[1] == 0}, u, {x, 0, 1}]; Plot[u[x] /. First[sol], {x, 0, 1}]

5

One possible workaround is to use the new in M12 function AsymptoticSum: AsymptoticSum[Sin[Pi k/n]/(n + 1/k), {k, 1, n}, {n, ∞, 1}] 2/𝜋

5

$Version (* "10.3.1 for Mac OS X x86 (64-bit) (December 9, 2015)" *) f[z_] = (z - 2) PolyLog[2, z] Log[1 - z]/z^3; fi[z_] = Integrate[#, z] & /@ (f[z] // Expand) // FullSimplify (* (1/(6*z^2))* (z^2*(Pi^2 - 24*ArcTanh[ 1 - 2*z]) + 12*z*Log[1 - z] - 3*(-1 + z)^2* Log[1 - z]^2 - 6*(z*(1 + z) + (-1 + z)* ... 5 I'm struggling to see what the question is, other than "Anyone else experience this problem?", which I guess comes down to, "Can others confirm this is a backslide and that I haven't messed up something?" There is a certain amount of noise surrounding the question: the initial mis-coding of the absolute value and the abuse of PowerExpand in particular. ... 4 The problem arises in trying to determine the conditions for which the integral is defined. Using GenerateConditions -> False provides a solution with the additional assumption and is much faster. AbsoluteTiming[ Assuming[{l > 0, R > 0, Element[n, Integers]}, Integrate[ k^n SphericalBesselJ[l, R*k], {k, 0, ∞}, GenerateConditions -> ... 4 Update Since you gave a good proof, that$2/\pi$is the correct solution, Mathematica is obviously failing at the task. The question is, why. Analysis of Mathematica's behavior First, the sum you gave is no Riemann sum: You defined the intervals as $$\Delta x_k=\frac{1}{n+1/k}$$ so$k/n$does not lie within the appropriate subinterval, e.g. for$n=10$,$...

4

Yesterday I found the approach below with Hold/ReleaseHold on v10.0.0 on Win8.1 achieves the same result as v8.0.4, namely, it gives a limit of $\frac{2}{\pi}$. ReleaseHold@Limit[ Hold[ Sum[Sin[Pi*k/n]/(n + 1/k), {k, 1, n}] ], n -> Infinity] (* 2/Pi *) However, on v10.0.2 on Linux, this approach gives the result shown below...as does ...

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