Introduction to Mathematica for High School Math (for Students and Teachers) #14
Author
Ruth Dover
Title
Introduction to Mathematica for High School Math (for Students and Teachers) #14
Description
Introduction to Mathematica for High School Math
Category
Educational Materials
Keywords
Mathematics, education
URL
http://www.notebookarchive.org/2021-09-6h2k5e2/
DOI
https://notebookarchive.org/2021-09-6h2k5e2
Date Added
2021-09-14
Date Last Modified
2021-09-14
File Size
23.19 kilobytes
Supplements
Rights
Redistribution rights reserved



Tutorial 14: Graphics Primitives
Tutorial 14: Graphics Primitives
R. Dover, IMSA
As stated many notebooks ago, Mathematica's® ability to show graphics is truly impressive. We have seen some of this with built-in commands such as and . In addition, the Wolfram Language™ includes a collection of "graphics primitives." One of these, a rectangle, was used in an earlier example. Very simply, these are geometric objects that may be placed and colored as desired.
Plot
Plot3D
Simple 2D Examples
Simple 2D Examples
We will begin simply:
In[]:=
pr1=Graphics[Circle[{0,0},1]]
What you may have guessed from the syntax is that represents the center and the radius is 1, but these are hardly obvious from the graphic. We can see this in the following:
{0,0}
pr1=Graphics[Circle[{0,0},1],AxesTrue]
For a rectangle with sides parallel to the axes, two vertices are sufficient:
pr2=Graphics[Rectangle[{1,1},{4,2}],AxesTrue]
A may be a simple line segment or a sequence of connected segments:
Line
pr3=Graphics[Line[{{-2,-1},{-1,1},{2,0},{0,-1}}],AxesTrue]
We can show these together using the command, if we had any reason to do this:
Show
Show[pr1,pr2,pr3]
Other 2D graphics primitives include a (a filled circle), a , a and . Open the Documentation Center and search each of these to find out a little more. Play a little.
Disk
Point
Polygon
Text
More Options
More Options
The options make this much more fun. Note that several methods of control are possible for some items (with the semicolon at the end, the object is created in Mathematica's memory but the output is withheld):
bluepoly={Blue,Polygon[{{-3,1},{-1,2},{3,0}}]};
redline={Hue[0],Thick,Line[{{-3,-1},{2,1}}]};
mytext=Text["Here's my artwork!",{0,-1}];
Show[Graphics[{bluepoly,redline,mytext}]]
Note that the red line is on top of the blue poly since the red line was listed later in the Show command. Alternatively, you can include the command in each piece, but not include it in the Show command at the end. The method shown in the previous example requires a little less typing.
Graphics
Here is a more advanced picture with more options:
nubluepoly={Blue,EdgeForm[Thick],Polygon[{{-3,1},{-1,2},{3,0}}]};
nuredline={Hue[0],Dashing[.1],Thickness[.03],Line[{{-3,-1},{2,1}}]};
numytext=Text[Style["Here's my artwork!",Large,Bold,Italic,Pink],{0,-1}];
Note that you can also combine the graphics with regular plots of graphs. This must be listed separately in Show, rather than being put inside of graphics:
nugraph=Plot[,{x,-3,3},PlotStyle{Thick,Purple},AxesFalse,PlotRange{-2,4}];
2
x
Show[nugraph,Graphics[{nubluepoly,nuredline,numytext}]]
3D Examples
3D Examples
In 3D, Point, Line, Polygon and Text are available again. In addition, there are , and .
Cuboid
Sphere
Cylinder
We will use a couple of new things here, edited very slightly from the Documentation Center:
rcoord:=RandomReal[1.,{3}]
pts=Table[Point[rcoord],{12}]
Graphics3D[{PointSize[Large],pts}]
Graphics3D[Table[Sphere[10rcoord],{10}]]
Now, another little issue. Note the was defined with so that the command will be recalculated each time it is used. Reevaluate the preceding commands to see this.
rcoord
:=
Exercise
Exercise
Create a smiley face! Clearly, this may be very simple or very elaborate. Your choice, but practice is always good!


Cite this as: Ruth Dover, "Introduction to Mathematica for High School Math (for Students and Teachers) #14" from the Notebook Archive (2021), https://notebookarchive.org/2021-09-6h2k5e2

Download

