New answers tagged

0

I think this integral can be done analytically. I have ignored the 0.001 term as I suspect this is merely intended to improve the numerical behaviour. Assuming[a > 0, Integrate[w E^(-w/a) Sin[(w) 100000]/((w)^2), {w, 0, Infinity}]] gives the value ArcTan[100000 a]


0

Assuming principal value: Block[{a = 0.001, w0 = 0.001}, NIntegrate[ w E^(-w/a) Sin[(w - w0) 100000]/((w - w0)^2), {w, 0, w0, ∞}, MaxRecursion -> 20, AccuracyGoal -> 10, Method -> "PrincipalValue"] ] (* -0.000052312 *) Check (seems stable with increased precision): Block[{a = 0.001 // Rationalize, w0 = 0.001 // Rationalize}, ...


0

I generate some test data. SeedRandom[42]; data1 = RandomReal[100., {5, 4, 3}]; ByteCount @ data1 600 Then I calculate what I think you want. m = Max @ data1 99.6966 Scale and reorder the data. data2 = Transpose[data1/m, {3, 2, 1}] ByteCount @ data2 600 I think data2 would all you need to make further computations in Mathematica, ...


6

This is not an answer. But I don't believe we should close this question as "easily found in the documentation". Numerics in Mathematica is an extremely complicated and mostly undocumented subject, where several mathematical concepts run up against each other in subtle and non-trivial ways. I have been thinking for some time that we ought to address this ...


4

Here is a short demo. Generate the Dottie number as an exact Root[] object, like so: dottie = x /. First @ Solve[x == Cos[x] && 0 < x < 1, x]; (Tho you might notice an inexact number in the output, rest assured that the resulting Root[] object is an exact number that can be evaluated to arbitrary precision; the number is there only as a sort ...


5

mat[x_?NumberQ] := {{x^2, 1, 0}, {1, x^2, -1}, {0, -1, x}} ei[x_] := Eigensystem[mat[x], 1, Method -> {"Arnoldi", "Criteria" -> "RealPart"}][[1, 1]] NIntegrate[ei[x], {x, 0, 4}] (* 8. *)


2

I think that the imaginary component is a rounding error. Try N[exp, 40] and the imaginary part is returned as zero. ADDED If evaluated to sufficient significant figures, we see that the expressions given above all have an imaginary part indistinguishable from zero. N[exp // Simplify, 40] N[exp // ExpandAll, 40] N[exp // ExpToTrig, 100] N[exp // ...


7

Because NIntegrate evaluates the integrands before starting the actual integration, in some cases (like this one) it is better to define the integrand function F with the signature F[x_?NumericQ]. BF[n_?NumericQ, x_?NumericQ] := BesselJ[n, x] NIntegrate[BF[9/2, x], {x, 0, 1}] (* 0.000148473 *) Integrate[BesselJ[9/2, x], {x, 0, 1}] %% // N (* Sqrt[2/\[...


2

I tried to make it a comment and then can't control the words. I think the problem is arising from the fact that the value of the function and its derivative is too small to near x=0. Plot[BesselJ[9/2, x], {x, 0, .01}] Plot[Evaluate[D[BesselJ[9/2, x], x]], {x, 0, 0.01}] As you can see the derivative is highly oscillatory at this small range. When ...


1

While not being a Mathematica expert, I assume that everything works as expected: your 1.1 "actually is" 1.1000000000000000888 since it is probably stored with a binary form in the IEEE754 standard (count the number of exact decimal digits and remember that IEEE754 standard with double-precision type has 15/16 exact decimal digits). See http://mathworld....


3

What you are seeing can be traced back to the behavior of DistributeDefinitions which is used internally by ParallelTable. DistributeDefinitions seems to have some way to determine which of its argument should in fact be distributed [1]. If the value of a variable is unchanged, it will do nothing. Consider the following snippet, for example: a1 = ...



Top 50 recent answers are included