Questions tagged [number-representation]

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

Useful Links:

211 questions
82
votes
3 answers

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?
hhh
  • 2,603
  • 2
  • 19
  • 30
13
votes
4 answers

Test if number represents an integer

I can't figure out how to test if a number is an integer. I have found IntegerQ, but this function only checks if the type of the input is an integer, not whether the number it represents actually is one (IntegerQ[3.0] returns False). Element[3.0,…
mistercake
  • 241
  • 2
  • 4
8
votes
2 answers

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?
Jukka Suomela
  • 581
  • 4
  • 6
6
votes
6 answers

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 list/. {a_,b_,c_,d_}->{a.b,c.d} but for the positives number it works fine! but for vector like this one I get {0.1,(-2).239} how…
Kafkarudo
  • 619
  • 5
  • 9
6
votes
4 answers

How to format natural numbers so that they are 2 digits long?

I want to format all numbers from 1 to 50 so that they are all 2 digits long. desiredOutput={01,02,...,49,50} Digging through the documentation the NumberForm function looked promising. After trying many options and parameters I so far cannot…
Conor
  • 7,449
  • 1
  • 22
  • 46
5
votes
3 answers

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 full form of number literals is not accessible to the user. The FullForm of an expression is just whatever FullForm spits…
Robert Jacobson
  • 1,309
  • 11
  • 19
4
votes
1 answer

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

One can extract an Integer's digits using IntegerDigits and reassemble them into the Integer using FromDigits. Is there a function that reassembles the output of RealDigits into the Real?
CarbonFlambe
  • 1,234
  • 8
  • 13
4
votes
2 answers

number format with fixed total digit

How to get an output of number form of a given TOTAL digit? For example, a total digit of 3, then one get 1.00 for 1. 10.0 for 10. 100. for 100. and so on. I try NumberForm[1., 3] but only get 1.. Of course I can use NumberForm[1., {1, 2}] to get…
atoman
  • 147
  • 7
4
votes
1 answer

Change number from real to integer

Possible Duplicate: Is this the most efficient way to round approximate integers to integers while leaving other Reals untouched? Please consider the following: data={123.,56.,45.}; Head/@data (*result: {Real,Real,Real}*) How do I change the…
John
  • 4,361
  • 1
  • 26
  • 41
3
votes
1 answer

Number of digits problem

Why the following code Table[ N[i, 4], {i, 1, 2, 0.5}] do not output numbers with fixed number of digits, but gives this {1., 1.5, 2.} while there is no problems with this code Table[ N[i, 4], {i, 1, 2}] the output as expected is {1.000, 2.000}
3
votes
3 answers

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. f[x_] := Tan[x] - x/2; fp[x_] := -1/2 +…
2
votes
1 answer

Converting a quantity to a decimal form

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 analysis. How would I do this? I have tried NumberForm, but I think that the…
2
votes
2 answers

Period of repeating decimal

I came across of a 6-grader school problem to perform the following division 357.56/19. Pupils in the school understand that both numbers are numerically exact. I would like to introduce Mathematica to children. How can I explain them how to solve…
yarchik
  • 18,202
  • 2
  • 28
  • 66
2
votes
1 answer

Number with no decimal mark

I'm using Mathematica to create some images and labeling them after a simple calculation done previously. As the name of the file depends on the result, I want to show it with no decimal separator (because the "." can be a program as I'll use these…
Eduardo
  • 123
  • 4
2
votes
1 answer

Why N[vector[[j]]] or NumberForm[vector[[j]]] not working?

Why is N not giving the approximate result (removing the .)? vectorj = Table[j, {j, 0, 0.1, 0.01}] N[vectorj[[1]], 0] (*out=0.*) or N[vectorj, 0] or NumberForm[vectorj[[1]], 0] Rationalize does the job.
Andrea G
  • 759
  • 3
  • 19
1
2