# Tag Info

2

Here is a way of evaluating your integral analytically. Series expand the integrand, but hold out a factor x/(-1 + E^x) to ensure that the series can subsequently be integrated term by term — this factor is 1 at x = 0, and x E^-x as x -> Infinity. Keep only the first few terms of the series, which we will use to “spot the pattern”. ser = Series[(x ...

2

Setting the option Method -> {"Multidimensional", "Generators" -> 9} takes care of most of the cases, at least as far as the warning messages go. There were a few exceptions, which suggests that intervention on a case by case basis may be necessary if further investigations are needed. gen[2, 3] = 5; gen[4, 0] = 6; gen[4, 4] = 5; gen[5, 0] = 5; ...

2

There were a couple issues. First, your definitions of tPx were done using :=, and they contained an integral. Ordinarily this is not a problem, but if tPx is used in NIntegrate (or any other function which calls it repeatedly!), then the kernel will symbolically evaluate the integral tPx at every datapoint in the integration, which is a recipe for ...

5

The integrand goes to infinity along a1 == 0 and a2 == 0: Manipulate[ Plot3D[ Abs[PsiN2[a1, b1, a2, b2, t1, p1, t2, p2, 0, 1, 1, 3]]^2 * Sin[a1] * Sin[a2], {a1, 0, Pi}, {a2, 0, Pi}], {b1, 0, 2*Pi}, {b2, 0, 2*Pi}] One can see the divergence of the integral by controlling MaxRecursion: Table[Quiet@ NIntegrate[ Abs[PsiN2[a1, b1, a2, b2, t1, p1, ...

2

Here's a qualitative way to do the computation using FFTs. First, make some data (in this, the disks all have phase 1, but that can be easily fixed): w1 = 600; w2 = 800; dat = Sum[ RotateRight[ DiskMatrix[ RandomInteger[{1, 150}], {w1, w2}], {RandomInteger[{-1000, 1000}], RandomInteger[{-1000, 1000}]}], {k, 6}]; Here's a plot of ...

4

You have intermingled two separate syntaxes. N does not have a PrecisionGoal option, it just takes a precision argument (arguments are different from options in Mathematica). So either of the below methods will get something. And note that for NIntegrate one should also set WorkingPrecision to exceed PrecisionGoal. NIntegrate[Sqrt[1 + (x*Sin[x])^2], {x, ...

1

I can't tell exactly what the problem is, since as user, do not have access to internal code. But it has to do with the handling of UnitBox in StateResponse. how can one obtain deterministic results The work around is very simple. Make the definition of the UnitBox outside the call with NumericQ argument. Then it works. Like this: f[t_?NumericQ] := ...

1

In addition to the reference provided by @MikeHoneychurch, your question about seeking $f(s)$ given the moments or projections or linear combinations $g(t)$, falls into the same category as this question about multi-peak fitting. There, the $f(s)$ are Gaussian-like shapes. Are you working with discrete samplings of the data $g(t)$? or are you looking for ...

3

There are a couple syntax errors in your integrand definition. Here is a corrected version: integrand[s_, omega_] := Module[{sigma, xs, x1, x2, zeta, Vc, theta, t1, t2}, sigma = Pi/(Pi + 2); xs = Exp[-Pi*s/(2*sigma)]; x1 = -2.0*sigma/Pi*(Log[xs/(1 + Sqrt[1 - xs^2])] + Sqrt[1 - xs^2]); x2 = 1.0 - 2*sigma/Pi*(1 - xs); zeta = x2 + x1*I; Vc = ...

1

f[d1_, d2_] = (Abs[ d1 - 0.0675 - d2] EllipticE[-((4*0.1516*0.1516)/(d1 - 0.0675 - d2)^2)])/(7.2*6.3*2 \[Pi]^2*8.85418782*10^-12*((d1 - 0.0675 - d2)^2 + (0.3032)^2) Sqrt[(d1 - 0.0675 - d2)^2]); Plot3D[f[d1, d2], {d1, -3.6, 3.6}, {d2, -3.15, 3.15}, ClippingStyle -> None, PlotPoints -> 101, PlotRange -> {0, ...

1

You can use Quiet to silence the error warnings NIntegrate[ 2 b2/(0.72*2 \[Pi]^2*8.85418782*10^-12*3^2) (NIntegrate[(d*(3.482 + d) EllipticE[-(4*0.1516* b2/((3.482 + d)^2 + (0.1516 - b2)^2))])/(((3.482 + d)^2 + (0.1516 + b2)^2)* Sqrt[(3.482 + d)^2 + (0.1516 - b2)^2]), {d, -0.36, 0.36}]), {b2, 0, 3}] // ...

1

Your inner NIntegrate[] argument is of course non numeric because it depends on the outer NIntegrate[] variables. So, f[d_, b_] := ((3.482 + d)^2 + (0.1516 - b)^2); NIntegrate[2 b ((d*(3.482 + d) EllipticE[-((4 0.1516 b)/f[d, b])])/(f[d, b] Sqrt[f[d, b]])), {d, -0.36, 0.36}, {b, 0, 3}] (* -0.0103908 *)

5

Your function \$HistoryLength = 0; a = -2; b = 5 I - 5; f[x_, y_] := 1/(x^2 + a y^2 + b); have long and sharp tails Plot3D[Re[f[x, y]], {x, -20, 20}, {y, -20, 20}, PlotPoints -> 200, MaxRecursion -> 5, PlotRange -> All, AxesLabel -> {x, y}] However there is a common procedure to calculate the Fourier transform numerically. It is tricky ...

3

I think the moral is that when the integrand has a singularity (its derivative is discontinuous at x = 0 in this case) and NIntegrate does not detect, the user has to tell it explicitly. That the singularity occurs when 0 is exactly 1/3 the way from an endpoint is interesting (in fact it can be off by a little), and I have a guess about how that slows ...

1

This is not an answer but a extended comment. No more than Daniel Lichtblau, I don't know the why this is happening, but I have found four rational numbers in the range {-1, 3}, that produce the indicated message and for which small perturbations suppress the message. With[{ϵ = 0}, NIntegrate[Sqrt[17 x^2 + x^4], {x, -1, #} + ϵ] & /@ {1/5, 1/2, 7/5, 2}] ...

2

If you examine what is going on with the option EvaluationMonitor :> Print[x], you discover that the last value of x is -6.337380909737406*^37, which causes an overflow. It's not the first x for which an overflow occurs, so overflow itself cannot be the reason. However the expression for which there is overflow is (1 - 1/(1 + E^(-x)))^10 (or more ...

2

For the initial integral, why do you have any reason to believe that there is any sort of closed form? As for the simpler integral, if you do: Assuming[ x > 0 && c > 0 && t > 0, Integrate[BesselJ[0, s], {s, x + c t, x - c t}]] It returns: 1/2 (\[Pi] (-c t + x) BesselJ[1, c t - x] StruveH[0, c t - x] - \[Pi] (c t + x) ...

4

In V10, the kernel seems unhappy with the exact quantities being given to NIntegrate. A work-around is to define pj with inexact coefficients. pj[j_Integer, mu_?NumericQ, sigma_?NumericQ] := NIntegrate[ (1./(1. + Exp[-x]))^j* (1. - 1./(1. + Exp[-x]))^(10 - j)/sigma/Sqrt[2.*Pi]* Exp[-(x - mu)^2/2./sigma^2], {x, -Infinity, Infinity}] ...

1

ClearAll["Global*"] link1 = {84, 54, 36, 21}; klink1 = 4; skinks = {56, 19, 28, 18, 24, 14, 9}; kskinks = 7; taxicabsA:={142, 81, 49, 7, 3, 1}; ktaxicabsA:= 10; B1999:={11,12,10,4,4,1,4,2,3,3,0,2,4,1,1,0,1,1,1,2,0,1,0,0,0,0,0,0,0,1,3}; kB1999:= 50; (* Modified Version *) mylikLNB2[data_, kdata_, f0_, mu_, sigma_] := Module[ {K, pj, fj, j, N0, ...

2

ClearAll[pj]; pj[mu_?NumericQ, sigma_?NumericQ] := Table[NIntegrate[(1/(1 + Exp[-x]))^ j*(1 - 1/(1 + Exp[-x]))^(10 - j)/sigma/Sqrt[2*Pi]* Exp[-(x - mu)^2/2/sigma^2], {x, -Infinity, Infinity}], {j, 0., 10.}] pj[-1.9575, 0.3432] pj[-4, 9] (* {0.273692, 0.0356199, 0.0051466, 0.000824808, 0.000146484, \ 0.0000288024, 6.26425*10^-6, 1.50561*10^-6, ...

1

Corrected per input from Michael E2 mu = 0.0173262004; (*attenuation coefficient for E=?*) k = (mu - 0.00324543007)/(0.00324543007); h = 150; sz[r_] = 0.26*r^0.69; eg = .7; qx = 1.; u = 1.; the = (22.5 Pi)/180; f1 = 1/(l^2 + z^2); f2 = 1 + k mu (l^2 + z^2)^0.5; f3[r_] = Exp[-(z - h)^2/(2 sz[r] sz[r])]; f4[r_] = Exp[-(z + h)^2/(2 sz[r] sz[r])]; f5 = Exp[-mu ...

1

You can define your val now as a function of r, rather than as a constant. Then you will be able to operate with this function. I will show it within a short example, and you can then implement into your code by analogy. Consider an integral sz=5; int=NIntegrate[x^2*Exp[-sz*x^2], {x, 0, Infinity}] (* 0.0396333 *) Now let us replace this ...

7

Here is the same approach as Jens, but using Association and assuming uniform grid data: st[hr_?MatrixQ, rho_, min_, max_, step_] := Module[{h = <|Rule @@@ hr|>, s, freq, dr = hr[[2, 1]] - hr[[1, 1]]}, s = Function[q, 4 Pi rho /q Tr[dr # Sin[q #] (h[#] - 1) & /@ Keys[h]]]; freq = Range[min, max, step]; Transpose[{freq, s /@ freq}] ] Now: ...

9

The interpolation step seems to be unnecessary because the integral into which it enters can be equally well approximated as a Riemann sum. So to get really fast results you could do the following: {r, h} = Transpose[hrdata]; d = Differences[r]; Clear[s]; s[q_] := (4 Pi 0.83 )/q Total[d Rest[r Sin[q r] (h - 1)]] ans2 = Table[{i, s[i]}, {i, 0.05, 11.4, ...

1

I am not an expert on this (solving non-linear odes'). But to put all what I saw here in stead of in comment is easier. Basically, you have a non-linear ode with singularity when y(0)=0 as well due to the initial conditions. You can see this part like this: de = y[x] (2 + y[x]) y''[x] + 2 x y[x] (2 + y[x]) y'[x]/(-1 + x^2) - (1 + 2 y[x]) y'[x]^2 + 4 (1 + ...

Top 50 recent answers are included