How to draw integral curves?
I'm trying to better understand vector fields and integral curves. I'm coming from computer programming background.
My vector field is defined such that at any point on plane $p(x, y)$ I can calculate corresponding vector $v(x, y)$.
This may sound very basic, but I can't find answer anywhere. Given this setup, how can I actually draw an integral curve starting at any given point?
I tried to create a simple vector field $F(x,y) = [-y, x]$. If I sample this vector field over 2d mesh, and render normalized vector at each sampled point, I get something like this:
Now I want to render integral curves for this field, but I don't understand how. I'm looking for a solution that doesn't necessary has access to analytical form of vector field (we can sample it, but we don't know its function)
$\endgroup$3 Answers
$\begingroup$This capability is implemented in many programs, including matlab, mathematica, and matplotlib.
If you want to know the underlying algorithms, they work by numerically solving $$\frac{d}{dt} \mathbf{x}(t)=\mathbf{v}(\mathbf{x}(t))$$ where $\mathbf{v}$ is your vector field.
$\endgroup$ 2 $\begingroup$You can use the plot to approximate the curve. Start at the initial condition $p(x_0,y_0)$ and then move along the vector field. Next point would be $ p(x_0,y_0)+tv(x_0,y_0)$ for some small $t$ Then repeat this process, connect the points by a straight line and this way you can draw aproximations to the integral curves.
$\endgroup$ 3 $\begingroup$I am thinking that you can select a starting point from the grid, then use the higher-order methods such as RK4 method to calculate the next value, since your function is a circle and the derivatives contain zero and infinity. Then to fix the issue of numerical error, you might want to compare the your next value with the values on the grid, and then choose a point on the grid as the next point, then repeat the process. And if you wish, you can smooth your points by some spline methods.
$\endgroup$