# Questions tagged [precision-and-accuracy]

The tag has no usage guidance.

438 questions
Filter by
Sorted by
Tagged with
2answers
99 views

### Why is Mathematica's default precision only 16 digits? [closed]

I was performing some basic computations when I noticed that NumberForm[N[Zeta], {100, 100}] yields ...
0answers
24 views

### Conversion of numerics to/from database Real

I am writing data from MMA (11.0.1.0, Win 10 home 64 bit) to a Microsoft SQL Server/T-SQL database and am having considerable trouble controlling precision. The target column in the database has data ...
1answer
41 views

### Optimization of numerical integration

I would like to ask for a help from community in the numerical computation of an integral and in the preparation of a contour plot. I have already done some work in this direction, but everything is ...
2answers
80 views

### Getting error General::munfl from NonlinearModelFit [duplicate]

I am trying to fit data to a sum of Gaussians. This data is found in a file called lpeff.txt. So I write the following code: ...
1answer
35 views

### Selectively changing precision while leaving integers and rationals unchanged

I didn't find an answer to this question on the site, but as I was writing up my question, I figured out how to do it, so I thought I should post it and answer my own question so that others can ...
2answers
77 views

### Zeros of high degree polynomials

I am working with Hermite polynomials in Mathematica with the built-in function HermiteH. I want to compute the zeros of the polynomial ...
2answers
75 views

### Plotting with Precision

Suppose we plot Plot[ Exp[x]Exp[-x], {x,0,1000} ] This equals 1, as expected, until around x = 750 where the curve drops sharply to 0. Clearly this is due to ...
2answers
138 views

### Compute unstable integral with high precision

I want to calculate $$\int_{\mathbb{R}^n} e^{-t_1^4-t_2^4- ...-t_n^4-(1-t_1-t_2-...-t_n)^4} \text{d}t_1 \text{d}t_2 ... \text{d}t_n$$ with the highest possible n. I tried with ...
1answer
398 views

### Why does the PoissonDistribution not plot around its mean for moderate large numbers?

I plotted the Poisson Distribution for various mean values (plot label and vertical line). The plots does not peak around the mean as the mean increase. Any advice to get the right plot, or at least ...
0answers
48 views

### NDSove vs ParametricNDSolve

ParametricNDSolve is very practical when one has to execute NDSolve again and again. However is it equally accurate? I have not ...
2answers
150 views

### NMaximize not always returning solution

This question is related to a previous question and answer here: NMinimize or NMaximize for a dynamic problem but tackles a different problem. I am trying to solve a simple linear quadratic ...
0answers
62 views

### Numerical calculation Mathematica 11.2 / 11.3 / 12 [duplicate]

Please I do not understand why Mathematica 11.2 version evaluates numerically the value below Exp[-800]//N (* 3.667874584178*10^-348 *) while 11.3 and 12 ...
1answer
99 views

### How to make these operations occur faster?

How can I get this section of the code to solve this integration faster. I have rather large values but I don't need it to be too specific. However if I lower the precision it says the integration is ...
0answers
42 views

...
2answers
56 views

### Precision, accuracy and very large/small exponents with Reduce

Numerical precision/accuracy question here. I am currently working on solving nonlinear equations with Reduce. Oftentimes, ...
0answers
25 views

### NumberForm giving incorrect result [duplicate]

The definition of the NumberForm function is the following: "NumberForm[expr,n] prints with approximate real numbers in expr given to n-digit precision." However ...
2answers
76 views

### Solution to eigenvalue BVP using NDEigensystem to high precision

I'm trying to solve linear (non-self-adjoint) boundary-value problems to as high precision as possible (optimally 1e-15). For example, the below code solves for the first 5 eigenvalues of the harmonic ...
1answer
56 views

### Getting values of EllipticK with arguments that are very near 1

I need to evaluate EllipticK[m] very close to 1. However, when I get too close to 1 the function defaults to the exact solution for 1 , which is ...
1answer
84 views

### Compute the potential of confusion between two matrices

I have a problem. Any help will be appreciated. In order to calculate the accuracy, sensitivity, sensibility and F1 score between diseases and their symptoms, I have two matrices with a different ...
2answers
138 views

### How can I get high precision circle drawing in Graphics, across ten orders of magnitude

I need to visualize some fractal circle arrangements where tangent circles can vary by ten orders of magnitude. In such cases the circles are not being drawn as tangent. Example: The red and blue ...
0answers
47 views

### Why doesn't SetPrecision give me the precision I ask for? [duplicate]

I'm dealing with a problem requires a precision of 50 digitals after the decimal point. However, I got the following value when doing so: I don't know what's going on here, ain't it 0.09 with other ...
1answer
73 views

### Efficient Round edition with different rounding direction

As pointed out in this post, Mathematica has a special version of Round that Round rounds numbers of the form x.5 toward the nearest even integer. A comment by ...
1answer
117 views

### How to prevent Mathematica from giving inexact answers

Upon doing a simple subtraction 13.725 - 13.5 both Mathematica 11.3 and 12.0 beta version are giving me 0.22499999999999964 ...
1answer
193 views

### How to increase the accuracy of a plot

