Zurück zum Inhaltsverzeichnis

Kapitel 32

PLOT Interna

> restart:

> plot([ [[1,1],[2,2]], [[1,2],[2,1]] ]);

[Maple Plot]

> lprint( % );

PLOT(CURVES([[1., 1.], [2., 2.]],COLOUR(RGB,1.0,0.,0.)),CURVES([[1., 2.], [2., 1.]],COLOUR(RGB,0.,1.0,0.)),AXESLABELS("",""),VIEW(DEFAULT,DEFAULT))

> PLOT( CURVES([[1,1],[2,2], [3,2], [4,2]], COLOR(RGB,0,0,0)));

[Maple Plot]

> PLOT( CURVES([[1,1],[2,2], [3,2], [4,2]], COLOR(RGB,0,0,0)),STYLE(POINT));

[Maple Plot]

> PLOT( CURVES([[1,1],[2,2], [3,2], [4,2]], COLOR(RGB,0,0,0), STYLE(LINE)),
CURVES([[1,1.5],[2,2.5]], COLOR(RGB,1,0,0), STYLE(POINT)));

[Maple Plot]

> PLOT( POLYGONS( [[1,1],[2,2],[1,3]], [[2,1],[2.5,2],[3,1]]) );

[Maple Plot]

> PLOT( POLYGONS( [[1,1],[2,2],[1,3]], [[2,1],[2.5,2],[3,1]],
STYLE(PATCH)) );

[Maple Plot]

> PLOT( POLYGONS( [[1,1],[2,2],[1,3]], COLOR(RGB,1,0,0) ),
POLYGONS( [[2,1],[2.5,2],[3,1]], COLOR(RGB,0,1,0) ) );

[Maple Plot]

> PLOT( POLYGONS( [[1,1],[2,2],[1,3]], COLOR(RGB,1,0,0), STYLE(PATCH) ),
POLYGONS( [[0,1],[2.5,2],[3,1]], COLOR(RGB,0,1,0), STYLE(LINE) ) );

[Maple Plot]

PLOT3D Interna

> p:=plot3d( x-y, x=0..1, y=0..1, grid=[3,3], axes=boxed, style=patch): p;

[Maple Plot]

> lprint(p);

PLOT3D(GRID(0. .. 1.,0. .. 1.,Array(1 .. 3,1 .. 3,{(1, 2) = -.500000000000000000, (1, 3) = -1., (2, 1) = .500000000000000000, (2, 3) = -.500000000000000000, (3, 1) = 1., (3, 2) = .500000000000000000},datatype = float[8],storage = rectangular,order = C_order)),STYLE(PATCH),AXESLABELS(x,y,""),AXESSTYLE(BOX))

> convertf:=proc(x,n)
local i,result, new;
result:=x;
if type(result,float) or type(result,hfarray) then
result:=evalf(result,n):
elif (nops(result)>1 or type(result, function)) then
for i from 1 to nops(result) do:
new:=convertf(op(i,result), n);
result:=subsop(i=new,result):
end do:
end if;
result:
end proc:

>

> p:=plot3d( x-y, x=0..1, y=0..1, grid=[3,3], axes=boxed, color=sqrt(2*x^2+y^2)):
p;
lprint(convertf(p, 3));

[Maple Plot]

PLOT3D(GRID(0. .. 1.,0. .. 1.,Array(1 .. 3,1 .. 3,{(1, 3) = -1., (3, 1) = 1., (1, 2) = -.500, (2, 1) = .500, (2, 3) = -.500, (3, 2) = .500},datatype = sfloat,storage = rectangular,order = C_order),COLOR(HUE,0.,.289,.577,.408,.500,.707,.816,.866,1.)),AXESLABELS(x,y,""),AXESSTYLE(BOX))

> p:=plot3d( x-y, x=0..1, y=0..1, grid=[3,3], axes=boxed,
color=COLOR(RGB, x, y, x*y) ):
p;lprint(convertf(p, 3));

[Maple Plot]

