# Vector Field Plotter

An interactive visulization of vector fields.

A vector function is a function that takes a number of inputs, and returns a vector. For simplicity, let's keep things in 2 dimensions and call those inputs \(x\) and \(y\). Mathematically speaking, this can be written as

\[ \vec{F}(x,y) = g(x,y)\hat{i} + h(x,y)\hat{j} \]Where \( \hat{i} \) and \( \hat{j} \) are unit vectors along the \(x\) and \(y\) axes respectively. Then, if we have a grid like the one above, we can systematically pick points on the grid at which to plot the corresponding vector. The end result is known as a vector field.

Our interactive demo allows you to enter any function you like for \( g(x,y) \) and \( h(x,y) \). When the page first loads, these functions are set to

\[ g(x,y) = ax + by \\ h(x,y) = cx + dy \]The values \( a,b,c \) and \( d \) just simple constants. They are, however, linked to the sliders, which means you can adjust them and watch how the vector field changes in real time. Don't let them confuse you though, you can safely ignore these if desired.

To enter a new vector function, type your expressions in the \( \hat{i} \) and \( \hat{j} \) text boxes and press "update expression". The types of functions you can enter are explained in the table below.

Expression | Description |
---|---|

sin(x) | The sine of x in radians |

cos(x) | The cosine of x in radians |

tan(x) | The tangent of x in radians |

asin(x), acos(x), atan(x) | The inverse of the three trigonometric functions listed above |

sqrt(x) | The square root of x (for positive x only) |

log(x) | The natural logarithm of x |

pow(x, y) | The power of x to the y |