I have the following code below: ...
0answers
61 views

### Slight loss of precision when parsing JSON

Exporting to JSON is working well for me under 11.3. The issue present in previous versions seem to be solved: ...
2answers
414 views

### Using LinearSolve instead of Inverse does not give a good enough precision

If I want to calculate $B^{-1}A$, then instead of using Inverse, I should in theory just be able to use LinearSolve[B,A]. Now ...
1answer
53 views

### ContourPlot fails in a simple equation

I'm very new with Mathematica, and I'm struggling with a very simple problem. I want to plot this ...
1answer
62 views

### ContourPlot showing breaks in contours

I'm trying find graphically the solutions of the intersection of the following functions. ...
2answers
128 views

### Why is 0 vs 0.0 causing a precision problem?

I wasn't sure what to title this Question. I tried calculating different forms of a continued fraction, and I found that I get a correct result when I set d to 0 but a wrong result (in the final two ...
0answers
59 views

### Small positive machine number calculation in Mathematica 11.3

In Mathematica version < 11.3, any positive Machine‐Precision Numbers exceeding the range [$MinMachineNumber,$MaxMachineNumber...
7answers
1k views

### How to display very small numbers in Mathematica?

I am trying to evaluate the function: $$f(x) = \cos(x) - \mathrm{e}^{-2.7 x}$$ at $x = 1.7 \times 10^{-25}$ and Mathematica keeps returning '0.' How do I evaluate the expression in a better way?
1answer
98 views

### Problem with the Inverse CDF of Non-central F Ratio Distribution

In:= n = 5; n1 = 4; n2 = 6; γ = 0.05; α = 1/370; InverseCDF[NoncentralFRatioDistribution[1, n1 - 1, n1/γ^2], 1 - α - (n - n1)/n2] During evaluation of In...
2answers
189 views

### Catastrophic loss of accuracy in Orthogonalize

Context In connection to this question I am interested in orthogonalizing known matrices. As a test case, let us consider the definite positive $15 \times 15$ matrix ...
1answer
131 views

### Good practice about numerical precision

In one of my calculations, I get -1.11022*10^-16 as one of my eigenvalues for a matrix. It's essentially zero and I suppose I could use SetPrecision to make it zero but I wonder what's a good practice ...
1answer
63 views

### Increasing MaxExtraPrecision arbitrarily changes numerical result

I am trying to confirm that a function $f$ satisfies a particular differential equation of the type $D f=0$, for some differential operator $D$. I set $Df$ as Diffeq...
0answers
35 views

### Return the precision of the first non zero digit in a number for measurement error representation function

I'd like to return the precision of the first non zero digit in a number. The motivation is so that I can quickly construct my error notation which is the bracketed notation, e.g. $x = 1.234$ with ...
2answers
132 views

### How to avoid this type of change of digits in computed numbers?

Is there a way to avoid the digits being changed? ...
1answer
40 views

### Inaccuracy in Plot3D

This problem might be well-known - in this case, I would appreciate a link, because I could not find anything. My problem: A certain function (super long and nasty expression) needs to be plotted. ...
1answer
95 views

### Loss of accuracy in orthogonalisation of polynomials using Orthogonalize

Context As a mean to understand the growth of structure in the universe, I am interested in characterising the curvature of random fields such as this one: For this purpose I start with a PDF of the ...
0answers
40 views

### NIntegrate weird behaviour inside a function

I wrote this little function ...
0answers
45 views

### DensityPlot, ScalingFunctions, and small values

Edit: I figured out I can use Rescale to retrieve the plot as well as get the correct plot legend. I still can't figure out how to rescale the axes from 10^-9 to 1 ...
2answers
128 views

### Truncate a number in mathematica

I want to truncate a simple number to n decimal digits. For example, 2/3. I used f[x_, n_] := N[IntegerPart[x 10^n]/10^n] but I get ...
1answer
52 views

### Accuracy of function past 10^(-17)

I am trying to integrate an analytic function: ...
1answer
50 views

### How to get the correct result in a simple operation in Mathematica

I have the following values for x[[i]], y[[i]] and A[[i,j]]: ...
0answers
37 views

### Speed and precision with Inverse Laplace transform

I have a problem with an inverse Laplace transform that to me looks like a precision problem when computing with large/small numbers. Scientific background: I would like to compute how photons from a ...
1answer
54 views

### Performing a FindRoot from Numerical integration

I am trying to evaluate: FindRoot[Xfnew[γ, w, Hi, mx]*92*10^23*γ^(4/(1 + w)) == 1198/10000, {Hi, hs}, MaxIterations -> 10000] for some starting value hs,...
3answers
32 views

### Low precision from function returning matrix

Got a function depending on single parameter "t" defined below which returns a 2 by 2 matrix ...
2answers
79 views

### How to deal with the loss of significant digits in this expression with Fresnel integrals?

I needed to solve this integral: $$\int_1^\infty \frac{dx}{\sqrt{x}} \cos \left(a x-\frac{\pi}{4} \right) \cos \left(b x-\frac{\pi}{4} \right) \cos \left(c x-\frac{\pi}{4} \right)$$ Coming from ...