# [Maxima] Plotting 3D vectors?

Mario Rodriguez biomates at telefonica.net
Fri May 18 10:09:31 CDT 2007

```El vie, 18-05-2007 a las 07:08 -0400, sen1 at math.msu.edu escribió:
> I don't think there currently is an automatic routine which does this,
> but you can easily write your own using the 'draw3d' routine.  That
> routine allows you to plot point sets in 3d.  So, you only need to generate a set
> of short arrows (unions of three line segments) and use draw3d to plot
> the set.

Sorry, I had sent the following response to Thomas and forgot to cc it
to the mailing list (I pressed the incorrect button in my mail client):
--------------------------

Hello,

3d vectors have been added to the draw package this week. Download
draw.lisp (v.1.10) from here
http://maxima.cvs.sourceforge.net/maxima/maxima/share/draw/draw.lisp

and place it in your local share/draw folder. You need maxima 5.12 and
gnuplot 4.2 to run this package.

Once your system is ready, try:

/********** begin Maxima session  ***********/

load(draw)\$
a: {5,10,15,20};

/* defining vector field: extremes of vectors */
vf(x,y,z):= vector([x,y,z],2*[sin(x),cos(y),log(z)])\$

/* 1st example: vectors inside a solid region */
points1: cartesian_product(a,a,a);
vect1: makeset(vf(x,y,z), [x,y,z], points1)\$
apply(draw3d,listify(vect1))\$

/* 2nd example: vectors with origins on a surface */
points2: makeset([x,y,20+x+y],[x,y],cartesian_product(a,a));
vect2: makeset(vf(x,y,z), [x,y,z], points2)\$
apply(draw3d,append([color=green,
explicit(20+x+y,x,0,25,y,0,25),
color=blue],
listify(vect2)))\$

/* 3rd example: pack all together */
apply(draw3d,append([color=green,
explicit(20+x+y,x,0,25,y,0,25),
color=blue],
listify(vect2),
listify(vect1)))\$

/********** end Maxima session  ***********/

--
Mario Rodriguez Riotorto
www.biomates.net
```

More information about the Maxima mailing list