Let $F(x, y) = x\hat{i} - y\hat{j}$, then the magnitude is $$|F| = \sqrt{x^2-y^2}.$$
I know that when both $x$ and $y$ have the same value the magnitude is $0$.
Is there any algorithm to visualize vector fields?
Let $F(x, y) = x\hat{i} - y\hat{j}$, then the magnitude is $$|F| = \sqrt{x^2-y^2}.$$
I know that when both $x$ and $y$ have the same value the magnitude is $0$.
Is there any algorithm to visualize vector fields?
On
First off, the magnitude is $$|F| = \sqrt{|x|^2 + |-y|^2} = \sqrt{x^2+y^2}.$$ This has magnitude $0$ only at the origin and the magnitude is equal to the distance from the origin.
Vector fields can be plotted in many ways and there are a lot of resources available online. The most popular way of visualizing vector fields is a quiver plot. See this Geogebra applet for an example. Here is a plot of this vector field in a square about the origin.
A plot like this could be approximated by hand by simply picking some points in the plane, computing the vector field, then drawing an arrow starting at your selected point in the direction of the vector field. Quiver plots also usually scale the length or weight of the drawn arrows by the magnitude of the vector field.
Actually, the magnitude of your vector field is $\sqrt{x^2 + y^2}$, not $\sqrt{x^2 - y^2}$.
(Indeed, given a vector $V = (v_1,...,v_n)$, its standard Euclidean norm is $|V| = \displaystyle\sum_{i=1}^n |v_i|^2$).
Now, your vector field is $F(x,y) = x\hat{i} - y\hat{j}$. In vector notation, $F(x,y) = \displaystyle\binom{x}{-y}$.
This means that to every point $(x,y)$ in the plane, you are assigning the vector $\displaystyle\binom{x}{-y}$. So to visualize it, just draw a plane, pick a couple of points (you could pick the grid points for example), and draw the associated vectors. Given a large enough number of points, this will give you a good visualization of what the vector field looks like, and is easy to do by hand.
Of course, you could decide to do that informatically if you want to. Some versions already exist and are easy to come by if you look for vector field visualizers.
Here is one on geogebra for example.