Questions tagged [machine-precision]

For questions on the use of machine-precision real numbers (also known as floats), the numbers that can be directly manipulated through the underlying numerical capabilities of your computer system.

Filter by
Sorted by
Tagged with
0
votes
2answers
455 views

How to use Working Precision to get good result and plot?

I have a function f(x) which I would like to see going up for very low values of x: from an asymptotic study, I expect it to go to Infinity for low x; however, I can see an elbow and many oscillations....
0
votes
0answers
39 views

Unpredictable behavior of numerical error

A comparison of float calculation and exact expression for NumberForm[0.3^2 - (3/10)^2, 18] gives an exact zero for $0.3$. However, ...
3
votes
1answer
192 views

Precision of integers vs. Precision of floating numbers

It seems that Mathematica can handle very big integers accurately, but cannot do the same for floating numbers. See the following code: ...
12
votes
1answer
690 views

Why does 1 - Exp[-10.0^12] cause an out-of-memory error?

I would like to understand why evaluation of the expression 1 - Exp[-10.0^12] causes an out-of-memory error and how can I prevent such errors when calculating ...
0
votes
1answer
116 views

How to use a higher precision?

Below is my code. If I set W to $10^{55}$, it breaks down and the result is wrong. What do I need to do to use W as large as $10^{200}$? ...
1
vote
0answers
174 views

Treating a bad conditioned covariance matrix

I am trying to detect outliers in a big dataset using the Mahalanobys distance method. To calculate the Mahalanobys distance for a given vector $x$ from a mean vector $\mu$ you have to compute the ...
1
vote
0answers
130 views

Chop intermediate results of NDSolve after each step [closed]

Using NDSolve for a set of three ordinary differential equations, I ran into the problem that intermediate results quickly develop negligible imaginary parts. I get ...
8
votes
1answer
117 views

Unexpected behavior from CoordinateBoundingBoxArray with Into[1] and 0.41

I want to get the four corners of a Cuboid. This usually works: CoordinateBoundingBoxArray[{-{1., 1.}, {1., 1.}}, Into@1] gives ...
6
votes
1answer
103 views

Bug in floating-point number comparisons near $MachineEpsilon?

I stumbled over the following weird behavior when comparing floating-point numbers close to 1.0: qq = 1.0 + 60.0 $MachineEpsilon; and then ...
3
votes
1answer
107 views

Why does this rounding happen at machine precision?

