If X X = 5 5 then find the approximate value of X upto 6 decimal place.
Hint : Guess the possible range of the X , it will accelerate the speed of the Program Runtime .
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.
Sir, that's the real mathematician's solution!
Upvote with a salute!
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?
Log in to reply
According to Excel spreadsheet 3 . 3 2 2 3 2 7 3 . 3 2 2 3 2 7 = 5 4 . 0 0 1 0 3 4 9 8 . Same result with Wolfram Alpha too (see here ).
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).
Log in to reply
@Harish Sasikumar – You are right estimating directly from x x = 5 5 , may not converge ( Δ x → 0 ) as well as using x ln x = ln 5 5 . In this example, it takes only 4 iterations to reach 16-figure accuracy used in Excel. You may try using x ln x = ln 5 5 in MathLab and see if you get the same result.
这个是一个数本身平方么?因为我用数学方法解出大约是7.416,你的这个答案乘出来和55差很远啊。求解释
Log in to reply
x x 是 x 到 x 的幂数而不是平方数 x x = x 2 ,例如: x = 1 , 2 , 3 , 4 , 5 . . . ⇒ x x = 1 1 , 2 2 , 3 3 , 4 4 , 5 5 . . . 。因为 3 3 = 2 7 < 5 5 和 4 4 = 2 5 6 > 5 5 所以 3 < x < 4 。
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 and 4 (because 3 3 = 2 7 < 5 5 < 2 5 6 = 4 4 ), and that x ↦ x x is strictly increasing for x ≥ 1 , so:
1 2 3 4 5 |
|
That's why, whenever you want to force computation to a specific precision, you ask for something like ⌊ 1 0 precision ⋅ answer ⌋ instead. A better method that doesn't abuse Brilliant's way of handling floating point answers is given by Chew-Seong Cheong.
Using the Python sympy module:
1 2 3 4 5 6 7 |
|
Using the Python scipy module:
1 2 3 4 5 |
|
We can do this easily by approximation. :D
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.
Log in to reply
Exactly. Programmers don't reinvent the CIRCULAR SHAPED LOOPS.
I don't know computer science at all. I used approximation in number theory, 3 3 < 5 5 < 4 4 i.e 2 7 < 5 5 < 2 5 6 . so we have 3 < x < 3 . 5 .
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.
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.
Log in to reply
One place to look for code is rosettacode.org. Bisection for C++ is available at Bisection for C++ .
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.
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.
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?
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.
Log in to reply
@Bill Bell – So you perform all with Python. Are you a problem solver, or app developer also?
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.
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 !
Log in to reply
@Muhammad Arifur Rahman – I'm certainly not an expert but I'll take a look. Thank you.
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 |
|
And the program gives 3 . 3 3 0 6 5 2 … … . Remind that, its a Transcendental Number . So you can't get the actual, but you have an approximation!
Problem Loading...
Note Loading...
Set Loading...
From x x = 5 5 ⇒ x ln x = ln 5 5 .
By Newton's method, we have: x n + 1 = x n − f ′ ( x n ) f ( x n ) .
Let f ( x ) = x ln x − ln 5 5 ⇒ f ′ ( x ) = ln x + 1 .
Using the following Excel spreadsheet, we found that x = 3 . 3 3 0 6 5 1 5 5 1 .