# Tag Info

0

In Mathematica 10, this can be easily computed using built-in functionality. Using Silvia's answer's polygon and function: polygonPts3D = { {-0.902757, -0.116805, 0}, {0.203504, -0.972294, 0}, {0.849893, 0.414192, 0}, {0.374057, 0.835407, 0}, {-0.907079, 0.352119, 0} }; f[x_,y_,z_] := ...

1

Because s[t] is decreasing whenever p < 1, s[t] - myPreviousStep < 10^-4 will always be True. WhenEvent[cond, action] evaluates action when the condition changes from False to True; however, the condition is always True when p < 1. You need something like Abs[s[t] - myPreviousStep] < 10^-4, instead. Note that if p is closer to 1 than 10^-4, ...

0

Vladimir, there is one simple solution: lst = Table[{a, NIntegrate[BesselJ[0, x - a] BesselJ[0,x + a], {x, -\[Infinity], \[Infinity]}, PrecisionGoal -> 5, Compiled -> True]}, {a, 0.84, 0.85, 0.0001}] This visualizes the result: ListPlot[lst, Frame -> True, FrameLabel -> {Style["a", 16], Style["Integral", 16]}, GridLines -> ...

3

Here is another way that uses the Graphics object directly: gr = ParametricPlot3D[{Cos[u], Sin[u] + Cos[v], Sin[v]}, {u, 0, 2 Pi}, {v, -Pi, Pi}] We discretize the graphics using DiscretizeGraphics mr = DiscretizeGraphics[Normal[gr /. (Lighting -> _) :> Lighting -> Automatic]] We compute the convex hull hull = ...

1

If I use exact coefficients, I get an exact answer with Integrate after a couple of minutes: GE[Theta_, A_, B_] := CopulaDistribution[{"Binormal", Theta}, {ExponentialDistribution[A], ExponentialDistribution[B]}]; Delta = 4/100; A = 10/100; B = 10; Theta = 90/100; T = 5; GExpExp[x_, s_] := PDF[GE[Theta, A, B], {x, s}] ...

2

In Version 10, once the points have been obtained as per user21's approach, we can tetrahedralize them directly using DelaunayMesh pf = {Cos[u], Sin[u] + Cos[v], Sin[v]}; pp = ParametricPlot3D[pf, {u, 0, 2 Pi}, {v, -Pi, Pi}] data = Reap[ParametricPlot3D[Sow[pf], {u, 0, 2 Pi}, {v, -Pi, Pi}]][[2, 1]]; pts = Cases[data, {_?NumericQ, _?NumericQ, ...

0

LaplaceTransform attempts a symbolic evaluation of the transform, which Mathematica fails to do in this case. To get an answer, write the transform explicitly as an NIntegrate multiple integral. It still takes a while, but reducing the accuracy/precision demands will speed things up: chat = NIntegrate[ GumExpExp Exp[-Ab[s] x - Ar[s] y], {x, 0, ...

0

Mathematica 10 introduces something like listPart, with additional functionality, in Indexed: Indexed can be used to indicate components of symbolic vectors, matrices, tensors, etc. When expr is a list, Indexed[expr,i] gives expr[[i]]. When expr is a list, Indexed[expr,{i,j,...}] gives Indexed[expr[[i]],{j,...}]. Indexed can be used ...

2

In any attempt to debug a code - make it as simple as possible. Neither the For-loops nor the Export make things easier. Try to break things down - if I evaluate f[0.1, 0.1, 0.1, -1] I already get nonsense. One (!) of the problems is the definition of the function f, as you try to calculate the derivative for numerical parameters. Something along the line ...

1

I post this not as a specific answer but I think it may provide some insights. Experts and WRI would have to answer. The following will only work for positive valued functions (polygons breaking on x axis ->problems...remediable but I just post this as a quick insight). NIntegrate aims to provide best approximation within working precision. It seems there ...

1

not an answer but a neat trick to pull out the weights that are used: method = {"TrapezoidalRule", "Points" -> 2, "RombergQuadrature" -> False}; r = 2; integrate once to learn the values: xvals = Reap[i0=Quiet@NIntegrate[x^2, {x, 1, 5}, Method -> method, MaxRecursion -> r, EvaluationMonitor :> Sow[x]]] // Last // ...

2

Your assumption is wrong. The correct result is Integrate[x^2, {x, 5, 9}] 604/3 (201.333...) With TrapezoidalRule you can only approximate this result: NIntegrate[x^2, {x, 5, 9}, Method -> {"TrapezoidalRule", "Points" -> 3, "RombergQuadrature" -> False}, MaxRecursion -> 10, PrecisionGoal -> 6] 201.333

3

Mathematica 10 now supports the Finite Element Method for certain classes of PDEs. Documentation: Reference Detailed user guide Advanced documentation on FEM programming The FEM related functions are in NDSolveFEM and can be made directly accessible using Needs["NDSolveFEM"]

2

Your integral is very unlikely to exist in terms of elementary functions. In particular, it involves terms of the form $$\int\exp\left[-\frac12\sqrt{a\, \text{poly}(\xi)+b \xi^{0.998906}}\right]\text d\xi,$$ which is very unfriendly as regards symbolic integration. Note that in general symbolic integration is not possible; do you have some specific reason ...

0

with the fix, Integrate works, the trick is you need to Integrate for numerical values of t: (Primarily I'm posting this because i was surprised it works ) f[t_?NumericQ] := f[t] = Integrate[ ..., {x, 0, 5*10^-9}] I'm using ListPlot on a small table here so I can control exactly the points that get calculated -- This should work with Plot but I expect ...

2

Comment: I think you want D instead of Derivative. Also == instead of =. And you probably want the functions defined with patterns z_ etc. But there are errors that you'll have to address. (Or perhaps someone else.) ClearAll[φ, η, r, u]; φ[z_] = q*(1/z + (-1*q)/(-1*z)); η[z_] := k*(1/z + (-1*q)/(-1*z)); r[ρ_, z_] := Sqrt[ρ^2 + z^2]; pde = D[u[t, ρ, z], ...

6

Just consider the first integral. expr = x (A Ac (m2 + m1 (-1 + x)) + V Vc (m1 + m2 - m1 x))/(8 π^2 (-mh^2 (-1 + x) + (m2^2 + m1^2 (-1 + x)) x)); denominator = Collect[Denominator[expr], x] 8 mh^2 π^2 + 8 (-m1^2 + m2^2 - mh^2) π^2 x + 8 m1^2 π^2 x^2 It has two singular points. sol = Solve[denominator == 0, x] // Simplify If the singular ...

1

All of your integrals can be done with Integrate. These initial calculations are slow but by using Set rather than SetDelayed their subsequent use will be much quicker. You will also get better precision. Since you are comparing with experimental results presumably you satisfy the conditions suppressed by GenerateConditions -> False. If you want to see ...

3

The problem seems to be that the values are very small, smaller than can be represented by a machine numbers. Perhaps NIntegrate decides the answer is zero. You can use arbitrary-precision numbers, which you can do with the WorkingPrecision option, to get nonzero values. a2 = 525/10; u = 2*i - 1/2; u1 = u*Pi/2; u2 = u1/a2; u4 = -1/5^2; Table[NIntegrate[ ...

1

I have interpreted this question as per george2079s comment. I think this may a case of "asking too much" but I defer to numerical experts. Note: Manipulate[ Plot[Evaluate[ BesselJ[2, 2 x] BesselJ[2, us[[1]] x] x Exp[u4 x^2]], {x, 0, s}, PlotRange -> {-0.003, 0.003}], {s, {5, 10, 20, 30, 40, 50}}] Then testing for small upper limits (noting ...

0

Extended comment (this question will probably get closed as a duplicate in any case). As a (presumably) new user the best way to wean yourself of procedural constructs like For is to begin using Table. There are other ways to do things in Mathematica but the transition from For to Table is probably the easiest and most intuitive to begin with. In that ...

1

Assuming that if the integrand is complex we should take it to be zero, you can do this: uplim = 50; arg = If[Im@# > 0, 0, #] &@ N[2 Sqrt[z + 3/8 + 2^2]* Total@Table[((5^k)*Exp[-5])/(k!*Sqrt[2 \[Pi] 2^2])* Exp[-((z - k)^2)/(2 2^2)], {k, 0, uplim}] ]; Plot[arg, {z, -10, 20}] NIntegrate[arg, {z, -\[Infinity], \[Infinity]}] This ...

1

It cannot be real, since zunder the radical goes to minus infinity. Anyway, if you only need a numerical table, why do not you do something like this: f[y_, sig_, n_] := NIntegrate[ 2 Sqrt[z + 3/8 + sig^2]* Sum[((y^k)*Exp[-y])/(k!*Sqrt[2 \[Pi] sig^2])* Exp[-((z - k)^2)/(2 sig^2)], {k, 0, n}], {z, -\[Infinity], \[Infinity]}] Here nis ...

8

It's numeric integration. So it has no means of "knowing" the correct result is zero. In the process error estimates will be formed and if they are larger than the estimated result, this is a problem. But of course they must be larger since the actual result is zero. The way to tame this is to specify an AccuracyGoal that is attainable using the given ...

Top 50 recent answers are included