Axe Power Axe!

If X X = 55 X^X=55 then find the approximate value of X X upto 6 decimal place.

Hint : Guess the possible range of the X X , it will accelerate the speed of the Program Runtime .


The answer is 3.330652.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

4 solutions

Chew-Seong Cheong
Oct 25, 2015

From x x = 55 x ln x = ln 55 \space x^x = 55 \quad \Rightarrow x\ln x = \ln 55 .

By Newton's method, we have: x n + 1 = x n f ( x n ) f ( x n ) \space x_{n+1} = x_n - \dfrac{f(x_n)}{f'(x_n)} .

Let f ( x ) = x ln x ln 55 f ( x ) = ln x + 1 f(x) = x\ln x - \ln 55\quad \Rightarrow f'(x) = \ln x + 1 .

Using the following Excel spreadsheet, we found that x = 3.330651551 x = \boxed{3.330651551} .

Sir, that's the real mathematician's solution!

Upvote with a salute!

Muhammad Arifur Rahman - 5 years, 7 months ago

Using Matlab & Bisection method, I got 3.322327. When I entered the solution, it was accepted as a correct answer too. So how are our solutions so different?

Harish Sasikumar - 5 years, 7 months ago

Log in to reply

According to Excel spreadsheet 3.32232 7 3.322327 = 54.00103498 3.322327^{3.322327}=54.00103498 . Same result with Wolfram Alpha too (see here ).

Chew-Seong Cheong - 5 years, 7 months ago

Log in to reply

You are correct. The error is shown to be -0.999. But somehow the expected answer is also 3.322327 (which is wrong). So I think, the guy who provided the solution also used bisection method, which is giving the same wrong answer (probably due to some stability issues).

Harish Sasikumar - 5 years, 7 months ago

Log in to reply

@Harish Sasikumar You are right estimating directly from x x = 55 x^x = 55 , may not converge ( Δ x 0 \Delta x \to 0 ) as well as using x ln x = ln 55 x\ln x = \ln 55 . In this example, it takes only 4 iterations to reach 16-figure accuracy used in Excel. You may try using x ln x = ln 55 x\ln x = \ln 55 in MathLab and see if you get the same result.

Chew-Seong Cheong - 5 years, 7 months ago

这个是一个数本身平方么?因为我用数学方法解出大约是7.416,你的这个答案乘出来和55差很远啊。求解释

Zhaochen Xie - 5 years, 7 months ago

Log in to reply

x x x^x x x x x 的幂数而不是平方数 x x x 2 x^x \ne x^2 ,例如: x = 1 , 2 , 3 , 4 , 5... x x = 1 1 , 2 2 , 3 3 , 4 4 , 5 5 . . . x=1,2,3,4,5... \quad \Rightarrow x^x = 1^1, 2^2, 3^3, 4^4, 5^5... 。因为 3 3 = 27 < 55 3^3 = 27 < 55 4 4 = 256 > 55 4^4 = 256 > 55 所以 3 < x < 4 3 < x < 4

Chew-Seong Cheong - 5 years, 7 months ago

Log in to reply

啊懂了,O(∩_∩)O谢谢

Zhaochen Xie - 5 years, 7 months ago
Ivan Koswara
Oct 25, 2015

Because Brilliant's floating point answer only cares about three significant digits, the fact that the problem asks for 6 decimal places is irrelevant. I simply brute-forced it. We know the answer is somewhere between 3 3 and 4 4 (because 3 3 = 27 < 55 < 256 = 4 4 3^3 = 27 < 55 < 256 = 4^4 ), and that x x x x \mapsto x^x is strictly increasing for x 1 x \ge 1 , so:

1
2
3
4
5
for i in range(300, 400): # 3.00 <= i/100 <= 3.99
    if 55 < (i/100) ** (i/100): # the first i/100 to cross 55
        print(i/100)
        break
# prints 3.34

That's why, whenever you want to force computation to a specific precision, you ask for something like 1 0 precision answer \lfloor 10^\text{precision} \cdot \text{answer} \rfloor instead. A better method that doesn't abuse Brilliant's way of handling floating point answers is given by Chew-Seong Cheong.

Bill Bell
Oct 19, 2015

Using the Python sympy module:

1
2
3
4
5
6
7
>>> from sympy import *
>>> var('x')
x
>>> solve(x**x-55)
[exp(LambertW(log(55)))]
>>> N(_[0])
3.33065155117834

