to share – to copy, distribute and transmit the work
to remix – to adapt the work
Under the following conditions:
attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
/*
Batch file for Maxima CAS
save as a o.mac
run maxima :
maxima
and then :
batch("gradient.mac");
*/
kill(all);
remvalue(all);
/* functions */
/*
point of the unit circle D={w:abs(w)=1 } where w=l(t)
t is angle in turns
1 turn = 360 degree = 2*Pi radians
*/
give_unit_circle_point(t):= float(rectform(%e^(%i*t*2*%pi)))$
/* circle points */
give_circle_point(center, Radius, t) := center + Radius*give_unit_circle_point(t)$
/*
vector cfrom c1 to c2
from draw package :
vector([x, y], [dx,dy])
plots vector [dx, dy] with origin in [x, y].
*/
give_vector(c1, c2):=block(
[x,y,dx,dy],
x: realpart(c1),
y: imagpart(c1),
dx : realpart(c2) - x,
dy : imagpart(c2) - y,
vector([x, y], [dx,dy])
)$
/*
circle (Center, Radius )
n points c on the above circle
*/
give_vectors(Center, Radius, n):=(
[vv, v,dt, t, c],
vv:[],
dt : 1/n,
t : 0,
while (t <= 1) do (
c : give_circle_point(Center, Radius,t),
v : give_vector(Center, c),
vv: cons(v,vv),
t : t + dt
),
vv
)$
/*
compile( all);
*/
Radius: 3$ /* radius of the circel around center */
n: 10;
Center: 0.5$
vv : give_vectors(Center, Radius, n);
path:""$ /* if empty then file is in a home dir , path should end with "/" */
load(draw)$
draw2d(
terminal = svg,
file_name = sconcat(path, "vectors"),
title = "vectors",
/*xrange = [-5,5],
yrange = [5,5],
*/
line_width = 2,
line_type = solid,
head_angle = 10, /* the angle, in degrees, between the arrow heads and the segment. Default value: 45 */
head_both = false,
head_type = filled,
key = "",
color = blue,
head_length = 1,
vv
)$
Captions
Add a one-line explanation of what this file represents