Questions tagged [number-representation]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
148 views

How to plot data that are already in scientific form? [duplicate]

I've got an array of data shown in scientific form. Which looks like this: x = {0.0001,ScientificForm[0.999890436521418]} Now I'm trying to use ListPlot to plot ...
1
vote
1answer
81 views

Calculating a 64-bit integer from 8 one-byte integers

I have 8 bytes expressed as integer values stored in a list. They correspond to a 64-bit counter with the lowest significant byte at first position. Here is an example what I am doing: ...
4
votes
2answers
95 views

StringTemplate does not respect NumberFormat

I am trying to write Latex report generator for my standard data analysis. But there is an issue with formatting numbers I can not get around. I would like to make use of my own ...
0
votes
1answer
64 views

How to switch a number back from AccountingForm? [closed]

I am working with a function that returns output in AccountingForm format. I would like to do math with that output, but Mathematica does not recognize it as ...
8
votes
1answer
189 views

Arbitrary-Precision Arithmetic behaves unexpectedly

I want to understand how small numerical errors propagate through a computation and may drastically change the final result. To this end, I consider a toy world in which every number is limited to ...
0
votes
1answer
175 views

How do I get Mathematica to write the coefficients of polynomial as fractions rather than decimal expansions? [duplicate]

I am trying to have Mathematica find the polynomial of degree $n$ in a single variable which fits the given points $(x_1,y_1),\dots, (x_{n+1},y_{n+1})$. In the examples I am concerned with, the ...
4
votes
3answers
196 views

find and count the number of solutions without multiplicity in Solve?

I would like to solve a Diophantine equation and find its solution, but I need only count one time for each $a$, i.e., when for some $a$ it found some $x,y,z$, then go to the next $a$. more precisely ...
4
votes
2answers
429 views

Representation of Rational Numbers

Following up on this question I would like to understand the way MMA represents rational numbers. First of all, as Carl Woll suggested, x/y is not a simple ...
11
votes
2answers
678 views

Understanding simple numerical calculation

I am trying to understand why N[0.1]//FullForm returns 0.1' (A). Indeed, $0.1$ in base two is $0.000110011001100110011...$. If I ...
4
votes
1answer
108 views

ExponentFunction not respected in NumberForm when typesetting zero?

Let's try to typeset a couple of numbers with a precision accuracy of 4: 0``4 1``4 1000000``4 I do not want the numbers returned with ...
3
votes
2answers
85 views

Dynamic Interpretation Button Label Loses Formatting on Copy and Paste

I have an Interpretation Button that displays its label correctly on evaluation. However, when I copy and paste it as input the ...
8
votes
3answers
410 views

How to format a number with an error?

I'm having a surprising amount of difficulty in trying to format some numbers with errors. I can't find any previous attempts to do this here or elsewhere and it would surely be of use to the ...
1
vote
1answer
197 views

Mathematica Input to get the exact form [duplicate]

Question: Is there a command in mathematica that can take a decimal input, and output it into its exact form? The question arose when I tried to use this command: ...
2
votes
1answer
109 views

Unexpected behavior from `NumberForm` of a matix [duplicate]

If I calculate the dimension of the matrix after NumberForm directly, then there will be something wrong ...
2
votes
2answers
163 views

Changing threshold for scientific notation from 10^6 so that InputField display is uniform

Related to but different from this question. I'd like my InputField to display scientific notation not only for numbers larger than one million, but also for ...
1
vote
1answer
69 views

e approximations [closed]

Can you help me? I'm writing program to calculate e with given percision (not using function from Mathematics) by using e=sum (1/k!) k=0 to infinity. I have this: ...
3
votes
3answers
188 views

Showing more decimals in number calculated in While loop

I'm new to Mathematica and am not sure why I cannot show more decimal points in a variable. I am using Newton's Method to find the zero's of a function and I'm trying to print the x value of the zero. ...
6
votes
1answer
144 views

Why 2^^1*^k does not work?

