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
139 views

Forcing divisions to be a machine-precision floating point divisions instead of multiplication by inverse

I want to imitate machine-precision, de facto IEEE division on Mathematica. On my quick trials I find this surprisingly hard to accomplish, since Mma rewrites a / b ...
kirma's user avatar
  • 18.7k
3 votes
1 answer
141 views

Numerical precision problem

I have this simple code: ep = 1 - 80000000000 (-(199999/200000) + 1/E^(1/200000)) ep // N -8.27404*10^-8 ...
Iosif Pinelis's user avatar
3 votes
1 answer
136 views

Copy-paste with annoying trailing 0s

When one copies an output containing machine-precision numbers to a input, many trailing 0s appears. For example : Evaluate the following expression : ...
andre314's user avatar
  • 17.8k
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 ...
romanovzky's user avatar
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 ...
oaroldan's user avatar
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 ...
Chien-Te Wu's user avatar
3 votes
1 answer
162 views

Why does precision decrease after increasing PrecisionGoal and WorkingPrecision on this integral?

I am trying to calculate a messy double-integral to many digits of precision. As shown below, the precision seems to increase reliably as WorkingPrecision goes from ...
WillG's user avatar
  • 854
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 ...
Ali Hashmi's user avatar
  • 8,900
3 votes
1 answer
136 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 ...
Joel Bosveld's user avatar
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: ...
Ramiro Magno's user avatar
3 votes
0 answers
258 views

How to deal with too small numbers

When dealing with a code that produces too small numbers (in a complicated way) like 0.33691 4.015757066049965*10^-330 I get the following warning General::munfl: ...
S. Euler's user avatar
  • 317
3 votes
0 answers
2k views

Set Global Maximum Precision

I'm sure this has been asked before, but I've looked around and can't figure it out: How do I set a global maximum precision for a notebook (or in general, globally)? I have a large notebook in ...
smörkex's user avatar
  • 625
2 votes
2 answers
177 views

Long run time for older code that ran fast in older versions

The following code block is in Trott's Guidebook for Programming. The associated notebook says that this and a few other routines ran in a matter of seconds. I killed it after half an hour. I am ...
NotAZombie's user avatar
2 votes
1 answer
453 views

Why would Evaluate[] in Plot give me warning about precision?

I have a code:- Plot[Evaluate@PDF[NormalDistribution[1.6, 0.2], x], {x, -6, 6}] And then I got the warning: ...
H42's user avatar
  • 3,439
2 votes
2 answers
254 views

How to prevent Mathematica from rounding some PDF values to 0?

Dear Mathematica community, I'm having a problem with the PDF function for the hypoexponential distribution. Specifically, Mathematica returns 0 as soon as the value is very small. Below is an example:...
user88652's user avatar
2 votes
1 answer
371 views

Why is arithmetic faster for inexact arithmetic?

I have been trying to compute eigenvalues of a rather sizable matrix A, about $500 \times 500$ (but sparse). I asked Mathematica to compute ...
Jakub Konieczny's user avatar
2 votes
2 answers
2k views

Error "is too small to represent as a normalized machine number; precision \ may be lost " for small values in Plot

I'm trying to plot two curves but I'm having issues with the lower end of the range: ...
Rodrigo's user avatar
  • 1,304
2 votes
1 answer
295 views

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

...
Daniel Berkowitz's user avatar
2 votes
2 answers
495 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 ...
Jerry Guern's user avatar
  • 4,553
2 votes
2 answers
431 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 ...
An old man in the sea.'s user avatar
2 votes
1 answer
526 views

How to use adaptive precision in matrix computations?

I wish to compute the pseudo inverse of rectangular (or square) matrices by the cubically method of Chebyshev given by $X_{k+1}=X_k(3I-AX_k(3I-AX_k))$ where $X_0=\frac{1}{\|A\|_F^2}A^*$. The procedure ...
Faz's user avatar
  • 1,817
2 votes
2 answers
1k views

FindRoot errors

I'm trying to solve a system of two equations in two variables for some range of parameter values. I use ContourPlot to see where I should look for a solutions and ...
Amatya's user avatar
  • 6,818
2 votes
3 answers
104 views

How to modify the given codes (NIntegrate of Boole) to get the most accurate result possible?

I have five conditions con1 to con5 over the two-dimensional domain $t,u\in[o,2\pi]$. I want to compute this area $(con1 \cap con2 )\cup(con3 \cap con4 \cap con5)$ numerically. I try the two codes ...
Martha97's user avatar
  • 349
2 votes
1 answer
180 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 ...
matheorem's user avatar
  • 17k
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 ...
Alex's user avatar
  • 755
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: ...
mcocdawc's user avatar
  • 451
2 votes
2 answers
745 views

'eps' equivalent in Mathematica

