Visualisation des données avec Mathematica
Transcription
Visualisation des données avec Mathematica
Visualisation2003.nb 1 Visualisation des données avec Mathematica Joachim Asch Pour une exposition plus complète consulter le livre: Mathematica par S. Wolfram , le livre Mathematica for Scientists par T.B.Bahder ou le serveur http://www.wri.com où l'on trouve les excellentes présentations de T. Wickham-Jones et autres. ü 5.1. Structure ü 5.2 Graphics en deux dimensions ü 5.2.1 Directives, primitives et Options ü 5.2.2 Coordonnées ü 5.2.3 Fonctions ü 5.3. Graphics3D ü 5.3.1 Types ü 5.3. 2 Primitives ü 5.3.3 Directives et options ü 5.3.4 Fonctions ü 5.4. Combinaisons Prolog, Epilog, Plot ....., Show ü 5.4.1Exemple (Prolog, Epilog) ü 5.4.2 Exemple (Combinaisons) ü 5.5. Labelling ü 5.5.1 Exemple Visualisation2003.nb 1 Visualisation des données avec Mathematica Joachim Asch Pour une exposition plus complète consulter le livre: Mathematica par S. Wolfram , le livre Mathematica for Scientists par T.B.Bahder ou le serveur http://www.wri.com où l'on trouve les excellentes présentations de T. Wickham-Jones et autres. ü 5.1. Structure Une expression dont la tête (Head), ou encore l'en-tête, est un objet de type graphique (Graphics, Graphics3D, SurfaceGraphics ...) admet deux arguments: le premier est une liste (de listes) de directives et de primitives, le deuxième une liste d'options. Pour afficher une telle expression sur l'écran on utilise l'instruction Show. Les graphiques sont codés en POSTSCRIPT. La traduction du code Mathematica en code Postscript est faite par Display. Quelques fonctions de haut niveau sont prédéfinies. Par exemple pour tracer des graphes de fonctions on a Plot, Plot3D ... ü 5.1.1 Exemple (de base) ? "Graphics" Graphics@primitives, optionsD represents a two-dimensional graphical image. Clear@gD; g = Graphics@[email protected], Point@80, 0<D<, 8Frame Ø True, FrameTicks Ø None<D; Show@gD; Le code Postscript est exporté dans le fichier g.mps ( en n'oubliant pas de préciser le "chemin" sous peine de voir ce fichier sauvegardé dans un endroit indésirable) par chemin = "Macintosh HD:Cours Mathematica3.0LMA:"; Display@chemin <> "g.mps", gD; On lit g.mps avec Visualisation2003.nb 2 !!Macintosh HD:Cours Mathematica3.0LMA:g.mps %! %%Creator: Mathematica %%AspectRatio: .61803 MathPictureStart /Mabs { Mgmatrix idtransform Mtmatrix dtransform } bind def /Mabsadd { Mabs 3 -1 roll add 3 1 roll add exch } bind def %% Graphics %%IncludeResource: font Courier %%IncludeFont: Courier /Courier findfont 10 scalefont % Scaling calculations 0.5 0.47619 0.309017 0.294302 [ [ 0 0 -0.125 0 ] [ 0 0 -0.125 0 ] [ 0 .61803 .125 0 ] [ 1 0 .125 0 ] [ 0 0 0 0 ] [ 1 .61803 0 0 ] ] MathScale % Start of Graphics 1 setlinecap ................. setfont ü 5.1.2 Exemple (fonctions) Plot@Sin@xD, 8x, 0, p<D; 1 0.8 0.6 0.4 0.2 0.5 1 1.5 2 InputForm@%D Graphics[ {{Line[ {{1.308996938995747*^-7, 1.3089969389957433*^-7}\ , {0.12744496270371128, 0.12710024461660377}, {0.26643470259797547, 0.26329361883956875}, {0.3969696570014143, 0.38662542783721615}, {0.522504688009585, 0.49905219328635764}, {0.6561297650124452, 0.61005481218524}, {0.7847549186200374, 0.706651792186239}, {0.9214701182223191, 0.7964913872213987}, {1.0531853944293328, 2.5 3 Visualisation2003.nb 0.869003782203569}, {1.1799007472410785, 0.9245682000141244}, {1.2440493853698906, 0.9470914669312236}, {1.3147061460475136, 0.9673877276239544}, {1.3817262571763427, 0.9821794361120795}, {1.411744900137948, 0.9873779642075504}, {1.4445116214586806, 0.9920366781830787}, {1.4622674682894163, 0.994116521723827}, {1.4787518953633867, 0.9957669012179655}, {1.4958225821881594, 0.9971907850774349}, {1.5113004815484399, 0.9982306442155128}, {1.5265300961785202, 0.999020410387935}, {1.5335066890616942, 0.9993048220192023}, {1.5408772182509294, 0.999552456858429}, {1.548765610327696, 0.9997573335811045}, {1.5522683475829784, 0.9998283619033255}, {1.556023307342301, 0.9998908809326795}, {1.560062743184966, 0.9999423956444964}, {1.5638339167370445, 0.9999757625210031}, {1.566136830701334, 0.9999891445677171}, {1.568318434063113, 0.9999969300253757}, {1.5724072960740012, 0.9999987023892716}, {1.5761643040945907, 0.9999855924444514}, {1.5802143808679374, 0.9999556504565562}, {1.5840379853266646, 0.9999123305206836}, {1.5875437665208094, 0.9998597649090828}, {1.5956826433156892, 0.9996903516066877}, {1.6042515006896285, 0.9994404278644544}, {1.6126213028884657, 0.9991254631862281}, {1.620408359854478, 0.9987695754947483}, {1.638081964632778, 0.9977371753815812}, {1.6674594936298928, 0.9953317527057743}, {1.6988440127047781, 0.9918130904337064}, {1.7326308213812456, 0.9869333539597515}, {1.7692570516797244, 0.9803712234086153}, {1.835731418937394, 3 Visualisation2003.nb 0.9651094988177922}, {1.9707090243741634, 0.9210949876567722}, {2.1006867064156647, 0.8628624820872117}, {2.2256644650618975, 0.7931282460003575}, {2.35873226970282, 0.7053100250142443}, {2.4868001509484743, 0.6089946748664846}, {2.622958078188818, 0.49569473336879605}, {2.754116082033894, 0.3778532653097265}, {2.880274162483702, 0.25835450465736626}, {3.0145222889281995, 0.1267286757018376}, {3.1415925226900994, 1.3089969387348305*^-7}}\ ]}}, {PlotRange -> Automatic, AspectRatio -> GoldenRatio^ (-1), DisplayFunction :> $DisplayFunction, ColorOutput -> Automatic, Axes -> Automatic, AxesOrigin -> Automatic, PlotLabel -> None, AxesLabel -> None, Ticks -> Automatic, GridLines -> None, Prolog -> {}, Epilog -> {}, AxesStyle -> Automatic, Background -> Automatic, DefaultColor -> Automatic, DefaultFont :> $DefaultFont, RotateLabel -> True, Frame -> False, FrameStyle -> Automatic, FrameTicks -> Automatic, FrameLabel -> None, PlotRegion -> Automatic, ImageSize -> Automatic, TextStyle :> $TextStyle, FormatType :> $FormatType}] ü 5.2 Graphics en deux dimensions ü 5.2.1 Directives, primitives et Options L'en-tête ( Head) des graphiques de dimension deux est Graphics. On dispose d'un certain nombre de primitives comme: ? Point Point@coordsD is a graphics primitive that represents a point. ? Line Line@8pt1, pt2, ... <D is a graphics primitive which represents a line joining a sequence of points. 4 Visualisation2003.nb ou encore: Circle, Polygon, 5 Raster, RasterArray, Rectangle, Disk, PostScript, Text . Les directives déterminent les détails de la représentation des primitives. Elles sont placées devant les primitives qu'elles précisent. Les options sont des paramètres globaux du graphique concerné. Exemples de directives: PointSize, Thickness, Dashing, AbsolutePointSize, AbsoluteThickness, Scaled, Hue, GrayLevel, RGBColor, CMYKColor . Les options sont: AspectRatio Axes 1êGoldenRatio False ratio of height to width whether to draw axes AxesLabel AxesOrigin None Automatic axes labels where axes should cross AxesStyle Background Automatic Automatic graphics directives to specify the style for axes background color for the plot ColorOutput Automatic type of color output to produce DefaultColor DisplayFunction Automatic $DisplayFunction the default color for plot elements function for generating output Epilog 8< FormatType Frame $FormatType False the default format type for text whether to put a frame around the plot FrameLabel None frame labels FrameStyle FrameTicks Automatic Automatic graphics directives giving the style for the frame frame tick marks GridLines ImageSize None Automatic grid lines to draw the absolute size at which to render the graphic in a notebook graphics primitives to be rendered after the main plot PlotLabel None a label for the plot PlotRange PlotRegion Prolog Automatic Automatic 8< range of values to include the final display region to be filled graphics primitives to be rendered before the main plot y labels on the frame RotateLabel True whether to rotate TextStyle Ticks $TextStyle Automatic the default style for text tick marks Exemple ( Line et Dashing) Show@ Graphics@[email protected], 0.03<D, Line@880, 0<, 81, 1<<D<, Line@880, 1<, 81, 0<<D<DD; Exemple (Point, PointSize et GrayLevel) Visualisation2003.nb 6 Show@Graphics@[email protected], Point@80, 0<D, [email protected], [email protected], Point@80, .5<D, [email protected], Point@80, 1<D<D, Frame Ø TrueD; 1 0.8 0.6 0.4 0.2 0 -0.4 -0.2 0 0.2 0.4 Show@%, PlotRange Ø 88-4, 4<, 8-4, 4<<D; 4 3 2 1 0 -1 -2 -3 -4 -3 -2 -1 0 1 2 3 4 ? PointSize PointSize@dD is a graphics directive which specifies that points which follow are to be shown if possible as circular regions with diameter d. The diameter d is given as a fraction of the total width of the graph. ? GrayLevel GrayLevel@levelD is a graphics directive which specifies the graylevel intensity with which graphical objects that follow should be displayed. The gray level must be a number between 0 and 1; 0 represents black; 1 represents white. Exemple (Circle, Hue et RGBColor, AbsolutePointSize) #1 y i z êü Range@5D, ShowAGraphicsAAppendAj j9HueA ÅÅÅÅÅÅÅ E, Circle@8#1, 0<, 1D= &z 5 { k 8RGBColor@1, 0, 0D, AbsolutePointSize@20D, Point@82, 0<D<EEE; Visualisation2003.nb 7 AbsolutePointSize @dD is a graphics directive which specifies that points which follow are to be shown if possible as circular regions with absolute diameter d. The absolute diameter is measured in units of printer ' s points, approximately equal to 1 ê 72 of an inch. ü 5.2.2 Coordonnées {x,y} donné par l'utilisateur détermine le Plot Range> { { xmin,xmax} ,{ ymin,ymax} } . Cet ensemble de points est ensuite transformé ((affine)) sur l'ensemble {{0,1}, {0, Aspect Rat io }} qui est affiché sur une partie du domaine de représentation de l'écran. Cette partie s'appelle Plot Region. Elle est paramétrée dans un système cartésien de coordonnées {{0,0},{0,1}} qui s'appellent Scaled[{x,y}]. Par défaut cette région est aussi grande que possible. L'ensemble des points avec coordonnées Enfin il y a des coordonnées Scaled[{dx,dy},{x,y}] relatives au point {x,y} en coordonnées absolues. Exemple (PlotRange) Pour les fonctions graphiques le PlotRange est déterminé automatiquement comme ensemble des points intéressants. Clear@gD; g = Plot@Tan@xD, 8x, -p, p<D; 40 20 -3 -2 -1 1 2 3 -20 -40 Options@%, PlotRangeD 8PlotRange Ø Automatic< FullOptions@%%, PlotRangeD 88-3.2986722862692829, 3.2986722862692829<, 8-45.91154970130959893, 47.95419599715483952<< Show@g, PlotRange Ø 88-3, 3<, 80, 10<<D; 10 8 6 4 2 -3 -2 -1 0 1 2 3 Visualisation2003.nb 8 Exemple (Scaled et PlotRegion) Clear@gD; g = ShowAGraphicsA98AbsolutePointSize@10D, Point@80, 0<D<, 1 9RectangleAScaled@80, 0<D, ScaledA9 ÅÅÅÅÅÅÅ , 1=EE==E, Axes Ø TrueE; 10 0.4 0.2 -0.4 -0.2 0.2 0.4 -0.2 -0.4 Show@g, Frame Ø True, FrameLabel Ø 8"x", "Ce texte est très long"<, RotateLabel Ø FalseD Ce texte est tr s long 0.4 0.2 0 -0.2 -0.4 -0.4 -0.200.2 0.4 x 1 3 1 3 3 ShowAg, PlotRegion Ø 99 ÅÅÅÅ , ÅÅÅÅ =, 9 ÅÅÅÅ , ÅÅÅÅ ==, Background Ø GrayLevelA ÅÅÅÅ EE 4 4 4 4 5 0.4 0.2 -0.4-0.2 -0.2 -0.4 0.2 0.4 Exemple (Scaled relative) errorbar@8x_, y_<D := 8Line@[email protected], -0.04<, 8x, y<D, [email protected], -0.04<, 8x, y<D<D, Line@8Scaled@80, -0.04<, 8x, y<D, Scaled@80, 0.04<, 8x, y<D<D, Line@[email protected], 0.04<, 8x, y<D, [email protected], 0.04<, 8x, y<D<D< Visualisation2003.nb Show@Graphics@[email protected], Point@80, 0<D, errorbar@80, 0<D<DD Exemple (AspectRatio) Clear@gdef, g1, gautoD; gdef = Graphics@Rectangle@80, 0<, 84, 1<DD; g1 = Graphics@Rectangle@80, 0<, 84, 1<D, AspectRatio Ø 1D; gauto = Graphics@Rectangle@80, 0<, 84, 1<D, AspectRatio Ø AutomaticD; Show@GraphicsArray@8gdef, g1, gauto<DD; 9 Visualisation2003.nb 10 Plot@Tan@xD, 8x, 0, 2 p<, AspectRatio -> AutomaticD; 40 20 4 5 2 3 6 -201 -40 ü 5.2.3 Fonctions Des fonctions toutes faites sont heureusement prévues dans Mathematica comme Plot, ListPlot etc. Elles retournent un objet Graphics du type décrit plus haut ( voir l'exemple( Plot, Evaluation) ci-dessous) et affichent cet objet. Evaluation des arguments Dans les fonctions comme Plot les instructions définissant le premier argument ne sont pas effectuées: Information@"HoldAll", LongForm Ø FalseD Attributes@PlotD HoldAll is an attribute which specifies that all arguments to a function are to be maintained in an unevaluated form. 8HoldAll, Protected< La demande d'évaluation est parfois inévitable: Plot@HSin@# xD & êü Range@3DL, 8x, 0, p<D Plot::plnr : HSin@#1 xD &L êü Range @3D is not a machine -size real number at x = 1.30899693899574698`*^-7 . Visualisation2003.nb 11 Plot@Evaluate@Sin@# xD & êü Range@3DD, 8x, 0, p<, PlotStyle -> HDashing@8# .02<D & êü Range@3DLD; 1 0.5 0.5 1 1.5 2 2.5 3 -0.5 -1 et parfois très utile fint[x_] := Integrate[Cos[y]*Exp[-y/2], {y, 0, x}] Timing@Plot@fint@xD, 8x, 0, 5<DD êê First 0.6 0.4 0.2 1 2 3 4 5 35.2333 Second Timing@Plot@Evaluate@fint@xDD, 8x, 0, 5<DD êê First 0.6 0.4 0.2 1 2 3 4 5 1.11667 Second Exemple (ListPlot, plusieurs listes) On a déjà vu la fonction Plot. Pour afficher des données discrètes on a List Plot . Visualisation2003.nb 12 ypoints=(N[Sin[7#]Exp[-#^2]]&)/@(Range[50]3/50); Short[%,3] 80.406295, 0.733997, 0.921737, á45à, 0.00017401, 0.000103252< ListPlot[ypoints]; 0.75 0.5 0.25 10 20 30 40 50 -0.25 -0.5 xycouples=({N[#],N[Sin[7#]Exp[-#^2]]}&)/@(Range[50]3/50);Short[%,3] 880.06, 0.406295<, 80.12, 0.733997<, á47à, 83., 0.000103252<< ListPlot@xycouplesD; 0.75 0.5 0.25 0.5 1 1.5 2 2.5 3 -0.25 -0.5 Voici une autre façon d'engendrer ces couples pour les gens encore peu familiers des fonctions pures de Mathematica: f@x_D = N@Sin@7 xD Exp@-x ^ 2DD; xpoints = N@3 ê 50 Range@50DD; Short@Transpose@8xpoints, f@xpointsD<D, 3D 880.06, 0.406295<, 80.12, 0.733997<, á47à, 83., 0.000103252<< Toutefois l'avantage de la première méthode est qu'elle n'utilise pas d'identifca—teurs. On change maintenant la taille et la couleur des points: Visualisation2003.nb 13 ListPlot[xycouples,PlotStyle->{AbsolutePointSize[4],GrayLevel[1/2]}]; 0.75 0.5 0.25 0.5 1 1.5 2 2.5 3 -0.25 -0.5 Le problème de la représentation de plusieurs listes dans un seul graphique est plus difficile que pour les fonctions: xyCoscouples=({N[#],N[Cos[7#]Exp[-#^2]]}&)/@(Range[50]3/50); gS=ListPlot[xycouples,DisplayFunction->Identity, PlotStyle->{AbsolutePointSize[4],GrayLevel[1/2]}]; gC=ListPlot[xyCoscouples,DisplayFunction->Identity; Show[{gS,gC},DisplayFunction->$DisplayFunction]; 0.75 0.5 0.25 0.5 1 1.5 2 2.5 3 -0.25 -0.5 -0.75 Exemple (ParametricPlot) ParametricPlot@8Sin@tD, Sin@2 tD<, 8t, 0, 2 Pi<D; 1 0.5 -1 -0.5 0.5 -0.5 -1 Exemple (Plot, Echantillonage) Mathematica a une façon sophistiquée d'échantillonner. Soit: 1 Visualisation2003.nb 14 Clear@gD; g = Plot@Sin@xD, 8x, 0, Pi<D; 1 0.8 0.6 0.4 0.2 0.5 1 1.5 2 2.5 3 Comment connaître les points qui ont été calculés? 8Short@g@@1DDD, Short@g@@2DDD< 888Line@á1àD<<, 8PlotRange Ø Automatic, á23à, FormatType ß $FormatType<< Comme on le voit, et comme on l'a annoncé au début de ce chapitre, le résultat est donné sous la forme d'un objet Graphics avec comme premier argument une liste de primitives et comme deuxième argument une liste d'options. Le premier argument est la ligne brisée représentant le graphe. Pour accéder à la liste de points il faut donc demander Short@g@@1, 1, 1, 1DD, 5D 881.309 µ 10-7 , 1.309 µ 10-7 <, 80.127445, 0.1271<, á50à, 83.01452, 0.126729<, 83.14159, 1.309 µ 10-7 << On dessine maintenant la projection des sommets de cette ligne brisée sur l'axe des x: p@8x_, y_<D = 8x, 0<; ListPlot@Map@p, g@@1, 1, 1, 1DDD, Axes -> NoneD; ü 5.3. Graphics3D ü 5.3.1 Types Graphics3 D . Pour les graphes des fonctions de deux variables il y a en outre les types DensityGraphics, ContourGraphics . Pour des objets à trois coordonnées il y a le type SurfaceGraphics, Visualisation2003.nb 15 ü 5.3. 2 Primitives Cuboid, Point, Text, Line, Polygon Exemple: Cuboid, Point, Line, text 1 1 1 ShowAGraphics3DA9CuboidA80, 0, 0<, 9 ÅÅÅÅ , ÅÅÅÅ , ÅÅÅÅ =E, Point@81, 1, 1<D, 4 4 4 1 1 1 Line@880, 0, 0<, 81, 1, 1<<D, TextA"Intérieur", 9 ÅÅÅÅ , ÅÅÅÅ , ÅÅÅÅ =E=EE; 2 2 2 Int rieur Exemple (Polygon) Clear@randtriangD; randtriang := Polygon@Table@8Random@D, Random@D, Random@D<, 83<DD; Show@Graphics3D@Table@randriang, 85<DDD Visualisation2003.nb 16 ü 5.3.3 Directives et options On dispose en plus des directives des graphiques à deux dimensions de: FaceForm, EdgeForm, Surf aceColor Options@Graphics3DD 8AmbientLight Ø [email protected], AspectRatio Ø Automatic, Axes Ø False, AxesEdge Ø Automatic, AxesLabel Ø None, AxesStyle Ø Automatic, Background Ø Automatic, Boxed Ø True, BoxRatios Ø Automatic, BoxStyle Ø Automatic, ColorOutput Ø Automatic, DefaultColor Ø Automatic, Epilog Ø 8<, FaceGrids Ø None, Lighting Ø True, LightSources Ø 8881., 0., 1.<, RGBColor@1, 0, 0D<, 881., 1., 1.<, RGBColor@0, 1, 0D<, 880., 1., 1.<, RGBColor@0, 0, 1D<<, PlotLabel Ø None, PlotRange Ø Automatic, PlotRegion Ø Automatic, Plot3Matrix Ø Automatic, PolygonIntersections Ø True, Prolog Ø 8<, RenderAll Ø True, Shading Ø True, SphericalRegion Ø False, Ticks Ø Automatic, ViewCenter Ø Automatic, ViewPoint Ø 81.3, -2.4, 2.<, ViewVertical Ø 80., 0., 1.<, DefaultFont ß $DefaultFont, DisplayFunction ß $DisplayFunction< Exemple (FaceForm, ViewPoint) ? FaceForm FaceForm@gf, gbD is a three-dimensional graphics directive which specifies that the front faces of polygons are to be drawn with the graphics primitive gf, and the back faces with gb. Show@ GraphicsArray@ 8Graphics3D@8FaceForm@GrayLevel@0D, [email protected], Polygon@880, 0, 0<, 81, 0, 0<, 80, 1, 0<<D<, Lighting Ø FalseD, Graphics3D@8FaceForm@GrayLevel@0D, [email protected], Polygon@880, 0, 0<, 81, 0, 0<, 80, 1, 0<<D<, ViewPoint Ø 81.3, -2.4, -2<, Lighting Ø FalseD < D D; Visualisation2003.nb 17 ? Lighting Lighting is an option for Graphics3D and related functions that specifies whether to use simulated illumination in three-dimensional pictures. ? LightSources LightSources is an option for Graphics3D and related functions that specifies the properties of point light sources for simulated illumination. The option LightSources gives the positions and intensities of point light sources. Options@Graphics3D, LightSourcesD 8LightSources Ø 8881., 0., 1.<, RGBColor@1, 0, 0D<, 881., 1., 1.<, RGBColor@0, 1, 0D<, 880., 1., 1.<, RGBColor@0, 0, 1D<<< ü 5.3.4 Fonctions Plot3D, ParametricPlot3D, DensityPlot, ContourPlot, ListPlot3D, ListDensityPlot, ListContourPlot Exemple (Plot3D, Contour, Density,ParametricPlot3D) x2 - y2 f@0, 0D = 0; f@x_, y_D = ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅ ; x2 + y2 Clear@gp, gc, gdD; gp = Plot3D@f@x, yD, 8x, -1, 1<, 8y, -1, 1<, PlotPoints Ø 30, DisplayFunction Ø Identity, Mesh Ø FalseD; gc = ContourPlot@f@x, yD, 8x, -1, 1<, 8y, -1, 1<, Contours Ø 40, DisplayFunction Ø IdentityD; gd = DensityPlot@f@x, yD, 8x, -1, 1<, 8y, -1, 1<, PlotPoints Ø 40, DisplayFunction Ø IdentityD; Show@GraphicsArray@8gp, gc, gd<D, DisplayFunction Ø $DisplayFunctionD; 1 0.5 0 -0.5 -1 -1 1 -0.5 0.5 1 0.5 0 -0.5 0 0.5 -1 1 1 1 0.5 0.5 0 0 -0.5 -0.5 -1 -1 -0.5 0 0.5 1 -1 -1 -0.5 0 0.5 1 On obtient le même résultats par des conversions qui ne coûtent rien: Show@ContourGraphics@gpD, DisplayFunction Ø $DisplayFunctionD 1 0.5 0 -0.5 -1 -1-0.5 0 0.5 1 Ü ContourGraphics Ü Visualisation2003.nb 18 ParametricPlot3D@8t, u Cos@tD, u Sin@tD<, 8t, 0, 2 p<, 8u, -1, 1<, Boxed Ø False, Axes Ø FalseD; t ParametricPlot3DA9t, u Cos@tD, u Sin@tD, GrayLevelA1 - ÅÅÅÅÅÅÅÅ E=, 2p 8t, 0, 2 p<, 8u, -1, 1<, Boxed Ø False, Axes Ø False, Lighting Ø FalseE; ü 5.4. Combinaisons Prolog, Epilog, Plot ....., Show ü 5.4.1Exemple (Prolog, Epilog) x funct@x_D = ExpA- ÅÅÅÅÅÅÅ E - Cos@30 xD Exp@-3 xD; 10 court = Plot@funct@xD, 8x, 0, 1<, Frame Ø TrueD; 1.75 1.5 1.25 1 0.75 0.5 0.25 0 0 0.2 0.4 0.6 0.8 1 Visualisation2003.nb 19 Plot@funct@xD, 8x, 0, 50<, Frame Ø True, Prolog Ø Rectangle@818, .5<, 848, 1.2<, courtD, Epilog Ø Text@"Long and short times", 815, 1.3<DD; 1.4 Long and short times 1.75 1.5 1.25 1 1 0.75 0.8 0.5 0.25 0 0.6 0 0.20.40.60.8 1 0.4 1.2 0.2 0 0 10 20 30 40 50 ? Epilog Epilog is an option for graphics functions which gives a list of graphics primitives to be rendered after the main part of the graphics is rendered. ü 5.4.2 Exemple (Combinaisons) p1 = Plot3D@x2 - y2 , 8x, -1, 1<, 8y, -1, 1<, BoxRatios Ø 81, 1, 2<, DisplayFunction -> IdentityD; p2 = Plot3D@y2 - x2 , 8x, -1, 1<, 8y, -1, 1<, BoxRatios Ø 81, 1, 2<, DisplayFunction -> IdentityD; Show@GraphicsArray@8p1, p2<DD; -1 1-0.5 0.5 00.5 0 1 -0.5 0.5 -1 1 1 -1 1-0.5 0.5 00.5 0 1 -0.5 0.5 -1 1 1 0.5 0.5 0 0 -0.5 -0.5 -1 -1 Ü GraphicsArray Ü Visualisation2003.nb 20 Show@p1, p2, DisplayFunction -> $DisplayFunctionD -1 1 0.5 -0.5 0 0.5 0 1 -0.5 -1 1 1 0.5 0 -0.5 -1 Ü Graphics3D Ü On remarque le changement dans le type du graphique. p1 et p2 sont de type: 8p1@@0DD, p2@@0DD< 8SurfaceGraphics, SurfaceGraphics< ü 5.5. Labelling ü 5.5.1 Exemple aplot = Plot@8Cos@xD, Sin@xD<, 8x, 0, 10<, PlotStyle Ø [email protected], [email protected], 0.03<D<, [email protected], 0.03<D, [email protected]<<D; 1 0.5 2 -0.5 -1 4 6 8 10 Visualisation2003.nb 21 Show@aplot, AxesLabel Ø 8"x-Axis", "y-Axis"<, PlotLabel Ø "TrigPlot"D; y-Axis TrigPlot 1 0.5 2 4 6 8 10 x-Axis -0.5 -1 Show@%, DefaultFont Ø 8"Helvetica-Oblique", 18<D; y-Axis TrigPlot 1 0.5 -0.5 -1 x-Axis 2 4 6 8 10