Using the Python scipy module:

1
2
3
4
5
from scipy.optimize import bisect

f=lambda x:x**x-55

print bisect(f,3,4)

We can do this easily by approximation. :D

Nihar Mahajan - 5 years, 7 months ago

Log in to reply

bisect is an implementation of the bisection algorithm, which must be about the simplest approximation algorithm there is for this situation. Programmers do not re-invent the wheel.

Bill Bell - 5 years, 7 months ago

Log in to reply

Exactly. Programmers don't reinvent the CIRCULAR SHAPED LOOPS.

Muhammad Arifur Rahman - 5 years, 7 months ago

I don't know computer science at all. I used approximation in number theory, 3 3 < 55 < 4 4 3^3<55<4^4 i.e 27 < 55 < 256 27<55<256 . so we have 3 < x < 3.5 3<x<3.5 .

Nihar Mahajan - 5 years, 7 months ago

Log in to reply

@Nihar Mahajan Oh, I see. Anyway, what's funny is that bisection was probably known to the ancients — on all continents.

Bill Bell - 5 years, 7 months ago

Here 's a C++ implementation of the same bisection algorithm (I don't know if there exists an inbuilt C++ function to use bisection method, so I just had to write it manually).

The easiest way to implement this is by using recursion, I guess, as I did in my code.

Prasun Biswas - 5 years, 7 months ago

Log in to reply

One place to look for code is rosettacode.org. Bisection for C++ is available at Bisection for C++ .

Bill Bell - 5 years, 7 months ago

Excellently detailed solution. Can you make a Paste and share the download link of this Python program so that people will find it more helpful.

Muhammad Arifur Rahman - 5 years, 7 months ago

Log in to reply

Thank you!

Python is a computer language that many people find easy to learn, yet it is quite powerful. I use the Windows version at Active Python . It's important to get the 32-bit Python 2.7 version because many products such as scipy have not been adapted for Python 3. sympy has everything you need to get started with this symbolic algebra system which works with Python. scipy is great for scientific calculations, such as the bisection algorithm I used in the second example.

Bill Bell - 5 years, 7 months ago

Log in to reply

Thanks again for this nice explanation and Guidelines. I've Upvoted your solution.

BTW, how proficient are you in C Programming?

Muhammad Arifur Rahman - 5 years, 7 months ago

Log in to reply

@Muhammad Arifur Rahman Not at all. I haven't used it for approximately ten years and would have to reacquaint myself with it.

Bill Bell - 5 years, 7 months ago

Log in to reply

@Bill Bell So you perform all with Python. Are you a problem solver, or app developer also?

Muhammad Arifur Rahman - 5 years, 7 months ago

Log in to reply

@Muhammad Arifur Rahman I'm retired! I did many kinds of things during my working life. Developing, modifying, supervising, managing, modelling, calculating and so on.

Bill Bell - 5 years, 7 months ago

Log in to reply

@Bill Bell Then we got you as the App Expert. If you're not on Brilliant Lounge already, please join us there. We'd love your presence in the Computer Science Channel !

Muhammad Arifur Rahman - 5 years, 7 months ago

Log in to reply

@Muhammad Arifur Rahman I'm certainly not an expert but I'll take a look. Thank you.

Bill Bell - 5 years, 7 months ago

The solution with the C Programming. For this problem, n=55.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
#include<math.h>  
/*As we used the POWER function*/
int main(){
double n,x=2;
/*The Equation is X^x=n
So let's solve it.
X^x=n
or, X=n^[1/x]
So we should take different values of X sequentially and get n^[1/x].
When the LHS and RHS are equal, its the solution!
*/
printf("Stuck on Solving X^X=n, right?\nJust provide the n, I'll detect the value of X.\nAnd have patience!!\n So, n=");
scanf("%lf",&n);
while(1){
if((pow(n,(1/x))-x)<=pow(10,-15)){
printf("X=%.10lf\n",x);
break;
}
x=x+pow(10,-6); //Lower the power of 10 for higher precision! But remember, it'll take more time, maybe enough to lose your patience!

}
return 0;
}

And the program gives 3.330652 \boxed{3.330652……} . Remind that, its a Transcendental Number . So you can't get the actual, but you have an approximation!

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...