> restart: WPROWADZENIE DO MAPLE'A CZ. III * WYKRESY NA PŁASZCZYŹNIE * WYKRESY PRZESTRZENNE * ANIMACJA WYKRESY NA PŁASZCZYŹNIE Ogólna postać komendy p...
13 downloads
28 Views
370KB Size
> restart:
WPROWADZENIE DO MAPLE'A CZ. III * WYKRESY NA PŁASZCZYŹNIE * WYKRESY PRZESTRZENNE * ANIMACJA WYKRESY NA PŁASZCZYŹNIE Ogólna postać komendy plot plot ( f, h, v, o ); f - funkcja/wyrażenie/procedura h - horizontal range v - vertical range o - opcje > plot(x*exp(-x/2),x=0..1);
> plot(x*exp(-x/2),x=0..10);
> plot(x*exp(-x/2),x=-infinity..infinity);
> plot(x*exp(-x/2),x=0..20,0..1);
> plot(x*exp(-x/2),x=0..20,y=0..1);
> ?plot[options] > Wybrane opcje (w skrócie) axes = frame, boxed, normal, none color = aquamarine, black, blue, navy, coral, cyan, brown, gold, green, gray, grey, khaki, magenta, maroon, orange, pink, plum, red, sienna, tan, turquoise, violet, wheat, white, yellow coords = bipolar, cardioid, cassinian, elliptic, hyperbolic, invcassinian, invelliptic, logarithmic, logcosh, maxwell, parabolic, polar, rose, tangent discont = true labels = ["napis1"," napis2"] labeldirections = [horizontal/vertical, horizontal/vertical] legend = ["opis1", "opis2", ...] linestyle = 1, 2, 3, 4 co odpowiada stylom SOLID, DOT, DASH, DASHDOT numpoints = n (domyślnie 50) resolution=n (domyślnie 200) scaling = constrained, unconstrained style = line, point, patch, patchnogrid symbol = box, cross, circle, point, diamond symbolsize = n (domyślnie 10, nie dotyczy symbolu: point) thickness = n (domyślnie 0) tickmarks = [m, n] title = "tytuł" (użycie znaków \n otwiera nową linię) view = [xmin..xmax, ymin..ymax] >
Przykłady wykresów u układzie kartezjańskim Wykresy funkcji w postaci jawnej > w:=x^2; w := x2 > plot(w,x); # domyślny zakres wynosi: -10..10
> f:=x->sin(1/x); 1 f := xsin x > plot(f(x),x=-1..1);
> plot(f(x),x=-1..1,numpoints=10000);
> y:=exp(x)+ln(abs(4-x)); y := exln( x4 ) > plot(y,x=0..5);
> plot(y,x=0..5,numpoints=5000);
> plot(y,x=3.5..4.5,numpoints=5000);
> y:='y': > plot(tan(x),x);
> plot(tan(x),x,-5..5);
> plot(tan(x),x,-5..5,discont=true);
> plot(tan,-1..1); # odwołanie się do samej nazwy
> plot([x,tan(x)],x=-1..1,scaling=constrained); # lista funkcji
> plot([sin(x),cos(x)],x=-2*Pi..2*Pi,labels=[x,"sin(x) i cos(x)"],labeldirections=[horizontal,vertical] ,legend=["sin(x)","cos(x)"]);
> Wykresy funkcji w postaci uwikłanej implicitplot(wyrażenie, x=xmin..xmax, y=ymin..ymax, o); > with(plots); # pakiet zawierający specjalistyczne komendy [ animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, graphplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot ] > implicitplot(x^2+y^2=1, x=-1..1, y=-1..1);
> implicitplot(x^3+y^3-x^2*y-x*y^2=1, x=-10..10, y=-10..10,numpoints=10000);
> Wykres funkcji zadanej w sposób parametryczny plot([x(t), y(t), t=tmin..tmax], h, v, o); > > plot([t-sin(t),1-cos(t),t=0..2*Pi],scaling=constrained);
> Wykres funkcji w układzie biegunowym zadanej w sposób jawny 1) plot( r(phi), phi=phimin..phimax, v, coords=polar, o); 2) polarplot ( r(phi), phi=phimin..phimax, o); > plot(ln(phi),phi=1..100,coords=polar,numpoints=50);
> polarplot(ln(phi),phi=1..100,numpoints=1000);
> Wykres funkcji w układzie biegunowym zadanej w sposób parametryczny 1) plot( [r(t), phi(t), t=tmin..tmax], h, v, o, coords=polar); 2) polarplot( [r(t), phi(t), t=tmin..tmax], h, v, o); > plot([cos(t),sin(t),t=0..2*Pi],-2..2,-1..1,coords=polar);
> polarplot([cos(t),sin(t),t=0..2*Pi],-2..2,-1..1);
> Wykres funkcji zadanej w wybranych punktach > > dane:=[seq([x,x^2],x=0..5)]; dane := [ [ 0, 0 ], [ 1, 1 ], [ 2, 4 ], [ 3, 9 ], [ 4, 16 ], [ 5, 25 ] ] > listplot(dane);
> plot(dane,style=point,symbol=cross,symbolsize=30);
> pointplot(dane,symbol=cross,symbolsize=30);
> Wykres funkcji posiadających punkty nieciągłości > > w:=piecewise(x<=1,1,x<2,x+1,5*exp(-x)); 1 w := x1 ( x ) 5e > plot(w,x=-1..5,0..4);
> plot(w,x=-1..5,0..4,discont=true);
x1 x2 otherwise
> Wyświetlanie kilku wykresów w jednym układzie display(L, insequence=true, o); L - lista, zbiór lub array struktur graficznych > p1:=plot([t-sin(t),1-cos(t),t=0..2*Pi],scaling=constrained): > p2:=plot([Pi+sin(t),1-cos(t),t=0..2*Pi]): > display([p1,p2]);
> plot([[1,0],[1,1]]);
> for i from 0 to 100 do p||i:=plot([[i,0],[i,sin(2*Pi/100*i)]]): end do: > display([seq(p||i,i=0..100)]); # ,insequence=true
> for i from 0 to 10 do p||i:=plot([i/10*cos(t),sin(t),t=0..2*Pi],scaling=constrained): q||i:=plot([cos(t),i/10*sin(t),t=0..2*Pi],scaling=constrained): end do: > display([seq(p||i,i=0..10),seq(q||i,i=0..10)],axes=none);
> > for i from -9 to 9 do q||i:=plot(i/10,x=-cos(arcsin(i/10))..cos(arcsin(i/10))): end do: > display([seq(p||i,i=0..10),seq(q||i,i=-9..9)],axes=none);
> with(plottools); [ arc, arrow, circle, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse, ellipticArc, hemisphere, hexahedron, homothety, hyperbola, icosahedron, line, octahedron, parallelepiped, pieslice, point, polygon, project, rectangle, reflect, rotate, scale, semitorus, sphere, stellate, tetrahedron, torus, transform, translate ] > display(sphere([0,0,2]),torus([0,0,0]),scaling=constrained);
WYKRESY PRZESTRZENNE Ogólna postać komendy plot3d plot3d ( f, x=xmin..xmax, y=ymin..ymax, o ); f - funkcja/wyrażenie/procedura o - opcje > > plot3d(sin(x)*cos(y),x=-Pi..Pi,y=-Pi..Pi);
> F:=(x,y)->x^2+y^2; F := ( x, y )x2y2 > plot3d(F(x,y),x=-1..1,y=-1..1);
> plot3d(F,-1..1,-1..1);
> Wybrane opcje (w skrócie) ambientlight = [r, g, b] (r - red, g - green, b - blue intensywność barwy <0..1>) contours = n (liczba konturów, domyślnie = 10) coords = bipolarcylindrical, bispherical, cardioidal, cardioidcylindrical, casscylindrical, confocalellip, confocalparab, conical, cylindrical, ellcylindrical, ellipsoidal, hypercylindrical, invcasscylindrical, invellcylindrical, invoblspheroidal, invprospheroidal, logcoshcylindrical, logcylindrical, maxwellcylindrical, oblatespheroidal, paraboloidal, paracylindrical, prolatespheroidal, rosecylindrical, sixsphere, spherical, tangentcylindrical, tangentsphere, toroidal. grid = [m,n] rozmiar siatki do generowania punktów wykresu) gridstyle = rectangular, triangular light = [phi,theta,r,g,b] (dodatkowe światło z kierunku określonego kątami phi i theta układu sferycznego) lightmodel = light1, light2, light3, light4 (gotowe typy dodatkowego oświetlenie) numpoints = n (domyślnie 25^2=625) orientation = [theta,phi] (domyślnie [45,45]) projection = r (<0..1> lub FISHEYE, NORMAL, ORTHOGONAL co odpowiada wartościom parametru r = 0, 0.5, 1, domyślnie = 1) shading = XYZ, XY, Z, ZGRAYSCALE, ZHUF style = POINT, HIDDEN, PATCH, WIREFRAME, CONTOUR, PATCHNOGRID, PATCHCONTOUR, LINE (domyślnie = PATCH) view = zmin..zmax lub [xmin..xmax,ymin..ymax,zmin..zmax] > plot3d(1/cosh(x*y),x=-1..1,y=-1..1); # style, colory
Wykresy funkcji w postaci uwikłanej implicitplot(wyrażenie, x=xmin..xmax, y=ymin..ymax, z=zimn..zmax, o); >
> implicitplot3d(x^2+y^2+z^2=1, x=-1..1, y=-1..1,z=-1..1); # numpoints
> implicitplot3d(sin(x)*sin(y)*sin(z)=1/2,x=-2*Pi..2*Pi,y=-2*Pi..2*Pi,z=-2*Pi..2*Pi,nump oints=10000);
> implicitplot3d(sin(x*y*z)=0, x=0..Pi, y=0..Pi, z=0..Pi,numpoints=5000);
> Wykres funkcji zadanej w sposób parametryczny plot3d([x(s,t), y(s,t), z(s,t)], s=smin..smax, t=tmin..tmax, o); > > plot3d([s-sin(t),1-cos(t),cos(t)*sin(s)],s=0..1, t=0..2*Pi,grid=[5,50]); # wstęga Mobiusa
> Wykres funkcji w układzie sferycznym zadanej w sposób jawny 1) plot3d( r(phi, theta), phi=phimin..phimax, theta=thetamin..thetamax, coords=spherical, o); 2) sphererplot ( r(phi, theta), phi=phimin..phimax, theta=thetamin..thetamax, o); > plot3d((4/3)^phi*sin(theta),phi=-1..2*Pi,theta=0..Pi,coords=spherical);
> Wykres funkcji w układzie sferycznym zadanej w sposób parametryczny 1) plot3d( [r(s,t), phi(s,t), theta(s,t)], s=smin..smax, t=tmin..tmax, coords=spherical, o); 2) sphereplot( [r(s,t), phi(s,t), theta(s,t)], s=smin..smax, t=tmin..tmax, o); > plot3d([sin(s+t),cos(s+t),s+t],s=0..2*Pi,t=-10..10,coords=spherical);
> Wykres funkcji w układzie cylindrycznym zadanej w sposób jawny 1) plot3d( r(phi,z), phi=phimin..phimax, z=zmin..zmax, coords=cylindrical, o); 2) cylinderplot ( r(phi,z), phi=phimin..phimax, z=zmin..zmax, o); > plot3d(ln(phi),phi=1..50,z=0..1,coords=cylindrical,grid=[500,5]);
> Wykres funkcji w układzie cylindrycznym zadanej w sposób parametryczny 1) plot3d( [r(s,t), phi(s,t), z(s,t)], s=smin..smax, t=tmin..tmax, coords=cylindrical, o); 2) cylinderplot( [r(s,t), phi(s,t), z(s,t)], s=smin..smax, t=tmin..tmax, o); > plot3d([s,2*t,t],s=0..Pi,t=-5..5,coords=cylindrical,grid=[5,100]);
> Oświetlanie i kolorowanie > plot3d(x*y^4/(x^2+y^2),x=-5..5,y=-5..5,shading=zgrayscale,lightmodel=none,orientation= [-100,72]);
> plot3d(x*y^4/(x^2+y^2),x=-5..5,y=-5..5,shading=none,lightmodel=light1,orientation=[-10 0,72]);
> ANIMACJA Animacja na płaszczyźnie funkcji zadanej w sposób jawny 1) animate( f(x,t), x=xmin..xmax, t=tmin..tmax, o); 2) animate( plot, [f(x,t), x=xmin..xmax], t=tmin..tmax, o); > animate(sin(x+t),x=0..2*Pi,t=0..2*Pi,frames=50); > animate(plot,[sin(x/2)*sin(t),x=0..2*Pi],t=0..2*Pi,frames=50); Animacja na płaszczyźnie funkcji zadanej w sposób parametryczny > animate([8*t,6*t-5*t^2],t=0..6/5,style=point,symbol=circle,symbolsize=30,frames=100,ax es=none,color=blue); > parabola:=plot(3/4*x-5*x^2/64,x=0..48/5): > animate(pointplot,[[8*t,6*t-5*t^2],symbol=circle,symbolsize=30],t=0..6/5,frames=50,axe s=none,background=parabola); > cykloida:=plot([[t-sin(t),1-cos(t),t=0..4*Pi],[t,0,t=0..4*Pi]],scaling=constrained): > a1:=animate(pointplot,[[t-sin(t),1-cos(t)],symbol=circle,symbolsize=10],t=0..4*Pi,fram es=50,axes=none,color=blue,scaling=constrained,background=cykloida): > a2:=animate(plot,[[t+sin(s),1+cos(s),s=0..2*Pi]],t=0..4*Pi,frames=50): > a3:=animate(plot,[[[t-sin(t),1-cos(t)],[t,1]],color=blue],t=0..4*Pi,frames=50): > display([a1,a2,a3]); > Animacja w przestrzeni funkcji zadanej w sposób jawny 1) animate3d( f(x,t), x=xmin..xmax, y=ymin..ymax, t=tmin..tmax, o); 2) animate( plot3d, [f(x, y, t), x=xmin..xmax, y=ymin..ymax], t=tmin..tmax, o); > animate(plot3d,[exp(-x^2*t)+exp(-y^2*t),x=-2*Pi..2*Pi,y=-2*Pi..2*Pi],t=0..1,frames=50) ; > animate(plot3d,[(sin(x*t)+sin(y*t)),x=-2..2,y=-2..2],t=0..2*Pi,frames=50,view=-4..4); > kulka:=z->plot3d([cos(theta)*sin(phi),sin(theta)*sin(phi),z+cos(phi)],theta=0..2*Pi,ph i=0..Pi): > deformacja:=plot3d([cos(theta)*sin(phi),sin(theta)*sin(phi),-10.5+0.5*cos(phi)],theta= 0..2*Pi,phi=0..Pi): > odbicie:=display3d([seq(kulka(-k^2/10),k=0..10),deformacja,seq(kulka(-k^2/10),k=-10..0 )],insequence=true): > plaszczyzna:=plot3d(-11,-5..5,-5..5): > display({plaszczyzna, odbicie},scaling=constrained,orientation=[45,75]); > ?animate >