kill(all)$

maxima  : plot with definitions of 2d vector field,version 1.0
peter.vlasschaert@gmail.com,04/04/2020

1e) x,y : variables
=============

fmx:cos(y);
fmy:x;

2e) conversion :
===========
x → m[1]
y → m[2]

fx:ev(fmx,x=m[1],y=m[2]);
fy:ev(fmy,x=m[1],y=m[2]);
sc:6.0;

m[1], x variable
m[2],y variable

3e) definition of vector
==================

vf2dl(x,y,fx,fy,sc):=  vector ([x,y],[fx,fy]/sc);

grind(%);

4e) definition of vector (list of vectors)
============================

vect2dfield(x,y,fx,fy,sc):=block([],    
coord : setify(makelist(k,k,-2,2)),
points2d: listify(cartesian_product (coord ,coord )),
vect2: makelist(ev(vf2dl(m[1],m[2],fx,fy,sc),nouns),m,points2d ))$

grind(%);

vect2dfield(x,y,fx,fy,sc);

5e) plot of vector list
===============

plotvect2f(x,y,fx,fy):=block([],
    q:vect2dfield(x,y,fx,fy,sc),
    apply(draw2d , append ([ head_length =.1,color=blue,grid = true], q ))
);

grind(%);

grind(plotvect2f(x,y,fx,fy));

plotvect2f(x,y,fx,fy)$