Hey so I'm reading this article by Chris Hecker where he has an image of a Parabola surrounded by the a vector field of it's derivative:
However he never mentions how exactly he got the vector field equation, and never even states it. He does say he overlayed the vector field of the slopes in Figure 1, by drawing the solution to the slope equation, dy/dx = 2x, as a short vector at each coordinate on the grid.
How do you create a vector field of the slopes of an equation in the vector field syntax of
V = xi + yj
The Figure title would be clearer if it read:
- The curve
y = x^2
, and the vector field dy/dx = 2x
for the general case y = x^2 + C
There are three equations at work in the graph above:
y = x^2
- The equation for the parabola drawn - This is the one long solid curve
y = x^2 + C
-The equation for all parabolas that fit on the vector field - C
is a constant. This is the equation for all parabolas that fit on that vector field
dy/dx = 2x
The equation for the slope field. - This is the slope or derivative of the both the curve drawn and all the possible curves that can be drawn with y = x^2 + C
for all constant C
s.
Note that C
is a constant, since the derivative of y = x^2 + C
with any C
is 2x
. So the vector field shows how to draw all the different parabolas with different C
s.
So there are two ways to calculate the vector field:
- Iterate over your desired range of x and y and calculate the slope,
dy/dx
- 2x
independent of y
in this case - at each point. This is how the author did it.
- Draw a bunch of parabolas by slowly varying
C
in y = x^2 + C
over a desired range of - let's say - x
calculating y
.
For a differential equation dy/dx = f(x,y) (e.g., dy/dx = 2x in this case, with f(x,y) = 2x), the vector field (F) will be F = i + f(x,y)j (so in your case, F = i + 2x j )