Evaluate and graph the following definite integral.
\[\int_{0}^{3} \sqrt{9 - x^2} \space dx\]
# install.packages("tidyverse")
library(tidyverse)
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.1 ✔ stringr 1.5.2
## ✔ ggplot2 4.0.0 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
f <- function(x) {
sqrt(9 - x^2)
}
answer <- integrate(f = f,lower = 0,upper = 3)$value
x_values <- seq(0,3,length.out = 500)
y_values <- f(x_values)
q1_data <- data.frame(x = x_values,y = y_values)
ggplot(q1_data,aes(x = x,y = y)) +
geom_line(col = "black",lwd = 1.25) +
geom_ribbon(data = subset(q1_data,x >= 0 & x <= 3),
aes(ymin = 0,ymax = y),
fill = "blue") +
labs(title = "Graph of f(x) = sqrt(9 - x^2)",
caption = paste("Answer:",round(answer,4)),
x = "x",
y = "y") +
theme_gray()
Write 806 in words.
# install.packages("english")
library(english)
## Warning: package 'english' was built under R version 4.5.2
words(806)
## [1] "eight hundred six"
Graph the corresponding polygon given the data below.
# install.packages("tidyverse")
library(tidyverse)
q3_data <- data.frame(X = c(-5,-5,4,4),
Y = c(-3,9,9,4))
ggplot(q3_data,aes(x = X,y = Y)) +
geom_polygon(fill = "yellow",col = "black",lwd = 1.25) +
geom_point(size = 4) +
coord_equal() +
theme_gray()
Use integration by substitution to find \(\int \sin(x^2) \space 2x \space dx\).
# install.packages(c("ggformula","mosaicCalc"))
library(ggformula)
## Warning: package 'ggformula' was built under R version 4.5.2
## Loading required package: scales
##
## Attaching package: 'scales'
## The following object is masked from 'package:english':
##
## ordinal
## The following object is masked from 'package:purrr':
##
## discard
## The following object is masked from 'package:readr':
##
## col_factor
## Loading required package: ggiraph
## Warning: package 'ggiraph' was built under R version 4.5.2
## Loading required package: ggridges
## Warning: package 'ggridges' was built under R version 4.5.2
##
## New to ggformula? Try the tutorials:
## learnr::run_tutorial("introduction", package = "ggformula")
## learnr::run_tutorial("refining", package = "ggformula")
library(mosaicCalc)
## Warning: package 'mosaicCalc' was built under R version 4.5.2
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
g <- makeFun(sin(x^2) * 2 * x ~ x)
anti_g <- antiD(g(x) ~ x)
anti_g
## function (x, C = 0)
## {
## F <- makeF(sin(x^2) * 2 * x)
## evalFun(F, x = x, .const = C)
## }
## <environment: 0x0000022c9b26e690>