[Numerical methods] Smallest positive root

Apr 2019
7
0
Brazil
With 15 or 16 decimals of precision, compute the smallest positive root of the equation:
(x − 2)(x − 3)(x − 4)(x − 5)(x − 6)(x − 7)(x − 8)(x − 9)(x − 10) − ln x = 0
What was the accuracy obtained?
 
Mar 2015
182
68
Universe 2.71828i3.14159
if you need that kind of accuracy, with little knowledge of algorithms and python you can do it on the computer.

2.00001719216681088184314957699337554707
2.99978211140416330829626489552985985590
4.00096375492028954707486460267422842827
4.99776751802407582661234758605558301969
6.00311163653742530467029739062355513215
6.99729456425970255058972802269268782514
8.00144220860225292667861291976253282133
8.99956374921724509450533732656091295889
10.0000570990452398407703879749788087245

If you approximate it, you get
2
3
4
5
6
7
8
9
10.
 
  • Like
Reactions: 1 person

romsek

Math Team
Sep 2015
2,969
1,677
USA
if you need that kind of accuracy, with little knowledge of algorithms and python you can do it on the computer.

2.00001719216681088184314957699337554707
2.99978211140416330829626489552985985590
4.00096375492028954707486460267422842827
4.99776751802407582661234758605558301969
6.00311163653742530467029739062355513215
6.99729456425970255058972802269268782514
8.00144220860225292667861291976253282133
8.99956374921724509450533732656091295889
10.0000570990452398407703879749788087245

If you approximate it, you get
2
3
4
5
6
7
8
9
10.
Is that a 128 bit native type you're using to get that sort of precision?
 
  • Like
Reactions: 1 person
Apr 2019
7
0
Brazil
if you need that kind of accuracy, with little knowledge of algorithms and python you can do it on the computer.

2.00001719216681088184314957699337554707
2.99978211140416330829626489552985985590
4.00096375492028954707486460267422842827
4.99776751802407582661234758605558301969
6.00311163653742530467029739062355513215
6.99729456425970255058972802269268782514
8.00144220860225292667861291976253282133
8.99956374921724509450533732656091295889
10.0000570990452398407703879749788087245

If you approximate it, you get
2
3
4
5
6
7
8
9
10.
How did you get the roots?
 
Mar 2015
182
68
Universe 2.71828i3.14159
Here is the hint:
Define the variable "x" as a float with a precision of 15 decimals.
$$x=2.000000000000001$$

Then define
\(\displaystyle LEFT=(x − 2)(x − 3)(x − 4)(x − 5)(x − 6)(x − 7)(x − 8)(x − 9)(x − 10) \)
and
$$ RIGHT=log(x) $$
//log(x) returns natural logarythm.

And $$DIF=LEFT-RIGHT$$

$$while \; \; \; DIF !=0 \\
x = x+0.000000000000001$$

It is not good way of doing it, but you got the idea. I suggest Mathematica software.
 
Jun 2019
493
262
USA
$$while \; \; \; DIF !=0 \\
x = x+0.000000000000001$$
Almost guaranteed not to work. DIF will probably not equal zero to machine precision. A better way to check for a root may be to see if DIF switches signs.

Also, Newton-Raphson is infinitely more efficient for finding roots. Even binary searches would be a huge improvement. Quadrillions of calculations are going to take some time.

Also, be aware if you're using 64-bit data types (which I thought were still the standard, but maybe I'm a dinosaur), the least significant bit will be at the 15th or 16th significant digit. Each operation is prone to introduce errors on the order of the least significant bit of the largest number involved in addition/subtraction. So (2.000 017 192 166 810 - 2.000 000 000 000 000) will not be accurate to 15 digits if using 64 bits.

If you rewrite the log term as a Taylor series expansion, you might see if you can eliminate some leading-order terms and reformulate the expression in a way that will give you intrinsically more accurate calculations. But, if you are using bigger-than-double data types, this may not be necessary.
 
  • Like
Reactions: 2 people

SDK

Sep 2016
804
545
USA
Here is the hint:
Define the variable "x" as a float with a precision of 15 decimals.
$$x=2.000000000000001$$

Then define
\(\displaystyle LEFT=(x − 2)(x − 3)(x − 4)(x − 5)(x − 6)(x − 7)(x − 8)(x − 9)(x − 10) \)
and
$$ RIGHT=log(x) $$
//log(x) returns natural logarythm.

And $$DIF=LEFT-RIGHT$$

$$while \; \; \; DIF !=0 \\
x = x+0.000000000000001$$

It is not good way of doing it, but you got the idea. I suggest Mathematica software.
Is this a joke? Why bother answering if you have no idea how to help?

@OP: https://en.wikipedia.org/wiki/Newton's_method
 

romsek

Math Team
Sep 2015
2,969
1,677
USA
I suggest Mathematica software.
well if you're going to use Mathematica just do this

FindRoot[(x − 2)(x − 3)(x − 4)(x − 5)(x − 6)(x − 7)(x − 8)(x − 9)(x − 10) − Log[x]==0,{x,1}]

Where the {x,1} says to use x=1 as a first guess.

It returns x=2.0000171921668097 on my 64 bit machine
 
  • Like
Reactions: 1 person
Apr 2019
7
0
Brazil
Thank you all. I was able to get the root using the bisection method.