![]() |
|
|
#1 |
|
Nov 2005
2·7·13 Posts |
f(x) = x*(x/2)*(x/4)*(x/8)*(x/16)*(x/32)*...*(x/a) ; x >= a >= x/2
f(0)=0 f(1)=1 f(2)=2 f(3)=3*1.5=4.5 f(4)=4*2=8 f(5)=5*2.5*1.25= f(6)=6*3*1.5= f(7)=7*3.5*1.75= f(8)=8*4*2=64 f(9)=9*4.5*2.25*1.125 f(10)=10*5*2.5*1.25= f(11)=11*5.5*2.25*1.125= f(12)=12*6*3*1.5=108 f(13)=13*6.5*3.25*1.625= f(14)=14*7*3.5*1.75= f(15)=15*7.5*3.75*1.875= f(16)=16*8*4*2=1024 If g(x)=ln f(x)/ln 2, every power of 2 for x gives 2^n times as large an answer as g of the previous power of 2. Represented in binary, the last term in the product (which is x/a) is just x right-shifted by one less than the position of the highest one bit in x. This makes f(x) and g(x) useful in finding the binary log of x. Otherwise these two are useless properties, but still interesting on their own. Hmm should I fill in the missing decimals later? A followup question: What are some optimized methods to calculate f(x) and g(x)? Are they any better than a shift and compare? Why/Why not? Yes, this is more of a programmer's thread. |
|
|
|
|
|
#2 |
|
Undefined
"The unspeakable one"
Jun 2006
My evil lair
22×1,549 Posts |
I have no idea what you are asking here but I think f(0)=undefined. The last term, x/a, gives 0/0
|
|
|
|
|
|
#3 |
|
Nov 2005
101101102 Posts |
f(0)=0 because there's no further way to reduce it. The value for a is not 0, it's 2^0=1.
x/a=0 works because 0/1=0 f(0)=(0/1) * no other values=0 f(1)=(1/1) * no other values=1 f(2)=(2/1)*(2/2)=2 I should have explained that better, hehe. The function is meant to lie between x^1 and x^x. There are literally an infinite number of functions that qualify for that description. x^1 and x^x are also known as the first and second hyperpowers of x. I believe the term commonly used is hypersquare for x^x. Since there are an infinite number of hyperpowers between 1 and 2, the statement is true. A hyperpower 4 of x for example: x^^4=x^(x^(x^x)) Note that there is not an exactly known solution for all hyperpowers. x^^2.442 would not have a trivial solution like x^^4 does. You have to use an numeric approximation. :/ Try this: You have x!! which is defined as x(x-2)(x-4)(x-6)(x-8)... You know that x! is always greater than or equal to x!!, for x being a positive integer, just by looking at the terms. Make other functions between x and x^x. f(x)=x^2, f(x)=x^(x-1), etc. |
|
|
|
|
|
#4 | ||
|
Undefined
"The unspeakable one"
Jun 2006
My evil lair
183416 Posts |
Quote:
Quote:
|
||
|
|
|
|
|
#5 |
|
Nov 2005
2·7·13 Posts |
I see what you mean, but I should have qualified it by saying that it's possible to not divide by 'a' at all. To be more specific in programmer's terms, this 'loop' must not run the first time if 'x <= 1' is true. I really need to be careful when glossing over something like that. Sorry about that!
I believe this code snippet would make things clearer if you know some C/C++ as it's just a conditional loop: workValue = x; returnValue = x; a = 1; if(x > 1) while ((workValue <= 1) && (workValue > 0)){ workValue = workValue/(2^a); // Could use x >> a but it usually only supports integers. This is by design. returnValue = returnValue * workValue; a++; } Last fiddled with by nibble4bits on 2008-01-22 at 00:43 |
|
|
|