In MATLAB, there is a function named eps. eps Spacing of floating point numbers. D = eps(X), is the positive distance from ABS(X) to the next larger in ...
diverger's user avatar
  • 407
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 ...
MOON's user avatar
  • 3,834
2 votes
1 answer
857 views

How to Chop correctly?

I want to count degeneracies in a list called spectrum. The list contains numbers of double (~ 15digits) precision. So it makes no sense if the noise below this ...
pawel_winzig's user avatar
  • 1,567
2 votes
1 answer
171 views

Correct syntax for working precision in functions version 12

I just recently updated from version 11.2 -> 12...there apparently are quite a few changes since 11.2. $\unicode{952}\unicode{960}$ One being how version >11.3 deal with numbers that approach zero. ...
DrMrstheMonarch's user avatar
2 votes
2 answers
2k 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 ...
Alex's user avatar
  • 45
2 votes
1 answer
158 views

Working Precision warnings for ParametricPlot

I wish to plot a series of parametric curves for the following function called poly that has five parameters (Γ, ...
kowalski's user avatar
  • 385
2 votes
1 answer
155 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 ...
GambitSquared's user avatar
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 ...
QuantumDot's user avatar
  • 19.5k
2 votes
1 answer
140 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 ...
Ali Hashmi's user avatar
  • 8,900
2 votes
0 answers
33 views

Working Precision Slowing Down Numerical Integration Computation

...
Smithy's user avatar
  • 31
2 votes
0 answers
115 views

Generalizing technique to handle General::munfl error?

In contrast to earlier versions of Mathematica, in versions 11.3 and later Mathematica no longer switches to arbitrary precision when it detects a MachineNumber underflow. While this behavior is ...
Lauren Pearce's user avatar
2 votes
0 answers
1k views

General:: Exp[-717.401] is too small to represent as a normalized machine number; precision may be lost

I am solving pde. For the post processing bvp, there is solution given in output which is the solution from mathematica version 10.0.1. Output from above in mathematica 10.0.1 is, But when the similar ...
user75507's user avatar
2 votes
0 answers
54 views

Set Underflow precision in Mathematica 12 same as version 11.x [duplicate]

It seems like Mathematica version 12 sets arbitrary underflow precision depending on the function, but I would like the underflow precision to be same as what was for previous version of Mathematica ...
Indeterminate's user avatar
2 votes
0 answers
300 views

Printing Precision of Machine Numbers

Is Mathematica making the print precision rounding judgment more stringent based on whether or not the number is above or below the rounding target? If so, why? In my real case, I have many numbers ...
Chris Chiasson's user avatar
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 ...
Widjet's user avatar
  • 199
2 votes
1 answer
2k views

Plot periodic function from Dirac delta function [duplicate]

Sorry for my bad english. I need to plot periodic function from dirac delta: δT(t)=∑δ(t–n*T), where T - is a constant, and n=-20..20 And after them, plot new function fd=f(t)*δT(t) - discrete signal ...
Venzo's user avatar
  • 21
2 votes
0 answers
568 views

how to calculate with just double floating point precision [duplicate]

I want to calculate with simple double floating point precision. ...
user11523's user avatar
1 vote
1 answer
164 views

Performance Tuning - How can I make Mathematica to use less than certain digits number?

I would like to know if there is a way to make Mathematica to use at most certain digit number. For example, Suppose I want to calculate 2*Pi. x=N[Pi] y=2*x ...
Ricky the Confused's user avatar
1 vote
2 answers
154 views

MemberQ[{0.01, 0.05}, (0.01*9*2)/9/2] returns False

Multiplying and dividing by the same stuff seems to alter the value. Quite curiously, if the value you start from is large enough (greater than 0.05 in my case) you do not see the problem. Any idea ...
Rho Phi's user avatar
  • 1,410
1 vote
3 answers
136 views

When should one write integer numbers with a decimal?

I often see different solutions where users have taken advantage of how Mathematica handles numbers differently. I.e. when is it appropriate to use a decimal point in a calculation? Can someone ...
user27119's user avatar
  • 2,480
1 vote
1 answer
2k views

Adding precision for the calculation of a function

I have some function $f(x)$ I wish to evaluate, which is yielding divide-by-zero errors for sufficiently large inputs. How do I increase the precision with which this function is evaluated in order ...
Roger Harris's user avatar
  • 1,477
1 vote
4 answers
216 views

Can I change the default behavior so that "0.1" is interpreted as "1/10" automatically?

Consider the function f[a_] := NIntegrate[Sqrt[a + Log[x]], {x, 1, 10}, WorkingPrecision -> 30]. With this definition, I cannot call ...
WillG's user avatar
  • 854
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'...
an offer can't refuse's user avatar
1 vote
1 answer
66 views

Precision Issue with Log

I have the following codes. Naturally, I expect to get zero. I thought it is due to some possible issues stated as "Machine-precision inputs can give numerically wrong answers on branch cuts:". ...
yaykhel's user avatar
  • 171