Question 1

To compute average power, find \(\int \frac{x}{cos^2(x)} \space dx\) using integration by parts.

# install.packages(c("ggformula","mosaicCalc"))
library(ggformula)
## Warning: package 'ggformula' was built under R version 4.5.2
## Loading required package: ggplot2
## Loading required package: scales
## 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
f <- makeFun(x / (cos(x))^2 ~ x)
anti_f <- antiD(f(x) ~ x)
anti_f
## function (x, C = 0) 
## {
##     F <- makeF(x/(cos(x))^2)
##     evalFun(F, x = x, .const = C)
## }
## <environment: 0x0000017caf518e40>

Question 2

Graph the corresponding polygon given the data below.

# install.packages("tidyverse")
library(tidyverse)
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats   1.0.1     ✔ stringr   1.5.2
## ✔ lubridate 1.9.4     ✔ tibble    3.3.0
## ✔ purrr     1.1.0     ✔ tidyr     1.3.1
## ✔ readr     2.1.5     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ readr::col_factor() masks scales::col_factor()
## ✖ purrr::discard()    masks scales::discard()
## ✖ tidyr::expand()     masks Matrix::expand()
## ✖ dplyr::filter()     masks stats::filter()
## ✖ dplyr::lag()        masks stats::lag()
## ✖ tidyr::pack()       masks Matrix::pack()
## ✖ tidyr::unpack()     masks Matrix::unpack()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
q2_data <- data.frame(X = c(5,2,0,2,4,7,6,9),
                      Y = c(6,6,4,2,1,1,4,5))
ggplot(q2_data,aes(x = X,y = Y)) +
  geom_polygon(col = "black",fill = "steelblue",lwd = 1.25) +
  geom_point(size = 3) +
  coord_equal() +
  theme_gray()

Question 3

What is \(\int x \sin(x) \space dx\)?

# install.packages(c("ggformula","mosaicCalc"))
library(ggformula)
library(mosaicCalc)
g <- makeFun(x * sin(x) ~ x)
anti_g <- antiD(g(x) ~ x)
anti_g
## function (x, C = 0) 
## sin(x) - x * cos(x) + C