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
3 votes
1 answer
98 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
4 answers
351 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 ...
2 votes
2 answers
978 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 ...
6 votes
4 answers
3k views

Making a calculation with high precision

I would like to make the following calculation: 1/Sqrt[1 - (150^2 10^(-4))/(9 10^16.)] - 1 Mathematica 8 returns 0. The result is obviously not 0, but my ...
4 votes
1 answer
75 views

A simple syntax does not work

The code below does not work. Can anyone tell me why? Thanks! ...
6 votes
1 answer
290 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: ...
8 votes
1 answer
931 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?
16 votes
4 answers
456 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 ...
5 votes
1 answer
444 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: ...
3 votes
1 answer
3k views

How to change machineprecision digits

I am trying to compute t0: ...
10 votes
2 answers
927 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
2 answers
3k 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 ...
3 votes
1 answer
645 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
1 answer
460 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 ...
4 votes
1 answer
111 views

My NIntegrate expression returns a wildly inaccurate value

I am trying to integrate a function using NIntegrate: ...
2 votes
1 answer
362 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
2 answers
2k views

DeleteDuplicates[] does not work as expected on floating point values

Here is my simple example, and in this case function DeleteDuplicates does not work as expected. I want to FindRoot of my ...
10 votes
1 answer
395 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
0 answers
244 views

Classification problem using SVM methods

I am running SVM on mathematica and I a used this code with classes: ...
1 vote
1 answer
104 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
1 answer
268 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
1 answer
235 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
1 answer
143 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
2 answers
122 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
1 answer
569 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'...
17 votes
2 answers
343 views

CompiledFunction returns machine numbers smaller than $MinMachineNumber

When thinking on the workaround for this LogLogPlot bug suggested by halirutan I noticed that CompiledFunction actually can ...
0 votes
1 answer
146 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 ...
11 votes
1 answer
689 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 ...
1 vote
0 answers
102 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
2 answers
94 views

Varying results from the Round function

My problem is simple. Consider the following. ...
11 votes
2 answers
833 views

Dr. StrangeNumbers or: How I Learned to Stop Worrying and Love Floating Point Arithmetic

The following is the program. ...
3 votes
2 answers
332 views

WorkingPrecision causes issue in the NIntegrate

I really can't figure out why my code sometimes is not working. My integrals involve two variables (k and kz). The integration ...
10 votes
1 answer
310 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
1 answer
232 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: ...
5 votes
2 answers
905 views

How to make the computer consider two numbers equal up to a certain precision

My problem is that I have a matrix A and the computer says is not Hermitian (self-adjoint). Then I check which elements make A ...
26 votes
2 answers
2k 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 ...
1 vote
1 answer
165 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)...
2 votes
1 answer
295 views

How to stop Mathematica from turning .02 into 0.019999999999999997` [closed]

...
0 votes
1 answer
172 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
0 answers
161 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 ...
3 votes
2 answers
1k 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
1 answer
235 views

Machine precision infinity

Is it possible to obtain the machine precision (double) version of Infinity? This is useful when using LibraryLink and C ...
6 votes
0 answers
168 views

Can I force Mathematica to use machine precision? [duplicate]

Some built-in functions (like Exp) give an arbitrary precision result, even when the argument is a machine precision number. Example: ...
1 vote
0 answers
65 views

Which operations preserve digit precision?

Imagine I had to use numbers with a 600 precision digits. Do all mathematical operations, like +,-,...
3 votes
1 answer
522 views

Reasonable choice of MachinePrecision, AccuracyGoal and PrecisionGoal for NDSolve

I am trying to use this model for later use in FindFit: ...
2 votes
1 answer
1k views

How to increase significant digits in Mathematica

How can I increase the number of significant digits in Mathematica? When I import a matrix, an element like 112.5276 is rounded to 112.528. I would like to increase the number of significant digits ...
1 vote
2 answers
119 views

Decimal output from a simple equation

Let x= 0.0000000000000000036; y = 1 - x If i type this in Mathematica the answer of y is 1. I want the answer to be as it ...
4 votes
1 answer
176 views

How to map HoldForm?

I'm trying to compare between Sqrt[3.] and Sqrt[3]. To display the result, I mapped HoldForm to display the expressions on the left hand column (code at end), but it seems like Sqrt[3.] had been ...
9 votes
1 answer
167 views

Why am I getting wildly incorrect results from FirstPassageTimeDistribution with inexact transition matrix?

Working on some large systems using DiscreteMarkovProcess, I changed the transition matrix to machine precision vs using exact values, which sped things up handily. ...
0 votes
1 answer
90 views

Unexpected behavior of subtraction with approximate numbers [duplicate]

I'm using the Table command to generate a list of values: FullForm /@ Table[10. - x, {x, 2.7, 2.8, .1}] and I get the ...