Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [precision-and-accuracy]

2
votes
0answers
30 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: ...
4
votes
2answers
346 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 ...
0
votes
1answer
51 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 ...
0
votes
1answer
54 views

ContourPlot showing breaks in contours

I'm trying find graphically the solutions of the intersection of the following functions. ...
2
votes
2answers
94 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 ...
5
votes
0answers
38 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...
8
votes
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?
3
votes
1answer
86 views

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

In[3]:= 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[3]...
4
votes
1answer
80 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 x 15 matrix mat ...
0
votes
1answer
65 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 ...
0
votes
1answer
55 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...
0
votes
0answers
32 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 ...
1
vote
2answers
128 views

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

Is there a way to avoid the digits being changed? ...
0
votes
1answer
35 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. ...
5
votes
1answer
81 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 ...
0
votes
0answers
39 views

NIntegrate weird behaviour inside a function

I wrote this little function ...
0
votes
0answers
26 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 ...
1
vote
2answers
45 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 ...
1
vote
1answer
42 views

Accuracy of function past 10^(-17)

I am trying to integrate an analytic function: ...
0
votes
1answer
48 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]]: ...
0
votes
0answers
25 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 ...
1
vote
1answer
41 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,...
0
votes
3answers
30 views

Low precision from function returning matrix

Got a function depending on single parameter "t" defined below which returns a 2 by 2 matrix ...
0
votes
2answers
65 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 ...
2
votes
2answers
83 views

What's the smallest positive real allowed in mathematica?

This question may be a bit strange, but in this question, one of the answers suggests substituting some negatives values in a matrix by the smallest positive real number allowed. So, I was wondering ...
0
votes
1answer
40 views

Simple division with high precision in Mathematica [closed]

I want to do a simple division i.e. 0.70524/0.51824 . What I want is to find the result of the roundation of this division for precision from 1 to 19 decimal digits....
2
votes
1answer
59 views

Inaccurate zero eigenvalues for 7*7 matrix [closed]

I have symbolic entries for all the elements of a 7*7 matrix. At the symbolic level Eigenvalues gives two zeroes and five others that are extremely complicated. At ...
3
votes
1answer
47 views

Numerical precision problem

I have this simple code: ep = 1 - 80000000000 (-(199999/200000) + 1/E^(1/200000)) ep // N -8.27404*10^-8 ...
0
votes
0answers
38 views

Solving a system of linear equations in Mathematica regarding the errors of different methods

I have a system of equations, i.e. 0.62243x + 0.51824y = 0.70524 0.71497x + 0.59496y = 0.80996 I have 3 ways to solve this system (there are more but I am ...
0
votes
1answer
76 views

Problem with solving differential equation using NDSolve

I am trying to solve differential equations subject to condition z[0] == 0 and z[tmax] == 10 Pi. ...
0
votes
1answer
44 views

Formatting a list of values and dependent formatting of corresponding errors list

I am making a table of data that I wish to output using TeXForm. Rather than manipulate the values in LaTeX (e.g. using the ...
3
votes
1answer
58 views

NumberForm and Precision

With MachinePrecision this construction works as expected ...
0
votes
2answers
64 views

equal expressions give different numerical result

I have two expressions, and they are really equal: ...
2
votes
1answer
140 views

NIntegrate fails to converge

I am trying to compute this integral for different a with 0.0001<a<0.5, ...
7
votes
1answer
231 views

How does Mathematica determine when to use scientific notation?

I have code that takes an initial guess for a set of parameters to use in a function that I want to minimize, calculates the function, prints the value, recalculates new parameters via the gradient ...
7
votes
3answers
120 views

How to create an Interval object with specific end points?

When creating an Interval object, the end points are automatically widened when an end point is an inexact number. For instance: ...
14
votes
4answers
293 views

Terrible accuracy of DawsonF

DawsonF[30.] returns 0. The correct value is 0.016676... At least it prints a warning message, ...
1
vote
2answers
39 views

Diagnosing the numerical stability of a function

I have programmed a function f[x] that seems to be very unstable numerically. More precisely, I noticed that for certain arguments in arbitrary precision, the ...
3
votes
0answers
65 views

Arbitrary Precision, Nearly-Singular Matrices, and LinearSolve

I have been trying to solve a nonlinear eigenvalue problem, $\mathbf{M}(\lambda) \mathbf{v} = 0$, in Mathematica using Newton's method. The core of the algorithm relies upon an inverse iteration, ...
5
votes
2answers
124 views

Integrating a bivariate distribution over a region bounded by a straight line

Summary of problem: I'm using Mathematica version 8 to try to integrate the bivariate distribution over a region bounded by a straight line. The two random variables are uncorrelated. When I use ...
5
votes
1answer
63 views

DiscretePlot Giving Incorrect Answer

I know similar questions have been asked before about bugs in Integrate, but I'm not sure what the particular problem is here (and whether or not there is indeed a bug). When I perform the integral: ...
5
votes
2answers
334 views

Why does N not upgrade precision? [duplicate]

Precision[N[1.0, 20]] Precision[N[1, 20]] MachinePrecision 20. It would be so much more intuitive and less error prone, if <...
5
votes
2answers
92 views

Early vs. late application of arbitrary precision

The following arbitrary-precision computations, in which arbitrary precision is applied early (to the inputs), both work as expected: ...
0
votes
1answer
49 views

How to correct not precise values

I have the source file file = "test.txt" with these values: ...
0
votes
0answers
59 views

FullForm[1. - (0.3 + 0.4)] gives 0.30000000000000004` [duplicate]

I had a serious error propagation in my computations (Mathematica 10.4.1 Windows 64 bit). After some investigation, I realized the problem comes from something like this: FullForm[1. - (0.3 + 0.4)] ...
1
vote
2answers
70 views

Rounding numbers to certain numbers of significant figures

I have code which outputs numbers, for example,(0.2945847, 0.8647834, 1.6*10^-6) and similar. I would like to take these numbers and round them to 4 significant figures, but I can't find a way to do ...