# [R] uniroot

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Fri Aug 27 19:42:18 CEST 2021

Yes. This kind of issue is covered in any decent undergraduate course in numerical methods... it is not specific to R. It is also related to FAQ 7.31.
https://en.m.wikipedia.org/wiki/Root-finding_algorithms

https://en.m.wikipedia.org/wiki/Floating-point_arithmetic#Representable_numbers,_conversion_and_rounding

On August 27, 2021 10:30:38 AM PDT, Thomas Subia via R-help <r-help using r-project.org> wrote:
>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
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

--
Sent from my phone. Please excuse my brevity.

More information about the R-help mailing list