Tag Info

Hot answers tagged

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 ...


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, ...


4

dist = UniformDistribution[{{-15, 15}, {-4, 4}}]; avgdist = NExpectation[Norm[{x, y, 12}], {x, y} \[Distributed] dist] (* or NExpectation[EuclideanDistance[{x, y, 0}, {0, 0, 12}], {x, y} \[Distributed] dist] *) (* 14.8171 *) Update: You can also obtain the average distance symbolically using Integrate[Sqrt[c^2 + x^2 + y^2] Boole[-a < x < a ...


4

Perhaps this will help in your general use-cases. Part of the problem comes down to how the tetrahedron region is described. Apparently(?), when the coordinates are approximate reals, the finite element method is invoked. Specifying another method appears to cause the message and the integral not being evaluated. However, if exact coordinates are given, ...


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}] ...


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, ...


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 = ...


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 ...


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 ...


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, ...


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 ...


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) ...


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 ...


1

DensityPlot[EuclideanDistance[{x, y, 0}, {0, 0, 12}], {x, -15, 15}, {y, -4, 4}, AspectRatio -> Automatic] NIntegrate[EuclideanDistance[{x, y, 0}, {0, 0, 12}], {x, -15, 15}, {y, -4, 4}]/(30 8) (* 14.8171 *) {a, b, c, d, e} = {{0, 0, 12}, {-15, -4, 0}, {-15, 4, 0}, {15, 4, 0}, {15, -4, 0}}; coords = {{b, c, d, e}, {a, b, c}, {a, c, d}, ...


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 ...


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 *)


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}] ...


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, ...


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] := ...



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