Questions tagged [number-representation]
Questions about interpretation of numeric input or how Mathematica stores and manipulates numbers internally.
211
questions
3
votes
2
answers
174
views
Select a subset in the bit-strings with even 1s overlapped - thank you
Model 1
Consider the permutation list of 4-bit-strings:
list = Permutations[{0, 0, 1, 1}, {4}]
which outputs:
{{0, 0, 1, 1}, {0, 1, 0, 1}, {0, 1, 1, 0}, {1, 0, 0, ...
3
votes
5
answers
414
views
Convert integer to words of specific length
Assume we give the value from 1 to 26 to alphabets a,b,...,z.
Now given an integer ($n$) i like to generate words of specific length ($l$) that sum of them equals $n$. For instance, if
$n=10$, $l=3$;
<...
0
votes
0
answers
21
views
How to get back from CForm to ScientificForm? [duplicate]
Consider a number
number = 2.*10^20
It is in the representation of ScientificForm.
I convert it to C-form:
...
4
votes
0
answers
48
views
Why does an integer index inside a symbol become real when entering a ChebyshevT function with floating point arithmetic?
When I enter an indexed symbol into a ChebyshevT function with integer arithmetic like this:
ChebyshevT[1, 3 * a[4]]
I get the expected result:
...
0
votes
0
answers
51
views
Combining numbers with fractional powers together
I get lots of numerical answers that have integers raised to fractional powers multiplying each other.
A simple example:
2^(1/3) 3^(2/3)
which is of course 18^(1/3).
How do I get Mathematica to do ...
2
votes
2
answers
101
views
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 ...
0
votes
3
answers
87
views
How to separate surds or integers from mixed quadratic surds?
If I have a number of the form:
$$a + \sqrt{b}$$
How can I get $$a \text{ or } \sqrt{b}$$ by itself?
For example,
...
7
votes
3
answers
434
views
Since when does Mathematica have an 'Inf' symbol?
When I do:
...
9
votes
3
answers
956
views
Trace shows Linux has worse error than Windows in 1/(-1.)^1.2
So I questioned why there are differences between Wolfram Cloud and Windows 11 Evaluate $\int_{0}^{\pi/2} \cos^a (x)\sin(ax) dx$ using Mathematica
...
1
vote
0
answers
46
views
Printout precision [closed]
For debugging, I print out the SessionTime. In the Notebook it looks like:
...
1
vote
2
answers
108
views
How to make the output of ScientificForm computable
I am trying to extract the mantissas of a list of numbers using the ScientificForm and then do some operation on them. However, it seems that the output does not ...
2
votes
0
answers
87
views
On numbers with N digits after comma in Mathematica
Consider a table
tabb={{1.233546576,2.454546565},{22334.46687875465,6787233.3565665655}}
I want to convert it into a table where all the numbers are only with 4 ...
2
votes
1
answer
83
views
Defining function for decimal value k[0.5+0.5]
k[1 + 1] = 2;
k[1 + 0.5] = 1.5;
k[0.5 + 0.5] = 1;
{k[2], k[1.5], k[1]} // TableForm
2
1.5
k[1]
Can you explain this phenomenon? I think the output should be
...
1
vote
1
answer
82
views
Select primes from their Zeckendorf representation
I'm working with the Zeckendorf representation of prime numbers. I'm using
ResourceFunction["ZeckendorfRepresentation"][Prime[n]]
and I would like to select from all the results, the ones ...
1
vote
1
answer
65
views
Representing a number in r0 + r1 E + r2 E^2 form
Let E be the base of natural logarithm 2.71...
A Sequence S[n] is believed to converge to a ...
2
votes
3
answers
321
views
How to determine the unique combination of digits satisfying a given relation?
Is there a method to determine the unique combination of numbers a, b, c and d which satisfy the relation below, and which yields the output with the numbers in the given order. Example for 2023 is ...
1
vote
2
answers
124
views
Trying to apply numerical method with Do
I am trying the following scheme to learn to implement an iteration using Do loop. I tried to implement the same method using for loop but with same errors. I, therefore, turned to the Do loop to ...
-1
votes
2
answers
104
views
Calculate the value of a number as if it were represented in binary
I want to design a function that receives a number in binary, $110.11$ for example, and transform it to decimal.
I would like to transform it into a list: {1,1,0,1,1}. However I have a lot of problems ...
2
votes
2
answers
180
views
Writing the number '80668227' as a sums of 4 & 5 cubes
I need to write the number '80668227' as a sum of 4 & 5 cubes.
I tried this code PowersRepresentations[80668227, 4, 3] in Mathematica
but the above code is ...
9
votes
1
answer
315
views
IntegerPart - is this a known bug?
I'm working in Mathematica 13.0 and I type
a=0.00001;
IntegerPart[a/a]
and well, the output is 0.
Try with almost any other value of ...
1
vote
1
answer
101
views
Extracting powers of a sum
Given a sum in the form
Sum[n^k, {k, kl}]
for some natural n and natural list kl, is it ...
1
vote
0
answers
66
views
Extracting digits of a real number with RealDigits produces unexpected result
I have a list of real numbers, each of which has two decimal places. I'm trying to extract the second digit after the decimal point.
The function I'm using is ...
1
vote
3
answers
150
views
How can I get these decimals formatted properly?
It's nothing serious, but I was just wondering. I have a large number of floating point numbers which I write to a file. Mathematica writes each number with 17 decimal positions, which is way more ...
5
votes
1
answer
81
views
BarLegend with comma as NumberPoint
I'm having trouble in plotting a Barlegend with comma as decimal separator in Wolfram Mathematica 13.0.
I already tried to change the environment variables or to use ...
0
votes
0
answers
83
views
When there is decimal number in N[], how can ensure digits more than machine precision?
We know that
N[3/7,100]
will keep 100 digits after decimal point.
But
N[3.1/7,100]
will Keep only machine precision fewer ...
0
votes
1
answer
61
views
Check if a fraction leads to an integer, choose $r$ and run trough $0\le a\le n$ and go to $r+1$
Well, I am trying to do the following: I have two functions $y(r,a)$ and $z(r,a)$ and I want to check of the division of both those functions leads to an integer. In order to do that I want to choose ...
2
votes
2
answers
116
views
Finding IntegerPartitions[252] with no zero and no duplicates
Well, I am trying to execute the following code:
...
0
votes
0
answers
49
views
Alternative for PowerRepresentations[n, x, 1]
I am looking for numbers $n$ that can be written as the sum of other numbers. So: PowersRepresentations[n, x, 1]. But is there a faster way of finding these numbers?...
4
votes
3
answers
328
views
Checking if a number is right sorted
I have a number $n$ such that the digits of $n$ are strictly increasing to the left except for the first digit. So for example when $n=51369$ fits the bill because:
$$1<3<6<9\tag1$$
Is there ...
6
votes
2
answers
1k
views
How to force Mathematica to do infinite-precision calculations?
Consider the following calculation:
1234*5678*90.12
The result is:
6.31439*10^8
However, I want to get a precise result. Of ...
5
votes
8
answers
1k
views
Making the number 12345...n
Well, I am trying to write a code that makes the number:
$$123456\dots n\tag1$$
So, when $n=10$ we get:
$$12345678910$$
And when $n=15$ we get:
$$123456789101112131415$$
And when $n=4$ we get:
$$1234$$...
2
votes
1
answer
108
views
Get sign of unassigned variables
I want to find the signs of the following expression of unassigned variables:
a = x1 x2 - x3 x4;
The signs or prefactors are +1 ...
1
vote
0
answers
110
views
Implementing the Binary GCD algorithm in Mathematica
Well, I have $n\in\mathbb{N}$ and I want to transform $n$ to a binary number which can be done using FromDigits[IntegerDigits[n, 2]]. I want to compute the ...
1
vote
1
answer
86
views
Solving a system of equations using a list of possible solutions
Well, I have for example the following input and output of a code:
...
1
vote
1
answer
130
views
Parallel Mathematica-code that runs too slow when running PowerRepresentations[] function
Well, I am a student in elementary number theory and trying to find natural numbers that can be written as the sum of integers to the power of an integer. The code I am using now is the following:
<...
3
votes
1
answer
92
views
Removing a element from list when obeying a certain condition
Well, I have the following code:
Select[PowersRepresentations[n, a, b],
DuplicateFreeQ[#] && ! MemberQ[#, 0] &]
This code finds ...
3
votes
3
answers
272
views
Solving for a unique set of solutions
I have the following code:
...
1
vote
2
answers
105
views
Is there a function in Mathematica that saves the power of 10 of a number in scientific form?
I have a number for instance 0.0622.
I want to put it in ScientificForm so I do ...
1
vote
0
answers
109
views
How to Shape Text?
Imagine I have a certain number
23819657294172004194219023914217958273128471531429470113
If I convert it to a string with ...
1
vote
1
answer
333
views
How to express number in exponential decimal such as 1e2=100?
I am using MATLAB for a long time, and usually I express the number as exponential decimal such as
x = 1e2; % x=100
However, if I write this form in mathematica, ...
1
vote
1
answer
87
views
Extending NumberForm
I'd like to define a function, call it NumberF, that takes a real number n and two naturals l...
0
votes
1
answer
76
views
Conversion to expression in base 17 with particular needs
So, I am trying to write a function that takes a number between 0 and 1 in base 10 as input and gives a list of its decimal figures in it's expression in base 17. For example, $f(0.5)= \lbrace 8,8,8,8,...
1
vote
0
answers
70
views
How does this FromDigit module work?
I am entering the following input:
...
0
votes
1
answer
153
views
Exporting complex exponential float arrays to Python
A question related to a previous question. The answer in the previous question works well for simple complex arrays but not when considering arrays with exponential float coefficients as in the ...
1
vote
0
answers
44
views
Why does this reduce evaluate with exact numbers but not numbers specified to 20/50/200 decimals of precision?
Consider the following lines of code:
...
2
votes
0
answers
94
views
PaddedForm - DigitBlock only respected for non-padding
I'm trying to pad some binary and hexadecimal numbers using PaddedForm, and also to separate the digits into blocks of 4. For example, I'd like a number like ...
8
votes
0
answers
236
views
How would one add Hyperreals as a new type to Mathematica?
Hyperreals are an extension to the real numbers; they formalise the concepts of infinities and infinitestimals as numbers, rather than the named limit points outside of the system of reals and form ...
1
vote
1
answer
77
views
How to make StringCases to understand the scientific form of numbers?
Consider the string
string="Tau_distribution_mass=547.0_theta=6.87982e-05.txt";
I would like to make a row
...
1
vote
2
answers
126
views
How can I test if the sum of two divisors of a number add up to a perfect square? [closed]
Let's say I have a number $n$ and I want to find the divisors of $n$, I can do that using Divisors[n]. That will generate a list ...
0
votes
0
answers
101
views
How to copy and paste numbers with "`" mark and use them in calculations, without using N or setting precision every time
Suppose we have run a calculation and get a number like
2.758952615889003`
If we then copy-paste this number and do a calculation like
...