inst/doc/Brobdingnag.R

### R code from vignette source 'Brobdingnag.Rnw'

###################################################
### code chunk number 1: googol_definition
###################################################



###################################################
### code chunk number 2: Brobdingnag.Rnw:76-77
###################################################
require(Brobdingnag)


###################################################
### code chunk number 3: Brobdingnag.Rnw:78-79
###################################################
googol <- as.brob(10)^100


###################################################
### code chunk number 4: define_f
###################################################
stirling <- function(n){n^n*exp(-n)*sqrt(2*pi*n)}


###################################################
### code chunk number 5: f_of_a_googol
###################################################
stirling(googol)


###################################################
### code chunk number 6: TwoToTheGoogolth
###################################################
2^(1/googol)


###################################################
### code chunk number 7: define_function_f
###################################################
f <- function(x){as.numeric( (pi*x -3*x -(pi-3)*x)/x)}


###################################################
### code chunk number 8: try.f.with.one.seventh
###################################################
f(1/7)
f(as.brob(1/7))


###################################################
### code chunk number 9: try.f.with.a.googol
###################################################
f(1e100)
f(as.brob(1e100))


###################################################
### code chunk number 10: try_f_with_bignumbers
###################################################
f(as.brob(10)^1000)

Try the Brobdingnag package in your browser

Any scripts or data that you put into this service are public.

Brobdingnag documentation built on Oct. 19, 2022, 5:14 p.m.