New answers tagged

3

RandomVariate takes the option WorkingPrecision. Any residual artifact can be removed with Chop. testvector = RandomVariate[NormalDistribution[], 5, WorkingPrecision -> 20]; testunitvector = UnitVector[5, 1]; basisrotation = Transpose[RotationMatrix[{testunitvector, testvector}]]; Note that I corrected typo in definition of basisrotation output = ...


3

Short answer: One workaround is to use Method -> "LevinRule" instead. Long answer: As mentioned by Xavier in a comment above, changing BesselJ[0, x] to BesselJ[0, Re[x]] resolves the issue: NIntegrate[{1, -1} BesselJ[0, Re@x], {x, 0, ∞}, WorkingPrecision -> 32, Method -> "ExtrapolatingOscillatory"] Precision /@ % ...


1

This is just a long comment really. Out of curiosity, I compared the result of three packages: Mathematica, MATLAB and eig_sym from Armadillo (compiled on OS X). You said that your C++ code uses Armadillo. I get very close but not identical results: Mathematica MachinePrecision: {1.08568*10^15, -1.08568*10^15, 2.04979*10^13, 1.98037*10^13, ...


13

Numerics in Mathematica can be as precise as you like. However, precision comes at price; you pay for it in computation time and in additional coding effort. In Mathematica there are several computational classes of non-complex numbers, which form a tree like this. The computation you made was made with machine reals because you included 0.5 as a term. ...


1

I think that the function f in Mr. Wizard's answer linked above may be what you want. But let me ask you, when you say you want N[1/Sqrt[3], 1] which is 0.6, do you want that precision maintained throughout calculations? That is, if I enter 1/.6 it returns 1.66667 with a repeating decimal representation. But if I force the precision to be 1 on this ...



Top 50 recent answers are included