Chapter 13 - Introduction to Numerical Methods in R
Marquette University MATH 4750 - Spring 2025
# Examples of floating-point precision 1==1
[1] TRUE
3-2==1
0.3-0.2==0.1
[1] FALSE
0.4-0.2==0.2
# Example: Calculating large integers as.integer(2^31-1)
[1] 2147483647
as.integer(2^31)
[1] NA
# Numerical integration using integrate function f <- function(x) sin(x) integrate(f, lower = 0, upper = pi)
2 with absolute error < 2.2e-14