Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am wondering, what would happen to the representation of a number like 2 in base pi? I know that things like $π^2$ would simply be 100 (right?), but what about numbers that are not of the form $a*π^n$ ? I think it ought to get tricky!

share|improve this question
1  
Wouldn't $\pi^2=100$? $4=2^2=100$ in base 2 –  Eleven-Eleven Feb 16 at 17:37
2  
Also I don't think our integers, base 10 could be represented in base $\pi$ since the integers are rational and $\pi^n, n \in \mathbb{Z}$ are irrational... –  Eleven-Eleven Feb 16 at 17:39
    
Yes Eleven-Eleven you are right! I will edit it. –  Just_a_fool Feb 16 at 17:42
    
Just a blind shot: 2 would be irrational in base π –  Francisco Presencia Feb 17 at 0:12

2 Answers 2

It's not enough to just say "base $\pi$" - the concept isn't really defined until you specify what the digits are allowed to be. What seems to me to be the only reasonable option is to say that digits can be anything within $[0,\pi)$, but this then makes representing anything trivial, because for any $a>0$, $$\Large \begin{align*} a&=\pi^{\log_\pi(a)}=\pi^{\lfloor\log_\pi(a)\rfloor}\underbrace{\pi^{\log_\pi(a)-\lfloor\log_\pi(a)\rfloor}}_{\text{between 0 and }\pi}\\\\\\ &=\pi^{\log_\pi(a)-\lfloor\log_\pi(a)\rfloor}\underbrace{00\ldots0}_{\lfloor\log_\pi(a)-1\rfloor}\text{ in base }\pi \end{align*}$$ So the representation of $2$ in base $\pi$ under this approach would just be $2$ (because $1<2<\pi$), while the representation of $4$ would be $\frac{4}{\pi}0$ (because $\pi<4<\pi^2$).

share|improve this answer
    
You're right, when you take the concept to its logical conclusion it makes no sense at all! –  TooTone Feb 16 at 18:09

See here for formal definition of representation in a non integral base. With such a definition $2$ in base $\pi$ is simply... $2$. This because $2<\pi$ hence it can be represented by itself.

Here is an algorithm (written in python) to compute the representation in any base:

from math import *
import string

def repr(x,b,digits=30):
    """ represent @x in base @b """
    DIGITS = string.digits + string.ascii_uppercase
    n = int(floor(log(x) / log(b)))
    r = ''
    while n>0 or (len(r)<digits and x != 0.0):
        d = int(x/b**n)
        if n==-1:
            r += '.'
        r += DIGITS[d]
        x = x - d * b**n
        n -= 1
    if r=='':
        r= DIGITS[0]
    return r

for x,b in [(1973.0,10), (8.0,2), (10.0,pi)]:
    print x, 'in base', b, 'is written:', repr(x,b)

The output is:

1973.0 in base 10 is written: 1973
8.0 in base 2 is written: 100
10.0 in base 3.14159265359 is written: 100.01022122221121122001111210
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.