Report in R Markdown

I did some code for question 1 but still not finish yet. Please help me the last part and question 2 please. In R or R markdown is ok.
# Second Taylor approximation of f(x1, x2) = cos(x1*x2) around the point (1,0)
# The approximation is h(x1, x2) = 1-pi^2/8*x1^2
library(rgl)
f <- function(x1, x2){cos(x1*x2)} x1 <- seq(-pi/4, pi/4, 0.1) x2 <- seq(pi/4, 3*pi/4, 0.1) f1 <- outer(x1, x2, FUN = f) persp3d(x1, x2, f1, main = "Taylor approximation of cos(x1,x2)", xlab="x1", ylab="x2", col = "red",axe =T, shade = 0.1, alpha = 0.5) # The approximation h <- function(x1,x2){1-(pi^2/8)*(x1^2)} h1 <- outer(x1, x2, FUN = h) persp3d(x1, x2,h1,col = "blue", shade = 0.1 , add = TRUE, alpha = 0.5) # The error of the approximation error <- abs(f1 - h1) persp3d(x1, x2, error, col = "green", alpha = 0.5) filled.contour(x1, x2, error) grid(nx = 20, ny = 20)