Tag Info

Hot answers tagged

5

Your problem is partly that NIntegrate calls a function that at the given point in time is not full numerical (the first expression in fn). A way around that is to define the functions in such a way that hey will only evaluate for purely numerical values: Clear[m1, m2, fn, gn]; m1[x_?NumericQ] := (2 (x - 1))/x; m2[x_?NumericQ, y_?NumericQ] := (x (2 - x ...


5

Compile f and use a memo-ized version of it Since it seems like NIntegrate decides to symbolically evaluate its argument first, I thought I'd force it not to by compiling the function f. This seems to make a significant difference: Clear[f, f1, g] g[x_] = Nest[f[x] + 1./# &, f[x], 500]; f1 = Compile[{x}, Sum[1/100 Erfc[-(x^2/k)], {k, 100}]]; ...


4

Integrate can be used to handle the DiracDelta, Integrate[Integrand[p, Q2, ν, θ], {p, 0, Infinity}, Assumptions -> p3zero2[Q2, ν, θ] ∈ Reals && p3zero1[Q2, ν, θ] ∈ Reals] (* ((HeavisideTheta[p3zero1[Q2, ν, θ]]*p3zero1[Q2, ν, θ]^2)/ ((M - 2*E3[p3zero1[Q2, ν, θ]])^2*E3[p3zero1[Q2, ν, θ]]* E4[p3zero1[Q2, ν, θ], Q2, ν, θ]*Derivative[1, 0, ...


4

Using polar coordinates r and f, the region of integration is given by { 0<= r <=2/Cos[f], 0<= f <= 2 \[Pi] } We can then proceed as follows. First integration with PrincipalValue g = 8 Integrate[r/(1 - r^2), {r, 0, 2/Cos[f]}, Assumptions -> 0 < f < \[Pi]/4, PrincipalValue -> True] (* Out[451]= -4 Log[-1 + 4 Sec[f]^2] *) ...


3

Setting WorkingPrecision -> 5 in the gn integral gives you a reasonable convergence time. At the expense of some more computation time you can check that methods DifferentialEvolution and SimulatedAnnealing both return the sme result given here up to four decimal places. m1[x_] := 2 (x - 1)/x; m2[x_, y_] := x (2 - x y)/(2 (x - 1) y); fn[x_?NumericQ, ...


2

You can integrate as follows. Integrate[BesselI[-nu, k*x]/x, {x, r1, r}, Assumptions :> {k \[Element] Complexes, r1 \[Element] Reals, r \[Element] Reals, nu \[Element] Reals, r1 > 0, r > r1} The result is a complicated expression in terms of Gamma and HypergeometricPFQRegularized functions. Nevertheless, it can be ...


1

The first thing I did was to rationalizing all calculations, starting with the defintion of σ and minroot. This stops the Solve::ratnz messages. I also made some other improvements to minroot. σ = 6/10; minroot[gg_?NumericQ, bb_?NumericQ] := Module[{b, g, rts, r}, b = Rationalize[bb, 0]; g = Rationalize[gg, 0]; rts = r /. Solve[ ...



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