I'm trying to write a small piece of code that will take the RHS of a first order linear ODE and return a slope field sampled at a few points. I have written:
(* Direction fields for 1st order linear equations y' = f(y,t) *)
grid = 10;
supt = 2; inft = -2; supy = 2; infy = -2;
tlist = Table[inft + n (supt - inft)/grid, {n, 0, grid}];
ylist = Table[infy + n (supy - infy)/grid, {n, 0, grid}];
Ggrid = Partition[Flatten[Outer[{#1, #2} &, tlist, ylist]], 2];
f = #1 + Exp[-2 #1] - 3 #2 &;
slopes = f[#[[1]], #[[2]]] & /@ Ggrid // N;
slopes is a Table of function values evaluated on the 2 dimensional array Ggrid. I would like to plot a small line with the given slope at the corresponding point in Ggrid.