library(ggplot2)
library(tidyverse)
library(Deriv)
library(pander)
f <- function(x)(x)
g <- function(x)(sqrt(x))
i <- as.numeric(integrate(f, lower = 0, upper = 1)[1]) - as.numeric(integrate(g, lower = 0, upper = 1)[1])
\[\int_{0}^{1} \bigg(f(x) - g(x)\bigg) dx = -0.1666667 \]
ggplot(mapping = aes(x = 0:1)) +
stat_function(fun = g, size = 1, aes(color = "g(x)")) +
stat_function(fun = f, size = 1, aes(color = "f(x)")) +
labs(x = "x", y = "f(x)") +
theme_light() +
theme(legend.position = "bottom")