Polynomials
\(f(x)=3x^3 - 7x^2 + 9x - 4\)
poly1 <- function(x) {
y = 3 * x^3 - 7 * x^2 + 9 * x - 4
return(y)
}
svg("poly1.svg", width = 11, pointsize = 12, family = "sans")
curve(poly1, from = -3, to = 3, n = 40)
abline(h = 0)
abline(v = 0)
abline(h = -4, col = "red")
dev.off()
\(f(x)=2x^3 - 2x^2 + 18x - 18\)
poly2 <- function(x) {
y = 2 * x^3 - 2 * x^2 + 18 * x - 18
return(y)
}
svg("poly2.svg", width = 11, pointsize = 12, family = "sans")
curve(poly2, from = -3, to = 3, n = 40)
abline(h = 0)
abline(v = 0)
abline(v = 1, col = "red")
dev.off()
\(y = (4x - 1)(x + 1)(x + 2) + 5)\)
poly3 <- function(x) {
y = (4*x - 1)*(x + 1)*(x + 2) + 5
return(y)
}
svg("poly3.svg", width = 11, pointsize = 12, family = "sans")
curve(poly3, from = -3, to = 3, n = 40)
abline(h = 0)
abline(v = 0)
abline(v = -1, col = "red")
dev.off()
\(f(x)=x^4 + 4x^3 - 7x^2 - 22x + 24\)
poly4 <- function(x) {
y = x^4 + 4 * x^3 - 7 * x^2 - 22 * x + 24
return(y)
}
svg("poly4.svg", width = 11, pointsize = 12, family = "sans")
curve(poly4, from = -4, to = 4, n = 40)
abline(h = 0)
abline(v = 0)
abline(v = -3, col = "red")
dev.off()
\(r(q)=-0.31*(q - 260)^2 + 9500\)
poly5 <- function(q) {
y = -0.31*(q - 260)^2 + 9500
return(y)
}
svg("poly5.svg", width = 11, pointsize = 12, family = "sans")
curve(poly5, from = 0, to = 500, n = 500)
abline(h = 0)
abline(v = 0)
abline(h = 9500, col = "red")
dev.off()
poly6 <- function(t) {
y = 24.5 - 4.9*t^2
return(y)
}
svg("poly6.svg", width = 11, pointsize = 12, family = "sans")
curve(poly6, from = 0, to = 2.5, n = 100)
abline(h = 0)
abline(v = 0)
abline(v = 2, col = "red")
abline(h = 4.9, col = "red")
dev.off()