Questions about interpretation of numeric input or how Mathematica stores and manipulates numbers internally.

learn more… | top users | synonyms

50
votes
2answers
2k views

When I can assume that all decimal digits returned by Mathematica are provably correct?

How to Control the Precision and Accuracy of Numerical Results Arbitrary-Precision Numbers Mathematica works with exact numbers and with two different types of approximate numbers: ...
22
votes
3answers
717 views

Real Numbers in the Wolfram Language

Epilog: Much of the discussion in the answers below revolves around the distinction between Real as a data type and real numbers as a domain or class of numbers (irrespective of the form in which ...
19
votes
6answers
2k views

Formatting a fraction as a mixed number

Is there a command that will take a rational number and rewrite it in a mixed-number-like form? That is, I'd like to apply a command to something like 10/7 and get ...
16
votes
5answers
933 views

Is this the most efficient way to round approximate integers to integers while leaving other Reals untouched?

This might seem like an overly simple question, but I need to specify custom plot tick marks as integers (no trailing decimal point) if they are approximately integers, but not if they are not. Using ...
13
votes
4answers
3k views

How to implement Donald Knuth's up-arrow notation

How does one enter very large numbers in up-arrow notation? Up-arrow notation was created by Donald Knuth to write very large numbers in it iterated exponentiation form, for example 6↑↑3 = 6^6^6.
12
votes
1answer
8k views

Entering numbers in Scientific Notation?

I need to play with a lot of powers such as 10^-3. 1E-3 does not work for it. Is there any short form for it?
11
votes
5answers
242 views

Tidy form of numbers with errors using ScientificForm

Say I've computed something and got a number 0.02112398 with a computed error: 0.000331 Formatting it with ScientificForm[0.02112398 \[PlusMinus] 0.000331] gives ...
11
votes
1answer
781 views

Number format in Legend Labels

I would like to use the usual (new and nice) BarLegend[] with something like BarLegend[{"LakeColors", 1/10000 {-2, 2}}] which ...
9
votes
2answers
3k views

Convert a string to hex number?

How can I convert a string containing a hex number such as "6b" to a hex digit that mathematica can use to do math with? I have tried using ...
9
votes
3answers
933 views

Expression of uncertainty in measurement.

I have a problem with writing a Mathematica function. I have been requested to show the results of my experiments with the measurement uncertainty (mu) like below: ...
8
votes
4answers
2k views

How to plot logarithmic scales

How can a simple logarithmic number line be drawn between any 2 integer values? The closest function I found in the documentation is LogLinearPlot[] and I've ...
8
votes
1answer
2k views

How do I get Mathematica to show a number in non-exponential form? [duplicate]

Sometimes I make a calculation in Mathematica that produces a big number, which Mathematica shows like so: -1.52522*10^7 This is annoying to me, because I want ...
8
votes
1answer
242 views

Is it possible to lower the bitwidth of (floating point) numbers?

The answer to this question will most probably be a definite no. Nevertheless, I would like to know whether it is possible to represent reals in the memory on less than the standard 32 or 64 bits ...
7
votes
2answers
278 views

Mod[1.2, 0.2] is not equal to zero

Why doesn't the following expression evaluate to zero? In[1]:=Mod[1.2, 0.2] Out[1]=0.2 Edit: This is what I wanted to do: ...
6
votes
6answers
195 views

Join decimal part

I have a list of mesures that each vector is like {0,1,-2,259} but it should be like {0.1,-2.259} So I did a rule, like ...
6
votes
1answer
237 views

Machine Epsilon

I'm trying to evaluate the machine epsilon of my computer (see below). I wrote this: ...
5
votes
2answers
519 views

Fast Karatsuba Squaring, how to?

I want to improve timing of squaring for big numbers. So I asked What is the fastest way to split a number into parts and What is the most efficient way to add zeros to end of a number with several ...
5
votes
2answers
2k views

Converting numbers to integers

I've read the available documentation but I still haven't found an NumberForm -> Integer function yet. No result in this site's search, either. Does it exist? ...
5
votes
2answers
148 views

How to make pairs of Young diagrams appear?

I have the following Young diagrams {{{0}, {2}}, {{0}, {1, 1}}, {{1}, {1}}, {{2}, {0}}, {{1, 1}, {0}}} where you can interpret each pair as following: For ...
5
votes
2answers
149 views

Showing AlgebraicNumber[1/2 (1 + Sqrt[5]), {-3, 2}] in human-readable way

Is there a function to show algebraic numbers in Mathematica more conveniently? I am looking for something similar to MatrixForm for matrices. For example, I would like to view ...
5
votes
2answers
144 views

Display All Output Numbers in HEX

How might I modify Mathematica such that I can get the following functionality when working with HEX values. The odd lines are input and the even output. Red values should be the HEX values. ...
5
votes
0answers
152 views

NMinimize seems to call function with the same values multiple times

I have to minimize a function where the evaluation of one parameter set takes very long (around 5sec) and discovered alongside, that NMinimize seems to call this ...
4
votes
3answers
274 views

What is the FullForm of 36^^sadjh.87s567*^-34?

The Mathematica parser parses and computes number literals before sending them to FullForm even if Hold is applied. Thus the ...
4
votes
3answers
196 views

How can I improve NumberString?

I would like to test strings to see if they represent numbers. This should include number representations with precision marks and scientific notation. NumberString ...
4
votes
2answers
377 views

What is the most efficient way to add zeros to end of a number?

Beside *10^n, is there a faster way to add thousands of zeros to end of a number? Updated Timings: ...
4
votes
0answers
64 views

RealDigits and functional style

So while thinking about Replacing numbers of which you only know certain digits I have faced, again, a problem that I find hard to extract from RealDigits' output ...
3
votes
2answers
724 views

decompose a number (less than 255) in a sum of powers of 2

Is there a built in function that would take a number and decompose it into a sum of powers of 2? The numbers will be non negative less than 256. For what it's worth I'm trying to understand a paper ...
3
votes
3answers
352 views

Customizing decimal mark used in plot frame tick labels

I am using the Plot function in a usual way. I use Mathematica 9.0.1.0 in English (I do not know if it is available in other languages, but I do not mind), and as a ...
3
votes
2answers
678 views

hexList[[1]] returns a list of decimal numbers

Sorry for not being clear about this question earlier. I appreciate the answers I got, but the edits I made should make the question more understandable. I have been working with hex in ...
3
votes
1answer
109 views

Is there a `Real` equivalent to `FromDigits`?

One can extract an Integer's digits using IntegerDigits and reassemble them into the Integer ...
3
votes
2answers
554 views

Enter exact rational numbers easily with decimal notation

Is there a simple way to enter decimal numbers such as 0.123 so that Mathematica interprets it as an exact rational number 123/1000?
3
votes
2answers
519 views

Representation of negative exponents [duplicate]

Possible Duplicate: Way to improve “show me this decimal number to M places, don't use scientific notation”? How can I expand e.g. number 1.*10^-8 so that there would be no ...
2
votes
3answers
105 views

Testing for a vector of reals [closed]

Suppose I define: RealVector[expr_]:=VectorQ[expr,NumberQ[#]&&Head[#]===Real)]; Then: ...
2
votes
1answer
81 views

Range and decimal digits [duplicate]

When I set Plot[Sin[x], {x, -2, -1}, Frame -> True, Axes -> False, FrameTicks -> {{Automatic, Automatic}, {Range[-2, -1, 0.2], Automatic}}] I ...
2
votes
1answer
56 views

How to insert a character in a string with condition?

Considering we have a string: str = "1a 789 4/7 123/7 asff %$#7 478 9/4" How can I insert "/1" for the numbers that are ...
2
votes
1answer
87 views

Converting a quantity to a decimal form [closed]

I have a function giving me this: (5 Coulomb)/(6 Second) as output. I want this in decimal form and would like to have the variables taken off the end for unit ...
2
votes
1answer
34 views

Encoding/Decoding matrices as integers, integers as matrices [closed]

I want to convert large binary matrices of m x n dimensions into integers, and then to convert these integers to the original matrices. I attempted the following: ...
2
votes
2answers
100 views

How to interpret and show an input number with the amount of significant digits given?

what can I do to have Mathematica intepret and show a number with exactly the amount of digits I gave as an input? I have a larger talbe with numbers (text file, whitespace seperated) which are ...
1
vote
3answers
149 views

Making a replacement on the numerator and denominator of a rational number

It's isn't a big deal, but when I run the following I don't get the output I expect. After discussing this in the comments it appears it has to do with being an atomic expression. ...
1
vote
1answer
190 views

Something wrong with FromDigits?

NestList[RotateLeft, IntegerDigits[19], 1] FromDigits[%] (* WRONG *) ...
1
vote
2answers
93 views

Arithmetic on algebraic numbers

I'd like to perform some elementary operations on algebraic numbers. ...
1
vote
2answers
116 views

How to get the $0$ result for this limit?

Consider the following series: $$\sigma (\text{x$\_$})\text{:=}\sqrt{\sum _{k=0}^{x-1} \frac{(x! x!) (-1)^{x-k}}{(x-k) (k! (2 x-k)!)}+\frac{\pi ^2}{12}}$$ From the following codes, it seems that the ...
1
vote
3answers
117 views

Is there a global setting for number form

I'm creating strings which represent equations in C to use with library link. The problem I have is that numbers in ScientificForm are no longer useful after they ...
1
vote
1answer
60 views

Behaviour of RealDigits expected or wrong?

Is this behavior expected or a bug? RealDigits[10304.390456] {{1, 0, 3, 0, 4, 3, 9, 0, 4, 5, 5, 9, 9, 9, 9, 9}, 5} when I ...
1
vote
1answer
69 views

Calculations after NumberForm [duplicate]

As specified in documentation center the functions AccountingForm, NumberForm, etc. are useful only to display numbers in ...
1
vote
1answer
50 views

NumberLinePlot: How to make the 3rd list (c) appears with “black crosses” or “void circles”?

a = {1, 2, 5, 2} b = {2} c = {1.75, 2.88, 3.25} NumberLinePlot[{a, b, c}, PlotStyle -> Directive[PointSize[0.032]]] I thought about PlotMarkers or PlotStyle, ...
1
vote
1answer
267 views

create a function that converts a character string consisting of lowercase letters of the english alphabet to a number

I need a function that will take input as a string of lowercase letters and then output integers in this form a=01 b=02 c=03 d=04 e=05 . . . z=27 The letters must correspond with these integers ...
1
vote
1answer
1k views

Change number from real to integer [duplicate]

Possible Duplicate: Is this the most efficient way to round approximate integers to integers while leaving other Reals untouched? Please consider the following: ...
1
vote
1answer
59 views

How to refer a number in a list with two columns, first one is a number and the second one is empty? [closed]

Let's say, I have defined a list as list = {{-31, -31}, {52, }, {34, -11}, {-38, }, {78, -44}, {-36,14}, {-9, 98}, {33, 6}, {82, 99}, {-85, -10}} As you can see, ...
1
vote
1answer
50 views

Pattern that matches numbers in the $\epsilon$-neighborhood of a given number?

I dfined the following function to create a pattern that matches the $\epsilon$-neighborhood of a given number. ep[x_, e_] := _?(x - e <= # <= x + e &) ...