3

I have a student doing any investigation in to fractional number bases.
For example 10 in base (3/2) would be 2101.
We can do it manually but to generate enough data to investigate any patterns and other fractional number bases would anybody know how to automate generating the data in Excel, Python or an online applet?

Cliff
  • 143
  • 1
    What "data" do you need to generate? And what "patterns" are you looking for? –  Aug 23 '16 at 01:09
  • What digits are allowed in base $3/2$? How do you write $3$? Writing a spreadsheet or Python program that converts from base $3/2$ to base $10$ would not be hard. I don't see how to go the other way, so couldn't write such a program. – Ross Millikan Aug 23 '16 at 01:21
  • @RossMillikan The algorithm is always the same whatever the base $b > 1$ : with $a_0 = \lfloor x \rfloor , x_0 = x - \lfloor x \rfloor, a_{n+1} = \lfloor x_n b^{n+1} \rfloor$, $x_{n+1} = x_n-b^{-n} a_{n}$ then $x = \sum_{n=0}^\infty a_n b^{-n}$ – reuns Aug 23 '16 at 01:28
  • So how many unique characters are there in a base $\frac{3}{2}$ system? It looks like $3$. – Carser Aug 23 '16 at 01:31
  • @Carser in base $b$ there are $\lceil b\rceil$ characters – reuns Aug 23 '16 at 01:32
  • 1
    @user1952009 Hmmm, I can see why that makes sense, but the example given above of $10$ in base $3/2$ is 2101, which uses $3$ characters. I imagine this is a miscalculation... – Carser Aug 23 '16 at 01:35
  • Just out of curiosity I queried Wolfram Alpha. http://m.wolframalpha.com/input/?i=10+in+base+3%2F2&x=0&y=0 – John Molokach Aug 23 '16 at 02:27
  • @JohnMolokach it writes $10$ as $\sum_{n=-\infty}^m a_n (3/2)^n$ with $a_n \in {0,1}$, so it is the algorithm I wrote applied to $10 (3/2)^{-d}$ where $d = 5$ (such that $10 (3/2)^{-d} \in [0,3/2)$) and we have $10 (3/2)^{-5} = \frac{320}{243} = 1 + \frac{77}{243} =1 + \frac{2}{3}\frac{231}{486} =1 + \frac{2^2}{3^2}\frac{693}{972}=1 + \frac{2^3}{3^3}\frac{2049}{1944}$ $ = 1 + \frac{2^3}{3^3}(1+\frac{105}{1944}) \approx 1.001000 \ldots_{3/2}$ so that $10 \approx 100100.0 \ldots_{3/2}$ – reuns Aug 23 '16 at 02:44
  • @user1952009 very different from 2101. I think 2 should not be allowed as a digit in such a base. But since we are in rationals now, what's to keep a digit from being rational? It seems if you want a fractional base, you should allow a fractional 'digit' – John Molokach Aug 23 '16 at 02:48
  • 1
    @JohnMolokach of course $2101$ was wrong. And if you allow fractions for the digits, then you don't need base $b$ decomposition of rationals anymore – reuns Aug 23 '16 at 02:49
  • Here is a nice read. http://mathcentral.uregina.ca/QQ/database/QQ.09.09/h/nick1.html – John Molokach Aug 23 '16 at 02:54
  • Perimtted numbers are 0,1,2 . So 2101 = would be 2*(3/2)^3+(3/2)^1+(3/2)^0=10 in decimal. – Cliff Aug 23 '16 at 05:45
  • For example if the base was (5/4) then permitted numbers would be 0,1,2,3.4. then a decimal 10 could be represented as 430 as 4(5/4)^2+3(5/4)^1=10 – Cliff Aug 23 '16 at 05:56
  • If the base is a/b and a>b thenif we permit 0,1,2,3,4.....(a-1) then we should be able to uniquely represent any integer. – Cliff Aug 23 '16 at 06:00
  • @Cliff no, you can't even represent $\lceil p/q \rceil$ as $\sum_{n=0}^N a_n \frac{p^n}{q^n}$ with $a_n \in 0,\ldots,q-1$ (and $gcd(p,q) = 1$) – reuns Aug 23 '16 at 08:00
  • @user1952009, not sure what you mean ⌈5/2⌉ would be 2 which is expressible as 2(5/2)^0. With 0,1,2,3,4 as possible digits. ie. a_n is a member of 0,1,2,3...(p-1) and gcd(p,q)=1 – Cliff Aug 23 '16 at 10:12

1 Answers1

1

I don't think you need to generate much data to realize the problem with fractional number bases. Consider base $2.5$, illustrated here. Just by looking at the top diagram we can see that '$0.22$'$ > 1$. The number line is useful to us because it allows us to measure quantities - we divide it into units and then repeatedly subdivide each of them. Whereas the first division of unity in base $2.5$ yields $0.4$, the second yields $0.16$. Two of these latter subdivisions are greater than the 'resolution' of $2.5$ (i.e. half in base $2.5$, or $0.2$ in base $10$) so it doesn't necessarily help us attain finer resolution. Why not just use the resolution of $2.5$ as a subunit? This gives us base $5$, and as can be seen from the lower diagram multiples of second subdivisions will not 'spill over' to confuse our understanding of what 'number one' actually means (because by definition there can't be enough of them). See here for the formal proofs of these concepts.

EDIT1 This answer follows on from this reddit discussion. User Brightlinger claims that the above problem leads to non-unique representations for numbers in fractional bases and gives the example of $4$ in base $π$ (this is 'fractional' as in 'not an integer').

EDIT2 The following Python3 script allows a number to be represented in a chosen base. Both the number and the base can have decimal parts:

# fracbase.py
import sys, math

target = float(sys.argv[1])
base = float(sys.argv[2])


def decomp(tarnum, nbase):
    if nbase <= 1:
        return 'ERROR Base must be > 1'
    print('\nRepresenting', tarnum, 'in base', nbase, ' Log is', math.log(tarnum, nbase), '\n')
    powr = int(math.log(tarnum, nbase)) 
    rep = []
    while powr > -13:
        tnratio = tarnum / nbase**powr      
        rep.append(int(tnratio))  
        print('There are', tnratio, nbase, 'to the power of', powr, 'in', tarnum, 'so', rep)
        tarnum -= int(tnratio) * nbase**powr
        if tarnum == 0:
            if powr > 0:
                for i in range(powr):
                    rep.append(0)
            return rep
        if powr == 0:
            rep.append('.')
        powr -= 1        
    return rep


print(decomp(target, base))

Example session:
chrx@chrx:[tilde]/Desktop$ python3 fracbase.py 1001 10.4
The [tilde] means the tilde character.

  • I'll take a look once life is not so busy but I appreciate your post. Perhaps the original post irks some with a desire for uniqueness of the representation and would be better expressed as a question concerning a sum of powers of a rational number. The condition of the co-prime of p and q is also unnecessary if considered from my train of thought. – Cliff Mar 16 '17 at 12:00
  • @Cliff The desire for uniqueness shouldn't irk anyone, because that may be a reason fractional bases are not used. I think I'll write a script to look for examples of non-uniqueness in this context (other than those given on reddit) - will post it here. –  Mar 17 '17 at 06:58