# [R] uniroot

Thomas Subia tg@77m @end|ng |rom y@hoo@com
Fri Aug 27 19:30:38 CEST 2021

```Colleagues,

I've been using uniroot to identify a root of an equation.
As a check, I always verify that calculated root.
This is where I need some help.

Consider the following script

fun <- function(x) {x^x -23}

# Clearly the root lies somewhere between 2.75 and 3.00

uniroot(fun, lower = 2.75, upper = 3.00,  tol = 0.001)

# output
\$root
[1] 2.923125

\$f.root
[1] 0.0001136763

# Let's verify this root.

2.923125^2.923125 - 23

0.0001222225

This result is different than what was calculated with uniroot
0.0001222225		# verified check using x = 2.923125
0.0001136763		# using \$f.root

Does this imply that the root output of  2.923125 may need more significant
digits displayed?

I suspect that whatever root is calculated, that root may well be dependent
on what interval one defines where the root may occur
and what tolerance one has input.
I am not sure that is the case, nevertheless, it's worth asking the
question.

Some guidance would be appreciated.

Thanks!

Thomas Subia

```