Clearly, dividing by two in a binary number shifts the decimal point like this: BaseForm[InputForm[7], 2] BaseForm[InputForm[7/2 // N], 2] It gives: 2^^111 and 2^...
4
votes
1answer
357 views

What happens at the end of MachinePrecision? Is the remainder discarded or rounded?

What happens at the end of MachinePrecision? Is the remainder discarded or rounded? This code suggests it is discarded; is that conclusion correct? Why is it not rounded? ...
2
votes
1answer
104 views

Showing what happens with a number beyond machineprecision

I want to play around a bit in Mathematica to understand how floating-point precision, rounding and truncation actually works. I understand that Machineprecision is $2^{-52}$. First of all I would ...
3
votes
1answer
83 views

problem in matching two sets of particles

I have been trying to simulate a simple system in which there are two set of particles. One kind of particles are localized on the boundary of a circle (shown in purple below), whereas the second kind ...
7
votes
4answers
169 views

Definition of $MachineEpsilon

$MachineEpsilon x = 0.0000000000000001 % + 1 % - 1 As expected the final result equals zero, since x < MachineEpsilon ($2.22045\times10^{-16}$). However, if I ...
6
votes
1answer
183 views

ConvexHullMesh fails with small numbers

When I try to get the ConvexHullMesh of a List of points that are "small scale", I get errors: ...
4
votes
1answer
73 views

A simple syntax does not work

The code below does not work. Can anyone tell me why? Thanks! ...
6
votes
1answer
533 views

Machine-Precision and Arbitrary Precision [closed]

What is meant by a machine number in the Mathematica documentation? What is the difference between machine-precision and fixed-point precision? What is arbitrary precision?
4
votes
1answer
222 views

MachinePrecision versus $MachinePrecision in NDSolve

I'd like to understand why one of these inputs gives me an error and the other doesn't: ...
10
votes
2answers
863 views

Why is Mathematica destroying this graph?

Here I have a picture of a function I graphed: reg[x_,y_]:=(x^2+y^2)Cos[4ArcTan[y/x]]; Plot3D[reg[x,y],{x,-2,2},{y,-2,2},AxesLabel->Automatic] And here is ...
4
votes
2answers
768 views

How do I overcome an Overflow?

I'm trying to calculate entropies for an absolutely giant system by counting states, and this means I have to use some obscenely large numbers. I'm running ...
2
votes
1answer
374 views

Mathematica Precisions vs Doubles in C/C++

I'm having a bit of an issue regarding numerical precision and I'm not sure how to deal with it. I have a certain randomly generated matrix, say $M$, that I wish to compute the eigenvalues. The ...
4
votes
1answer
400 views

How to calculate accurate answer in Mathematica?

I accidentally discovered for myself, that Mathematica outputs inaccurate answer. For instance, if I take $\sin(2 \cdot \pi \cdot 0.5) = 0 $, then in Mathematica it is: But if I calculate it on site ...
3
votes
1answer
89 views

My NIntegrate expression returns a wildly inaccurate value

I am trying to integrate a function using NIntegrate: ...
2
votes
1answer
291 views

How to tell Mathematica to treat all numbers (including those in decimal form) as arbitrary precision numbers

I have code that is essentially numerical. It uses functions like NDSolve and NIntegrate. But in most interesting cases, the ...
10
votes
1answer
358 views

Plot of $\sin(x^x)$ is missing from $x=143$

When plotting the graph of $\sin(x^x)$ I noticed that there is no plot from about $x=143$. I don't suppose there is a purely mathematical explanation for this? So, why is there no graph in ...
4
votes
0answers
199 views

Classification problem using SVM methods

I am running SVM on mathematica and I a used this code with classes: ...
1
vote
1answer
90 views

Wrong Limit[…] for inexact expressions

I noticed that Limit can return nonsense when using inexact parameters. In the following code, a is my (exact/inexact) parameter,...
7
votes
1answer
223 views

Bug in ListPlot?

I want to check if this is a bug before I email WR about it. I can't get ListPlot[] to make scatter plots over a very small area: ...
5
votes
1answer
160 views

Compilation, square roots, and integers

After looking at this question, particularly this answer, I wrote my own performance test, using the two functions ...
11
votes
1answer
134 views

Abnormal behavior of RealDigits[x]

In the Details of the document of RealDigits writes the following line: RealDigits[x] normally returns a list of digits of ...
3
votes
2answers
106 views

Make mathematica “forget” numbers beyond the precision goal

I need Mathematica to remember only things upto two decimal places. I'm currently using the unwieldy Floor[x*100]/100 which works but is there a better way to ...
1
vote
1answer
474 views

How to increase the precision to get the correct roots at the boundaries?

I want to solve an equation and Plot a graph of $\delta(\tau)$, where $0<\tau,\delta<1$. In principal $\delta(0)=1,\delta(1)=0$. However, when I solve the equation, the points near $\tau=1$ can'...
2
votes
2answers
475 views

Export numeric data with preset decimal places

I have a table of pairs of numbers, each with 300 decimal places, which are all important. If saved using Export["data.dat", data] and then imported back via Import["data.dat"] - then the 300 decimal ...
0
votes
1answer
131 views

N, machine precision and expression evaluation [closed]

I should state that I am a Mathematica beginner but I checked the questions about machine vs arbitrary precision (such as: this one ) and I continue to have the following issue while trying to ...
8
votes
3answers
2k views

Machine precision near zero: not fulfilled?

I am puzzled by the behavior of Mathematica machine precision with numbers approaching zero. This manifests itself, e.g., with FixedPoint and the like. In the ...
1
vote
0answers
90 views

Odd plotting/math issue (could be a precision problem) [closed]

I've got a pretty odd error on a project I'm working on and was hoping to enlist some advice to fix it. The goal of this notebook is to show that I can eliminate the non-normalizable (blowing up part) ...
0
votes
2answers
87 views

Varying results from the Round function

My problem is simple. Consider the following. ...
2
votes
1answer
114 views

Floor inconsistent with Less for machine-precision approximate numbers

For machine-precision numbers, Mathematica uses a tolerance for comparisons, so that 1.-$MachineEpsilon==1. However, Floor does ...
6
votes
1answer
159 views

Can Someone Please Explain Internal`$SameQTolerance?

If I input Internal`$SameQTolerance (* output = 0.30103 *) which is the approximation of Log[10,2], or ...
2
votes
1answer
182 views

Precision of LinearModelFit with Polynomials

I have a Problem regarding the fit of given points with a polynomial up to the fifth degree. tableofvalues=Import["tableofvalues.csv"] My polynomial is: ...
16
votes
4answers
380 views

Does Mathematica have an equivalent of C's nextafter?

In C (and many other programming languages), there is a function double nextafter(double x, double y) which takes two (IEEE 754) floating-point numbers and ...
11
votes
2answers
747 views

Does Mathematica have an equivalent of Python's float.as_integer_ratio?

The Python programming language has a float.as_integer_ratio(x) function which exactly converts an IEEE 754 floating-point number into a numerator/denominator pair ...
1
vote
1answer
153 views

Why does it matter at what point I replace?

I need to find four orthogonal linear combinations of complicated functions, that vanish at four different points. I use (LK4 is defined below, but its shape should have nothing to do with my problem)...
11
votes
1answer
408 views

Compilation of Total with compensated summation

I sometimes obtain an unexpected error when trying to call a compiled version of Total with compensated summation turned on. More specifically I define ...
0
votes
1answer
153 views

Floating point arithmetic bug caused by Table[]

I was doing something fairly ordinary and noticed something I can't, for the life of me, explain. For context, I wanted to take make a function that takes an array of data like the one below, then an ...
2
votes
0answers
141 views

Enforcing WorkingPrecision in NIntegrate

I have a very complicated 2D integral that I need to calculate repeatedly, and I'm trying to speed it up a bit, since at the moment it's taking a couple of days to complete. One thing I've noticed is ...
23
votes
2answers
1k views

Different floating-point numbers equal?

Let's define two different numbers. x = 1. y = 1. + 2^-52 (* equivalently, 1 + $MachineEpsilon *) Let's make sure they're different with ...
3
votes
2answers
856 views

NIntegrate 2D highly oscillatory function

I am trying to integrate a function, and the error I get is greater than the result. So I need to calculate ...
6
votes
2answers
167 views

How can I make 1+$MachineEpsilon not look like 1?

I undarstand that 1+$MachineEpsilon is actually not equal 1. However, it persists to look like it was equal ...