Just thought I'd share a little tool I threw together while doing my Calculus homework. It plots vector fields and trajectories within them, as well as estimating the end point of the trajectory. I know hardly anyone uses Mathematica except actual mathematicians and college students, but perhaps someone will find it useful. As a side note, I should add that this was programmed in a web-based variant of Mathematica. I expect that it should be compatible with the full software or other web-based versions, but I can't promise anything.
(* VECTOR FIELD GRAPHING TOOL 1.0 *)
(* by Recon *)
(* This tool plots any or all of the following: vector fields, trajectories, and starting points for those trajectories. It is also capable of estimating the end point of the plotted trajectory.*)
(* Setup *)
Clear[xEqn, yEqn, xInit, yInit, x, y, a, b, m, n, steps, pointSize, pointColor, trajectoryThickness, trajectoryColor, vectorColor, vectorScale, xMin, xMax, yMin, yMax, approxSolutions, trajectoryPlot, starterPlot, xStep, yStep, fieldPlot];
(* Inputs *)
{a, b} = {0, 0};
steps = 200;
m[x_, y_] =
n[x_, y_] =
(* Display Options *)
pointSize = 0.03;
pointColor = Red;
trajectoryThickness = 0.01;
trajectoryColor = Red;
vectorColor = Red;
vectorScale = 0.5;
xMin = -10;
xMax = 10;
xStep = 1;
yMin = -10;
yMax = 10;
yStep = 1;
(* Program Logic *)
xEqn = x'[t] == m[x[t], y[t]];
yEqn = y'[t] == n[x[t], y[t]];
xInit = x[0] == a;
yInit = y[0] == b;
approxSolutions = NDSolve[{xEqn, yEqn, xInit, yInit}, {x[t], y[t]}, {t, 0, steps}];
trajectory[t_] = {x[t] /. approxSolutions[[1]], y[t] /. approxSolutions[[1]]};
trajectoryPlot = ParametricPlot[trajectory[t], {t, 0, steps}, PlotStyle -> {{trajectoryColor, Thickness[trajectoryThickness]}}];
starterPlot = Graphics[{pointColor, PointSize[pointSize], Point[{a, b}]}];
fieldPlot = Table[Vector[{m[x, y], n[x, y]} vectorScale, Tail -> {x, y}], {x, xMin, xMax, xStep}, {y, yMin, yMax, yStep}];
(* Output *)
Show[trajectoryPlot, starterPlot, fieldPlot, Axes -> True, AxesLabel -> {"x", "y"}, AxesOrigin -> {0, 0}, PlotRange -> {{xMin, xMax}, {yMin, yMax}}]
trajectory[steps]