PDA

View Full Version : How do you represent non-integer base numbers?



Davros
04-02-2004, 05:00 PM
Hi there,

Here's a maths one...

We are all used to base-n numbers, where n is an integer, i.e. binary, octal hex etc.

But how on Earth do you represent a number where n is non-integer. I.e. a number represented in the base of pi? I can understand the concept (well, I think), but how do you write down such a number? What symbols would you use? Can you represent it?

Cheers

undisputed007
04-02-2004, 05:45 PM
number vrepresented on base of PI
PI is not integer
I wish to ask you do you need to know how? .. i mean do you need that on a task or you just curious??

what i ve known that base 10 have been presented because when counting was discovered .. man started counting using his hand fingers where when we use computer and as a digital equipment it uses 0 and 1 so it's base 2
but i cant find an application used by making base(22/7)

the main problem facing us that what are the digits of PI on base16(Hexa) for example the digits are 0 1 2 3 4 5 6 7 8 9 A B C D E F and octal 0 1 2 3 4 5 6 7 and so on where the digits representing the number of base n are n-1 digits so what about base 3.14 is it going to be of 2.14 digits
it's not valid man

Thantos
04-02-2004, 05:57 PM
Simply put you couldn't display the number. Reason is because each base has n number of different symbols for each position. You wouldn't be able to have a partial symbol without creating a new symbol.

Lets say you wanted to have a PI base though. Well you could factor out the PI (in the number and in the base) and convert the remainder. So lets say I wanted to display 16 times pi in a 2 pi base.

well it would be: 10000(2pi)

joshdick
04-02-2004, 06:45 PM
Yeah, a base PI system might be convienent for representing multiples of PI, but it'd be really ugly for anything else.

Jez
04-03-2004, 07:48 AM
The place digits would work the same as any other system.

like this:

pi^3 pi^2 pi^1 pi^0 . pi^-1 pi^-2

Note the PICIMAL POINT !

The problem comes with the symbols chosen to represent each digit, because they would have to represent irrationals such that each digit x would be in the range 0<=x <= (pi-1).

So you would need an infinite uncountable number of symbols for each digit.

But if you have infinite precision for each digit, then you only need one to represent any number ! - so you get nowhere.

Really you should only need pi different types of digit - so if you must have descrete quantities you would have 4 symbols.

I propose these symbols.

0
1
2
P =pi-1

Using this system the number 120P.1

would be 1*pi^3 + 2*pi^2 + 0*pi^1 + (pi-1)*pi^0 + 1*pi^-1

= 31.006 + 19.739 + 0 + 2.142 + 0.318 (to 3 dp)

= 53.205 (approx)


the number pi would be simply

10 (of course)

The only problem that I can see (there may be others) is that for each number, there may be more than one representation - because we have 4 symbols for each digit rather than 3.14159.....

I think I'll stick to hex !

Anyone fancy writing a conversion program?

Convert Decimal to PINARY :D

Davros
04-03-2004, 09:13 AM
Thanks for the replies and to Jez.

>Anyone fancy writing a conversion program?

Well I'm thinking about it. But, still have no idea on how to represent such a conversion.

I found this in my travels, if anyone's interested. It describes representing binary in base 26 (i.e. A to Z) and the probabilities of finding any string (i.e. the Bible) somewhere within the digits of PI.

http://users.aol.com/s6sj7gt/picode.htm

Good stuff!

Thantos
04-05-2004, 10:11 AM
Well its not extremely accurate but its close enough. I tried all the standard methods of base conversions but the only one that didn't have the trouble of converting floats to ints was the subtraction method.


#include <stdio.h>
#include <stdlib.h>

#define PI 3.14159265358989323846

float getbase(float);

int main(void)
{
float base;
char out[50];
float num = 4;
int count=0, val=0, dec=0;

printf("%f in base 10 is equivlent to approximatly:\n", num);

base=getbase(num);

while ( count < 49 && num > 0.0 )
{
if ( base < 1.0 && dec == 0)
{
dec = 1;
out[count]='.';
count++;
}
val = 0;
while ( num >= base )
{
num -= base;
val ++;
}
out[count] = '0' + val;
base /= PI;
count++;
}


out[count]='\0';

printf("%s in base PI\n", out);


return 0;
}

float getbase(float limit)
{
float num=PI;

while ( num < limit )
num *= PI;

return num;
}

gcn_zelda
04-05-2004, 06:42 PM
What's the problem with using base 10 numbers? I love those...

So easy to use, no wonder they're number one...

Gah. AOL.

Davros
04-07-2004, 07:44 AM
>What's the problem with using base 10 numbers? I love those...

They're only easy because you were taught as a child to use them. If you were taught HEX or base 5, it would be just as natural.

In some cases, i.e. programming, it is easier to use a different base (i.e. HEX).

Likewise, in certain mathematical problems, it would be convenient (I guess) to use something more exotic, like base PI or base e. Well, I say 'I guess', but I'm not pouring over pages of equations myself at the moment, so can't think of a specific example.

Kinasz
04-07-2004, 09:27 AM
if your flying away from the earth at the speed of light and you switch on your headlights, what happens?

Clyde
04-07-2004, 09:48 AM
It takes you an infinite amount of time to switch them on.

-How is this on topic?

Zach L.
04-07-2004, 09:05 PM
Well, what you are really looking at with representing number in a base b is an infinite dimensional vector space over R generated by the multiplicative powers of the base, b, which is isomorphic to those generated by the powers of 10. So, certainly, you can write any number m = a[m] * b^m + a[m - 1] * b ^ (m - 1) + ... + a[1] * b + a[0] as long as the span of the set of multiplicative powers spans R (reals). It isn't entirely clear what symbols you'd want to use, however. For example, looking at base 10, take the number 35. We choose to represent this as 3 * 10 + 5, but it could equally well be written as 3.5 * 10 + 0. We choose to take our coefficients from the integer ring Z, where the basis lies.

As far as e and pi, neither of those are even algebraic over Q, so it stands to reason that trying to make sense of any basis made from these elements is not particularly easy (or even useful).

Thantos
04-07-2004, 09:14 PM
Sure sure, give me no love for my program

<cries>

Davros
04-08-2004, 07:56 AM
>As far as e and pi, neither of those are even algebraic over Q, so it stands to reason that trying to make sense of any basis made from these elements is not particularly easy (or even useful)

I see & take your point. Thanks.

Oh, and switching on head lights. You cannot travel at the speed of light. However, if you were travelling very close to the speed of light (but not actually at it), then I guess when you turn your head lights on, the light would travel away from you at the speed of light (as it always does). However, I don't think you would see much, cos anything that isn't moving close to your own speed will 'perceive' your headlight beams as gamma-rays.

Jez
04-08-2004, 01:09 PM
Well, what you are really looking at with representing number in a base b is an infinite dimensional vector space over R generated by the multiplicative powers of the base, b, which is isomorphic to those generated by the powers of 10. So, certainly, you can write any number m = a[m] * b^m + a[m - 1] * b ^ (m - 1) + ... + a[1] * b + a[0] as long as the span of the set of multiplicative powers spans R (reals).



Damn! I knew someone who knows what they're talking about would come and spoil our fun!