PLOT3D(GRID(0. .. 1.,0. .. 1.,Array(1 .. 3,1 .. 3,{(1, 3) = -1., (3, 1) = 1., (1, 2) = -.500, (2, 1) = .500, (2, 3) = -.500, (3, 2) = .500},datatype = sfloat,storage = rectangular,order = C_order),COLOR(RGB,Array(1 .. 3,1 .. 3,1 .. 3,{(1, 3, 2) = 1., (2, 3, 2) = 1., (3, 1, 1) = 1., (3, 2, 1) = 1., (3, 3, 1) = 1., (3, 3, 2) = 1., (3, 3, 3) = 1., (1, 2, 2) = .500, (2, 1, 1) = .500, (2, 2, 1) = .500, (2, 2, 2) = .500, (2, 2, 3) = .250, (2, 3, 1) = .500, (2, 3, 3) = .500, (3, 2, 2) = .500, (3, 2, 3) = .500},datatype = sfloat,storage = rectangular,order = C_order))),AXESLABELS(x,y,""),AXESSTYLE(BOX))

> p:=plot3d( [r*sin(phi), r*cos(phi), cos(r)], r=0..Pi, phi=0..2*Pi,
grid=[4,4], style=patch): p;
lprint(convertf(p, 3));

[Maple Plot]

PLOT3D(MESH(Array(1 .. 4,1 .. 4,1 .. 3,{(1, 1, 3) = 1., (1, 2, 3) = 1., (1, 3, 3) = 1., (1, 4, 3) = 1., (4, 1, 3) = -1., (4, 2, 3) = -1., (4, 3, 3) = -1., (4, 4, 3) = -1., (3, 3, 2) = -1.05, (3, 3, 3) = -.500, (3, 4, 1) = -.117e-13, (3, 4, 2) = 2.09, (3, 4, 3) = -.500, (4, 1, 2) = 3.14, (4, 2, 1) = 2.72, (4, 2, 2) = -1.57, (4, 3, 1) = -2.72, (4, 3, 2) = -1.57, (4, 4, 1) = -.175e-13, (4, 4, 2) = 3.14, (2, 1, 2) = 1.05, (2, 1, 3) = .500, (2, 2, 1) = .907, (2, 2, 2) = -.524, (2, 2, 3) = .500, (2, 3, 1) = -.907, (2, 3, 2) = -.524, (2, 4, 1) = -.584e-14, (2, 4, 2) = 1.05, (2, 4, 3) = .500, (3, 1, 2) = 2.09, (3, 1, 3) = -.500, (3, 2, 1) = 1.81, (3, 2, 2) = -1.05, (3, 2, 3) = -.500, (3, 3, 1) = -1.81, (2, 3, 3) = .500},datatype = sfloat,storage = rectangular,order = C_order)),STYLE(PATCH))

Plottools-Package

> restart: with(plots): with(plottools):

Warning, the name changecoords has been redefined

> display( arc([1,1],1,0..Pi/2,thickness=3), axes=boxed);

[Maple Plot]

> cseq:=seq( arc([1,1],n/50, n/50..2+n/50), n=1..50):

> display([cseq], axes=none);

[Maple Plot]

> cyl:=cylinder([1,1,0],1,2,grid=[30,8],color=black,style=HIDDEN):
display([cyl], axes=boxed);

[Maple Plot]

> c1:=rotate(cyl,Pi/8,0,0):

> display(c1,axes=boxed, scaling=constrained);

[Maple Plot]

> p:=plot3d(sin(x*y), x=0..3, y=0..3, axes=boxed, style=patch): p;

[Maple Plot]

> rotate( p, 0,Pi/2, 0);

[Maple Plot]

> cub:=cuboid([0,0,0],[1,1,1]):
opts:=style=patch, scaling=constrained, orientation=[45,66], color=grey, shading=none, lightmodel=light4:

> display(cub, opts);

[Maple Plot]

> cs:=stellate(cub, 0.7):

> display(cs, opts);

[Maple Plot]

> display(cutin( [cs], 3/4), opts);

[Maple Plot]

> display(cutout( [cs], 3/4), opts);

[Maple Plot]