Table[2^^1*^k,{k,0,10}] This gives an error, why is that? Also this BaseForm[2 ** 1*^ #, 16] & /@ Range[10] What is ...
3
votes
0answers
139 views

Rationalize error

The docs state that "Rationalize[x,dx] yields the rational number with smallest denominator that lies within dx of x." However, testing this out it appears to be false. ...
0
votes
0answers
35 views

Copy-pasting a floating point number [duplicate]

Here is a behavior of the Mathematica front end which confuses me. Type N[Sqrt[2]] The displayed output is 1.41421 ...
10
votes
2answers
408 views

How to copy formatted numbers as MathML without quotation marks?

I have the following code: a = 6.08717*10^6; b = a/3; c = a*1.5; d = a^2; matrix={{a, b, c, d},{b, c, d, a},{c, d, a, b},{d, a, b, c}}; matrix // EngineeringForm ...
4
votes
1answer
162 views

How can I completely discard decimals after a set number of significant figures?

I have a number with a long decimal tail, like x=1.23456789789456123 and I would like to (i) keep the first $n$ significant figures, and (ii) completely discard ...
1
vote
2answers
225 views

How to round all the numbers in a function?

I have a complicated function that is a combination of floating-point numbers and variables. I want all the numbers rounded off, but I have no clue how to do this. For example I would want ...
0
votes
1answer
125 views

4-digit number, where $d_{1000} \lt d_{100} \lt d_{10}\lt d_{1}$ [closed]

I need to find all 4-digit numbers, where ones-number > tens-number > hundreds-number > thousands-number. 6789 is the highest possible such number and 1234 is the lowest. One solution is to write them ...
4
votes
0answers
123 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 ...
0
votes
1answer
185 views

NumberForm pesky warning from Manipulate

I'm using the NumberForm command inside a Manipulate environment, and in some special cases Mathematica gives a pesky and mostly useless warning message : NumberForm::sigz: In addition to the ...
1
vote
1answer
76 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, ...
2
votes
1answer
64 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: ...
1
vote
2answers
219 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
1answer
59 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 &) ...
0
votes
0answers
88 views

Maintaining working precision in my program

I am badly stuck with this program I am writing. I want output of program below to be precise up to 25 digits after decimal point. I am supplying all inputs with precision 25. But after each iteration ...
1
vote
1answer
70 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
3answers
272 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. ...
6
votes
1answer
282 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
100 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, ...
3
votes
1answer
86 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 ...
1
vote
1answer
255 views

Something wrong with FromDigits?

NestList[RotateLeft, IntegerDigits[19], 1] FromDigits[%] (* WRONG *) ...
0
votes
0answers
150 views

How to parse fraction to a number?

Considering a fraction: val = "F \!\(\*FractionBox[\(1\), \(1\)]\)"; I extract the part of interest: ...
2
votes
1answer
269 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 ...
12
votes
5answers
420 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 me:...
11
votes
2answers
759 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
0answers
76 views

How can I perfect this game for Wolfram Demonstration publication? [closed]

When the messages change the window inactivates, and when I try to host an interactive CDF on my site it turns red and says something about numbers having to be scaled or offset. Any help? I'm ...
0
votes
1answer
407 views

Why does my function return an expression rather than a number? [closed]

I feel like I'm going insane. I have a function $f(x)=e^{-x^2}$ which I need to evaluate using forward, backward and central first order finite differences with intervals ...
5
votes
3answers
850 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 ...
1
vote
2answers
143 views

Arithmetic on algebraic numbers

I'd like to perform some elementary operations on algebraic numbers. ...
5
votes
3answers
261 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 ...
1
vote
3answers
243 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 ...
2
votes
3answers
131 views

Testing for a vector of reals [closed]

Suppose I define: RealVector[expr_]:=VectorQ[expr,NumberQ[#]&&Head[#]===Real)]; Then: ...
23
votes
3answers
2k 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 ...
9
votes
3answers
1k 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: ...