Sketch the given vector field over the rectangle with opposite corners \((−2,−2)\) and \((2,2)\), sketching one vector for every point with integer coordinates (i.e., at \((0,0),(1,2)\),etc.). \[\vec{F} = <x,0>\]
First, let’s set up our grid of values. We will expand the grid so that we can graph our vector field in full:
vals <- seq(-2,2)
df <- data.frame(x = integer(),
y = integer())
for (x in vals){
for (y in vals){
df <- rbind(df,data.frame(x,y))
}
}
plot(df$x, df$y, main="", xlab="", ylab="", xlim = c(-4,4), ylim = c(-4,4))
Now that we have our original \((x,y)\) value pairs, we can calculate our vectors and final coordinate values.
df$x_new <- df$x
df$y_new <- 0
df$x_final <- df$x + df$x_new
df$y_final <- df$y + df$y_new
head(df)
## x y x_new y_new x_final y_final
## 1 -2 -2 -2 0 -4 -2
## 2 -2 -1 -2 0 -4 -1
## 3 -2 0 -2 0 -4 0
## 4 -2 1 -2 0 -4 1
## 5 -2 2 -2 0 -4 2
## 6 -1 -2 -1 0 -2 -2
Finally, we will plot:
plot(df$x, df$y, main="", xlab="", ylab="", xlim = c(-4,4), ylim = c(-4,4))
s <- seq(nrow(df))
arrows(df$x[s],df$y[s],df$x_final[s],df$y_final[s])
From this, we can see that at \(x=0\), the resulting vectors all have value \(<0,0>\). As we increase the value of \(x\), the magnitude of the resulting vector also increases.