> display(cutout( convert( [cs], POLYGONS), 3/4), opts);

[Maple Plot]

> p:=plot3d(sin(x*y), x=0..2, y=0..2, grid=[15,15]):

> pol:=convert(p,POLYGONS):

> display(cutout( pol, 3/4), style=patch, color=grey, lightmodel=light4, axes=framed);

[Maple Plot]

> display(arrow( [1,1], [5,5], .1, .4, .1));

[Maple Plot]

> display(cone([0,0,-1],0.7));

[Maple Plot]

> restart: with(plots): with(plottools):

> h := semitorus([0,0,0], 0..Pi, 1, 5):display(h);

[Maple Plot]

>

Neue Funktion: dotplot

> polyg:=(x::numeric,y::numeric,rx::numeric,ry::numeric,n::posint)->
[seq([evalf(x+rx*cos(2*Pi/n*i),5),evalf(y+ry*sin(2*Pi/n*i),5)],i=0..n)]:

> polyg( 2, 2, 0.1, 0.1, 3);

>

[[2.1, 2.], [1.9500, 2.0866], [1.9500, 1.9134], [2....

> PLOT( POLYGONS(
polyg(1,1,0.1, 0.1, 30),
polyg(2,2,0.1,0.1,30),
COLOR(RGB,0,0,0) ),

SCALING(CONSTRAINED) );

[Maple Plot]

> dotplot:=proc( data::list, rx::numeric )
local i, pol, prop;
if nargs>=3 then prop:=args[3]: else prop:=1: end if:
pol:=seq( polyg(data[i][1], data[i][2],rx, rx*prop, 25),
i=1..nops(data));
PLOT(POLYGONS( pol, COLOR(RGB,0,0,0) )):
end proc:

> dotplot( [[1,1],[2,2], [3,1.5], [4,2]], 0.1);

[Maple Plot]

> dotplot( [[1,1],[2,2], [3,1.5], [4,2]], 0.1, 1/2);

[Maple Plot]

Neue Funktion: moebius

> rotatex:=proc(pts::list, winkel)
local sinus,cosinus;
sinus:=evalf(sin(winkel/180.*Pi)); cosinus:=evalf(cos(winkel/180.*Pi));
[seq([pts[i,1],
cosinus*pts[i][2]-sinus*pts[i][3],
cosinus*pts[i][3]+sinus*pts[i][2]],i=1..nops(pts))];
end proc:

> rotatez:=proc(pts::list, winkel)
local sinus,cosinus;
sinus:=evalf(sin(winkel/180.*Pi));
cosinus:=evalf(cos(winkel/180.*Pi));
[seq([cosinus*pts[i][1]-sinus*pts[i][2],
cosinus*pts[i][2]+sinus*pts[i][1],
pts[i,3]],i=1..nops(pts))];
end proc:

> rotatey:=proc(pts::list, winkel)
local sinus,cosinus;
sinus:=evalf(sin(winkel/180.*Pi)); cosinus:=evalf(cos(winkel/180.*Pi));
[seq([cosinus*pts[i][1]-sinus*pts[i][3],
pts[i,3],cosinus*pts[i][3]+sinus*pts[i][1]],
i=1..nops(pts))];
end proc:

> translate:=proc(pts::list, vec::list)
[seq([ pts[i][1]+vec[1],pts[i][2]+vec[2],pts[i][3]+vec[3] ] ,i=1..nops(pts))];
end proc:

> moebius:=proc(pts::list, r, anzahl)
local i, newlist, newpts;
newlist:=[];
for i from 0 to anzahl do:
newpts:=rotatez(pts, 180./anzahl*i);
newpts:=translate(newpts, [r,0.,0.]);
newlist:=[op(newlist), rotatey(newpts,360./anzahl*i)];
end do:
newlist;
end:

> frame:=[ [- 1.5, 0.5,0],
[ 1.5, 0.5,0],[ 1.5,- 0.5,0],
[- 1.5,- 0.5,0],[- 1.5, 0.5,0] ];

frame := [[-1.5, .5, 0], [1.5, .5, 0], [1.5, -.5, 0...

> PLOT3D(
MESH(moebius(frame, 4.5, 40)),
SCALING(CONSTRAINED),
SHADING(XYZSHADING),
ORIENTATION(-118,-104),
STYLE(PATCH));

[Maple Plot]

> mb1:=moebius(frame,4.5, 40):
mb2:=[]:
for i from 1 to nops(mb1) do:
mb2:=[op(mb2),translate(
rotatex(mb1[i],90), [4,0,0]) ]:
od:
PLOT3D(MESH(mb1),MESH(mb2),
STYLE(PATCH), SCALING(CONSTRAINED), ORIENTATION(95,55));

[Maple Plot]

Neue Funktion: colorplot3d

> colorplot3d:=proc(f::algebraic, xrange::`=`, yrange::`=`)
local varx, vary, x, x0, x1, y, y0, y1, i, j, opts, gridopt,
dataf1, dataf2, datac1, datac2, c:
Digits:=6:
#
# Parameter analysieren
#
varx:=op(1,xrange): vary:=op(1,yrange):
x0:=evalf(op(1, op(2,xrange))): x1:=evalf(op(2, op(2,xrange))):
y0:=evalf(op(1, op(2,yrange))): y1:=evalf(op(2, op(2,yrange))):
#
# Optionen analysieren
#
gridopt:=[15, 15]: # defaults
opts:=[args[4..nargs]]:
i:=1:
while i<=nops(opts) do:
if type(opts[i], identical(`grid`)=list) then
gridopt:=rhs(opts[i]):
opts:=subsop(i=NULL, opts): # entfernen aus Optionsliste
elif type(opts[i], identical(`color`)=function) or
type(opts[i], identical(`COLOR`)=function) then
c:=[ op(2..4, rhs(opts[i])) ]:
opts:=subsop(i=NULL, opts): # entfernen aus Optionsliste
else
i:=eval(i)+1:
end if:
end do:
if c='c' then # keine Farboption
error "Falsche oder fehlende Farbfunktion, verwende: color=COLOR(RGB,r,g,b)":
end if:
# Schleife für Grafik und Farbdaten

#
dataf1:=[]: datac1:=[]:
for i from 1 to gridopt[1] do:
x:=evalf(x0+(x1-x0)/(gridopt[1]-1)*(i-1)):
dataf2:=[]: datac2:=[]:
for j from 1 to gridopt[2] do:
y:=evalf(y0+(y1-y0)/(gridopt[2]-1)*(j-1)):
dataf2:=[ op(dataf2), evalf( subs(varx=x, vary=y, f)) ]:
datac2:=[ op(datac2), op(evalf( subs(varx=x, vary=y, c))) ]:
end do:
dataf1:=[ op(dataf1), dataf2]:
datac1:=[ op(datac1), op(datac2)]:
end do:
# Plot mit restlichen Optionen anzeigen
#
plots[display]( PLOT3D( GRID(x0..x1, y0..y1, dataf1,
COLOR(RGB, op(datac1))) ), op(opts) );
end proc:

> greyscale:=(x)->COLOR(RGB,x,x,x):
z:=sin(sqrt(x^2+y^2))+sin(x):
colorplot3d( z, x=-10..6, y=-10..5, color=greyscale(z*0.25+0.5),
grid=[30,30], view=-2..3, axes=boxed, scaling=constrained, style=patch);

[Maple Plot]

> z:=1+sin(sqrt(x^2+y^2))+sin(x):
colorplot3d( z, x=-10..6, y=-10..5, color=greyscale(z*0.25+0.5),
grid=[30,30], view=-2..3, axes=boxed, scaling=constrained, style=patch);

[Maple Plot]

> f:=sin(x+I*y):
colorplot3d( abs(f), x=-0..3*Pi,
y=-0.5..1.5, color=greyscale(0.33+ (Pi+argument(f))/(3*Pi) ),
orientation=[-45,45], grid=[40,40], axes=boxed,
labels=[`x`, `y`, ``], style=patch);

[Maple Plot]

Zurück zum Inhaltsverzeichnis