# Tag Info

4

This is an irritating bug that was introduced in V8 and has not been fixed even in the latest version (10.4.1) of Mathematica. Both f = FunctionInterpolation[N[1, 20] x, {x, 0, 1}] and g = FunctionInterpolation[N[1, 2] x, {x, 0, 1}] give a spate of error messages similar to ones you encountered. In both cases the functions returned appear to behave ...

2

I don't know of a built in method but the method below uses only a few lines of code to achieve this. toPrecision[x_?NumericQ, sigFigs_Integer?Positive] := Module[{y, sign, magnitudeShift}, sign = Sign@x; y = x sign; magnitudeShift = sigFigs - Ceiling@Log10@y; sign Round[y 10^magnitudeShift, 1] 10^-magnitudeShift ] This shifts the number so ...

6

The oddity in this case comes from NSum which is being called in a certain way from NIntegrate. This is a simple example that has roughly the same behavior (note in this case the exact result is known to be $\mp \ln 2$): NSum[(-1)^n/n, {n, 1, Infinity}, Method -> {"AlternatingSigns", Method -> "WynnEpsilon"}, WorkingPrecision -> 32] (* ...

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

Top 50 recent answers are included