Graphmatica - Resources for IB Computer Science at Frankfurt

advertisement
Typing Math Documents
(1)
by Dave Mulkey
Graphmatica for Math Graphs
Graphmatica is a computer program for drawing mathematical graphs.
It can be downloaded from http://www.graphmatica.com
Drawing graphs is easy - type a formula in the box at the top, and press [Enter].
The graph appears automatically.
Notation
Graphmatica uses typical computer notation:
Multiplication : 4 * x
Division : 16 / 4
( 4x also works )
Use parentheses ( ) for complex fractions
For example:
y = x^2 + 4*x - 12
means
y = x² +4x - 12
x+1
y = (x +1) / (x^2x² - 1
Exponents : x^2 means x²
Typing Math Documents
(2)
by Dave Mulkey
More Graphs
You can draw many curves on the graph at the same time.
The graph below shows 3 graphs:
y = sin x
y=x-5
y = x 2 - 4x - 5
Each time you type a new formula and press [Enter], the graph appears.
Colors
Graphmatica chooses a new color for each graph. You might want to change the colors:
 open Options/Graph Paper/Colors, and change the colors of Graph 1, Graph 2, etc.
Erasing
To erase a graph:
 click on the graph, so the formula appears in the formula box
 click the [x] button
Typing Math Documents
(3)
by Dave Mulkey
Erase All
Use the Clear Screen button to erase all the graphs.
Redraw a Graph
All the formulas are stored in a list. Open the list, select a formula,
and press [Enter] to redraw the graph.
Labels
You can type the formulas next to the graphs by adding an Annotation :
 Select Edit / Annotation, or press Ctrl-A
 Type the formula or name or whatever you want.
 Click [Place] and then click where the text should appear
Copy
To copy the graph into a Word document:
 click the [Copy Graphs] button, or select Edit / Copy Graphs to BMP
 change to a Word document and Paste the picture in
 you might want to resize the graph, as it will be quite large.
Typing Math Documents
(4)
by Dave Mulkey
Graph Paper (Grid and Background Color)
The standard colors and grid settings are not very nice - you probably want to change them
Select Options / Graph Paper, and change the [Graph Paper], as well as the [Colors]
Grid Range
You can [Zoom in] or [Zoom out] to see bigger or smaller areas.
You might also want to change the range on the axes manually,
by selecting View / Grid Range, and typing the limits:
Box Zoom
To zoom in a specific region, highlight the area
with the mouse, then click the [Zoom in] button.
Typing Math Documents
(5)
by Dave Mulkey
Higher Mathematics
Graphmatica can perform calculus operations, as well as drawing parametric and polar graphs.
It can do these operations without the user understanding any higher mathematics.
Here are some examples:
Draw a Circle
Simply graph this formula:
(x-2)^2 + (y-4)^2 = 9
Draw a Tangent
Click the [Tangent] button.
Click a point on the circle.
If you wish, change the exact location
of the tangent point by typing in the box.
Polar Graph :
r = 4 cos(3t)
Parametric:
x = sin(2t); y = cos(3t) {0, 2 pi}
Polar Implicit:
r ^ 2 - sin(5t) = 3cos(t) ^ 2
Typing Math Documents
(6)
by Dave Mulkey
Bumpy Function - Sample Mathematical Investigation
Here is the graph of : y =
3 cos x
The number 3 controls the height of the bumps.
Changing it to 0.5 , we get flatter bumps:
y=
1
cos x
2
Changing x to (x-1) slides the graph to the right: y =
1
cos( x  1)
2
Typing Math Documents
(7)
by Dave Mulkey
Sample Investigation (cont) ……….
Subtracting 1 from x doesn't quite move the edge of the bump to 0. The correct amount is about 1.6:
y=
1
cos( x  1.6)
2
To make more bumps (narrower), change x to 5x : y =
By adding +1,the curve moves up the screen:
C=5
C=4
C=3
C=2
C=1
C=0
y=
1
cos(5 x  1.6)
2
1
cos(5 x  1.6)
2
C
Typing Math Documents
(8)
by Dave Mulkey
Word-Processing
Microsoft Word, Open Office, and other “standard” word-processors are not very good for typing
mathematical and scientific documents. Special symbols, formatting formulas, and inserting graphics are all
tricky tasks.
Formulae
It is tempting to use “computer notation” for formulae – e.g. writing “y = x^2 – 1/2 x + pi” instead of
writing a properly formatted formula :
y  x2 
1
x   . Computerized notation might be acceptable
2
under some circumstances, but most teachers will be unhappy if students use incorrect notation. Teachers
prefer correct hand-written documents rather than incorrect word-processed documents.
MS Word and Open Office contain an equation editor for producing correct mathematical formulae. It
produces very attractive results. Unfortunately, it is not easy to use. But with a bit of training and practice,
it is possible to produce mathematical documents without too much wasted time. It is not sensible to do
daily homework this way, as a pencil and paper are lot faster and easier. But the occasional important
project might justify the effort.
Equation Editor
In MS-Word, start the equation editor by opening the [Insert] menu, clicking on [Object], then selecting
[Microsoft Equation 3.0]. This opens an editing box, along with a tool-bar for special symbols.
The very small dotted box is where you can start typing. As you type, it will expand. When you insert a
new structure (e.g. a fraction), more little boxes will appear. The boxes are “place-holders”, to ensure that
numbers stay where they belong – e.g. the tops and bottoms of fractions, exponents, etc.
Example:
3 2
2
x 1
4
3
To make this formula:
1. Insert / Object / Microsoft Equation
2. Make a fraction by clicking here
or typing Ctrl-F.
3. Type numbers in the little boxes.
Use the [Tab] key to jump from one box to the next.
4. Press [Tab] after typing the second number. Type “x”.
5. Make an exponent , by typing Ctrl-H , or by clicking here.
Type 2 in the box then press the [Tab] key.
6. Type the equals sign, the 1, and then the second fraction (as above).
Typing Math Documents
(9)
by Dave Mulkey
Other Symbols
There are lots and lots and of symbols and structures in the equation editor.
Normal students need only a few of these symbols - the rest are for mathematicians.
Here are all the groups, with some descriptions:
Inequality
Vectors
Sets
Greek Letters
Spaces
Matrix
Brackets
Fractions ,
Square Roots
Exponents,
Subscripts
Also have a look in the MENUS - they are special for equation editor, and contain lots of useful stuff.
Without Equation Editor?
You can "fake it" by using superscripts, and using 3 lines to type a single equation.
Here is an example:
line 1
line 2
line 3
3
1
1
— x2 + 2 — = ————
4
2
2x + 1
Use Ctrl+Alt+ minus key to make the fraction bars easily.
That doesn't look too bad. It does have one very big disadvantage, though. It is not an object. So you
cannot move it around, because all the letters are separate pieces. And if you want to insert new pieces, you
probably need to move things on all three lines. This is okay for occasional, simple work, but the equation
editor is more efficient in the long run for bigger documents.
Typing Math Documents
(10)
by Dave Mulkey
Graphics
Another problem for technical documents are graphics. Math documents sometimes need diagrams of
geometric shapes. Scientific documents need diagrams of experimental apparatus or sketches of actions.
External Tools
Other programs, such as Graphmatica and Geometer’s Sketchpad are a good solution for create graphs and
geometric shapes. After drawing the required picture, you will need to copy it and paste it into the
document.
Pasting
Pasting can be tricky. You may need to shrink the picture to make it fit on the page. Click on the picture
and drag the bottom right corner toward the middle.
It’s usually a bad idea to shrink in only one direction (e.g. grabbing the sides or bottom) as this will change
the shape of the picture. And don't shrink pictures unless you need to - they lose details.
Good
BAD
Shrink Here
Not Here
Drawing in Word
MS-Word contains drawing tools for basic shapes, like lines, squares, and circles. There are also some
fancy shapes (autoshapes). The lines, arrows, and circles are useful for highlighting important parts of a
diagram. The autoshapes are useful because you can write text-labels inside them.
To use the drawing tools, open View / Toolbars / Drawing. The drawing toolbar probably appears at the
bottom of the screen, and looks like this:
Paint
MS-Paint allows you to “touch-up” a picture by adding lines, changing pixels, etc. But this is seldom useful,
as it is too time-consuming and it is difficult to make attractive and correct changes.
Typing Math Documents
(11)
by Dave Mulkey
Colors
Colors seem attractive, but too much use of many different colors can make an unattractive, confusing
document. A few colors might be useful, especially for highlighting arrows and circles. Keep in mind that
you might be printing with a black and white printer, and then the colors won’t be visible anyway.
Layers
You sometimes need to place one picture on top of another for example, placing a highlighting circle on top of a picture.
To do this, use move to front or move to back to place the
pictures in the correct order. Right-click on the circle,
choose [Order], select [Bring to Front], then drag the circle
onto the graph:
VERTEX
You can type text directly over the top of a picture if you choose [Send behind text] for the picture. But this
is usually a bad idea, as the text moves around if you make any changes.
Text-Boxes
You can put text into a text-box. This is an object, and you can slide it around like a picture or a shape.
This gives you more control over the layout of the document. Then you can group text-descriptions together
with pictures and they will stay together all the time. And try putting shadows on text-boxes - looks nice!
Groups of Objects
If several pictures and/or graphics objects should stay together, you can Group them. This turns several
pictures into a single object, which can move around without changing. To do this, you must click on
several pictures (holding the Shift key), then right-click and select [Group]. If you need to adjust the
positions between the pictures later, you can [Ungroup] them.
Position
Positioning graphics is tricky. When the text changes (adding or deleting) the pictures might move around
with the text changes. Sometimes this is good, sometimes it's bad.
You basically have two choices : allow the graphics to move with the text, or stick them to the page at a
fixed position. These options are controlled by right-clicking on the graphic, choosing [Format Picture], and
then making changes in [Position] and [Wrapping]. For beginners, the simplest is to fix the picture on the
page (Lock anchor to page) and set wrapping to [Top and Bottom]. Then there will only be text above and
below the image, and the text will move instead of the image moving.
Recommended settings for pictures:
Wrapping = NONE or TOP AND BOTTOM
Position = Lock anchor to Page
Typing Math Documents
(12)
by Dave Mulkey
Tables
Scientists want to put data into tables, with column headings, nicely lined up. Use the Table menu to create
tables, insert rows and columns, and format rows and columns.
Time (sec)
0
1
2
3
4
Height of Paper (m)
100
95
84.27
61.5
32.789
Formatting the Table
This table looks pretty ugly. Make it more attractive by the following steps:
 Resize the Columns - grab the left edge, and drag it to the right. Drag the right edge to the left.
 Shade the Headers - highlight the top two cells, open Format / Borders and Shading, and select gray
 Add a title - every chart needs a title
 Type the data properly – all data items should have the same number of decimal places.
Speed of a Falling Sheet of Paper
Time (sec)
0
1
2
3
4
Height of Paper (m)
100.000
95.000
84.270
61.500
32.789
Formatting Data
Numbers should be lined up, with the decimal points directly below each other. You can accomplish this
with blank spaces, but it is simpler to set a decimal tab:

Highlight the numbers in the second
column. Don't highlight the heading.

Open Format / Tabs...

Create a Decimal Tab at position 0.
If there are also decimals in the first column, repeat this for the first column. But in this case, it is probably
adequate to center the first column - highlight the numbers and click the center button.
Speed of a Falling Sheet of Paper
Time (sec)
0
1
2
3
4
Height of Paper (m)
100.000
95.000
84.270
61.500
32.789
Typing Math Documents
(13)
by Dave Mulkey
Speed Kills? No, efficiency pays!
The stuff above might sound nice, but opening menus and sub-menus, clicking around in dialogs, and
changing settings takes time. And you will make mistakes, which costs even more time.
We all want the computer to function automatically (automagically might be even better!)
You can automate a lot of button pushing using MACROS.
Macros
A macro is a recording of keystrokes and mouse movements, which can be repeated automatically.
You can automate the Equation Editor start-up process. Do the following:
1. Open the [Tools] menu, and select Macros / Record New Macro
2. Write EQ as the name of the macro, and press [OK].
Now you will see a little tape-recorder control box .
Later you will press the square box
to stop recording the macro.
3. All your actions are now being recorded.
Open the Insert menu.
Select Object, then Microsoft Equation Editor.
4. As soon as the editor is open, you want to STOP the macro recorder.
Now your menu selections have been recorded, and named EQ. To replay them, you can open the Tools
menu, select Macros / Macros, and select EQ. But that isn't actually any faster than clicking through the
menus to find Equation Editor.
BUT there is a bit more to this trick.
Custom Buttons on the Toolbar
You can customize the toolbars, and create a button for playing the EQ macro.
 Open View / Toolbars / Customize.
 Select [Commands]
 Click on the Macros entry in the list on the left side.
 DRAG the EQ macro onto one of
the toolbars.
Now every time you press the new
button, the equation editor will pop-up.
Now it is a lot easier to insert equations
into your text.
Any task can be automated using
macros. But if you put too many new
buttons on the toolbar, it will make
a mess. And unfortunately for students,
the macros you make at school will
not be available at home, or on a different computer.
Nevertheless, a few macro buttons can make things a lot more efficient.
Typing Math Documents
(14)
by Dave Mulkey
Special Characters
Mathematics and science use lots of special characters - especially Greek letters. These are available in
Equation Editor, but if you only need a couple letters that is way too much trouble. You can insert special
characters, especially letters, using Insert / Symbol. There are lots and lots of special characters, including
all the following:
⅜√☺☼∞αβπΩθ¢¥Äüę
Keyboard Shortcuts
MS Word contains a set of keyboard shortcuts for many "foreign letters" and other symbols.
Here are some useful shortcuts for students in an International School:
Math Symbol Shortcuts
You will probably find that these symbols are not available as shortcuts. π ⅜ √
If you only need a couple of symbols, you can type them into your document once, copy all of them, then
paste whenever you need a symbol. This will insert all the symbols, but you can delete the ones you don't
need.
If you need lots of special symbols, type a complete list into a single document. Open that document along
with the one you are typing. Then you can switch to the symbols document, copy a symbol, switch back to
the real document, and paste the symbol in.
If you need a couple symbols for lots of documents, you can make a macro to select a symbol
from the Insert / Symbol menu, then make a button on the tool bar for each symbol. This will only make
sense for a few frequently used symbols.
You could download a program which makes inserting special symbols quick and easy. There are plenty of
free ones - try looking at http://www.download.com . But then the software must be installed on every
computer you use - this might not be an option at school.
Typing Math Documents
(15)
by Dave Mulkey
Spreadsheets
A spreadsheet program (Excel) is not a tool for a mathematician. It does not produce graphs for
mathematics. But it does produce charts for business. Spreadsheets are definitely a tool for businessmen,
not scientists and mathematicians.
But spreadsheets are good for organizing data in rows and columns, doing statistical calculations like totals
and averages, and presenting data in attractive charts. Unfortunately, students often use Excel to produce
incorrect charts, because they don't really know how to use the program correctly.
Entering Data
FIRST type a label at the top of each column – don’t just type numbers.
Time (sec)
0
1
2
3
4
Height (m)
100
95
84.27
61.5
32.789
In the second column, the numbers need to be lined-up by lining up the decimal points.
In Excel, this is done by formatting the column.
 Highlight the numbers in the second column
 Open Format / Cells
 Choose Number
 You can choose the number of decimal places to present – in this case it could be 3.
If you choose 2 decimal places, the last number will be rounded off.
Sometimes this is appropriate, sometimes not. Ask your teacher if you are unsure.
2 decimal places
3 decimal places
Time (sec)
0
1
2
3
4
Height (m)
100.000
95.000
84.270
61.500
32.789
Time (sec)
0
1
2
3
4
Height (m)
100.00
95.00
84.27
61.50
32.79
Copying into a Word Document
The simple way to copy into a word document is to highlight the area containing the data, press Ctrl-C to
copy, change to the document, and press Ctrl-V to paste.
You might want to create an empty text box first, and then paste your data into the text box. This turns the
table into an object, and you can slide it around easily.
You could save your worksheet in a file, and then insert the file into a word document. This is a little more
complicated, and it will paste a large table with lots of blank spots, so it isn’t really the best solution.
Typing Math Documents
(16)
by Dave Mulkey
Making a Chart
Highlight your data. Include the headers, as these will be automatically copied into the chart, and open
Insert / Chart.
Now you must decide what type of graph you want. For a scientific presentation, it is usually
an x-y(scatter) chart. Then choose the type of lines you want – with or without dots, curved line or straight
lines. The example below is curved lines with dots:
Height (m)
120.00
100.00
80.00
60.00
Height (m)
40.00
20.00
0.00
0
2
4
6
That’s a good start, but a few things are wrong:
1. The title (at the top) should be something like: Falling Sheet of Paper
2. The bottom axis needs a label – e.g. Time (sec)
3. The axis on the side needs a labe – e.g. Height(m)
Although the chart tool copied some of the headings, it didn’t do a good job. The author pressed the
[Finished] button too soon. The labels are on the 3rd page of the chart wizard. This makes a correct chart.
Height (m)
Falling Sheet of Paper
120.00
100.00
80.00
60.00
40.00
20.00
0.00
Height (m)
0
2
4
Time (sec)
6
Typing Math Documents
(17)
by Dave Mulkey
Formatting the Chart
All the pieces of the chart can be changed by double-clicking on the piece and making corrections.
-- Title and Axis Labels -The default title and axis labels are pretty bad. Right click on the chart and choose Chart Options to change
these.
-- Y-axis Scale -Often the y-axis (vertical) scale is done badly by Excel. Fix this by double-clicking, and changing the
minimum and maximum values to be appropriate.
-- Strange X-axis scale -If the x-axis is strangely labeled, you may have chosen the wrong type of graph. Click on the chart button
again to change the graph type. If that doesn't help, double-click on the scale to change it.
-- Multi-Line Graphs -The lines on a multi-line graph are colored, and a "legend" tells what each color represents. This won't help
if it is printed in black-and-white, and it isn't very clear anyway. Consider using arrows to point out which
graph is which (see example on the next page.
Data can also be entered in Graphmatica. The advantage of this is that one can find and graph a curve of
“best fit”
To insert the data go to View/Data Plot Editor
In the window which opens, you can enter the data in the x and y columns. If you wish to plot a curve of
best fit, you can click on the Curve Fit button. The Options button allows you to edit the type of curve you
want. By right clicking on the labels, you can edit the labels and also edit the title of the graph. By selecting
the fonts tab, you can edit the size of the labels. Because Graphmatica uses nonstandard notation for
entering equations, if you wish to add a label with the equation of the best fit curve, you should copy the
graph into word, add a text box to the picture, and enter the equation using equation editor.
y  4.25x 2  0.1958 x  99.8
Typing Math Documents
(18)
by Dave Mulkey
Large Data Sets
Big companies (banks, insurance companies, etc) and scientific research institutes (NASA, universities, etc)
deal with large sets of data - millions of items. Huge data sets cannot be examined by reading the data, as
there is just too much of it.
Spreadsheets contain formulas for statistical calculations such as totals, average, maximum, minimum,
standard deviation, etc. Spreadsheets will also present data in charts, so the user can get a visual overview of
the "shape" of the data. Some large data sets are available in Temperatures.xls.
The charts on the next page clearly show that one pair of closely related cities, and another dissimilar pair.
The charts are produce by highlighting the Date column (column A) and two other columns, then making
Line chart.
Temperatures - Sample Data Study
Sydney and Lisbon are roughly the same distance from the equator, but on opposite sides.
Thus they have roughly the same temperature range, but the seasons are exactly opposite.
When Sydney has summer, Lisbon has winter, and vice versa.
Daily T em peratures in Sydney and Lisbon
100
60
40
Lisbon
Sydney
20
-40
D ate
(lines to -40 indicate missing data)
2004
2003
2002
2001
2000
1999
1998
1997
-20
1996
0
1995
Tem perature (F)
80
Typing Math Documents
(19)
by Dave Mulkey
Stockholm also has opposite cycles to Sydney, because they are in opposite hemispheres.
But the range of temperatures in Stockholm is considerably larger than Sydney the highest temperatures in Stockholm are similar, but the lowest temperatures are a lot lower.
D aily T em peratures in Stockholm and Sydney
80
60
Sydney
40
Stockholm
20
2004
2003
2002
2001
2000
1999
1998
-40
1997
-20
1996
0
1995
Tem perature(F)
100
Date
(lines to -40 indicate m issing data)
This data table shows the high variability of winter temperatures in Stockholm, compared to the more stable
temperatures in Lisbon during the same winter.
Daily Temperatures (F)
Date
Lisbon
Stockholm
12/28/02
55
27
12/29/02
53
19
12/30/02
59
12
12/31/02
56
3
01/01/03
61
20
01/02/03
62
16
01/03/03
59
2
Typing Math Documents
(20)
by Dave Mulkey
Practice - Math Investigation
Select a partner - you will do this assignment together with a partner, and turn in one result for each group.
Pages 6 and 7 show a sample mathematics investigation. It shows how changes in a formula affect the shape
of a graph. You should do a similar investigation, by following the steps below.
1. Choose one of the following formulae to investigate. Note that the computerized version of the formula
is also given - use the computer notation to type the formula into Graphmatica.
Correct Mathematical Notation
(from Equation Editor)
Computer Notation
(for Graphmatica)
y  A B cos(Cx)  D
y = A sqrt( B cos( C x ) + D )
y  A log( Bx  C )  D
y = A log( abs( B x ) - C ) + D
Ax  B
Cx  D
r  sin( A cos( Bt )  C ) D
t
C
r  A sin( ) cos( )  D
B
t
A sin Bt
r
D
cos Ct
y
2
y = ( A x^2 - B ) / ( C x + D )
r = sin( A cos( B t ) + C ) ^ D
r = A sin( t / B ) * cos( C / t ) + D
r = (A sin( B t ) ) / cos( C t ) + D
2. Start with A = 1, B = 2, C = 3, D = 4. Draw the graph using Graphmatica. Zoom to an appropriate
size so you can see the whole graph, but without too much empty space. Keep in mind you cannot type
A,B,C,D in Graphmatica - you must replace the letters with numbers.
3. Create a word-processing document, and copy the graph into the document. Adjust the size so it fits
nicely on the page.
4. Use Equation Editor to write your formula (with numbers instead of letters). Place the equation just
above the graph, as shown in the Sample Investigation.
5. Now the investigation part starts. You are going to change the value of each letter to see how changes in
that letter affect the shape of the graph. Each time you make a change where the effect is clear and
interesting, you copy another graph into the document and label it with an updated version of the formula
(with the new value(s)). In each case, you should try using 1 as the number, 0 as the number, and a few
larger values.
6. Find a number to change to make an interesting pattern using many copies of the graph.
Copy this into the document and label it.
7. When you are finished, you will have a document with at least 6 graphs. Each graph must be labeled
with a formula (typed with Equation Editor) and a short explanation.
Typing Math Documents
(21)
by Dave Mulkey
Practice - Data Analysis and Presentation with Charts
Daily temperature data for 25 cities is available in the Excel spreadsheet file Temperatures.xls.
You will be making charts of the data. Be sure that you label each chart sensibly, and adjust the y-axis scale
to be sensible, avoid large blank areas when possible. Your presentation should be similar to the sample on
page 18.
(1) Get a copy of the Temperatures.xls file and load it into Excel.
(2) Make a Word document to collect your charts and descriptions.
(3) Find a city with fairly constant temperatures - very little difference between high temperatures in summer
and low temperatures in winter. Make a chart of all the city's data, copy it into your Word document, and
write a short description of what the chart represents.
(4) Find a city with large differences in temperatures - high temps in the summer, low temps in the winter.
Make a chart of all the data for this city, copy it into your Word document, and label it with a short
description.
(5) Find a single month for a single city with a large variation in temperatures - e.g. unusually high and low
temperatures all in a single month. Make a chart showing this unusual month. Then make a second chart
showing that the temperatures were more constant in the same month in another year in that city.
(6) Find two cities with very similar temperatures all year round. Make a chart with 2 line graphs to show
this similarity, and copy it into your document and label it.
(7) Find a city with very warm temperatures in January, and another with cold temperatures in January don't use Sydney as one of the cities. Show the January data for both cities on one graph - show only the
January data for a single year. Copy the chart into your document and label it.
(8) Find a single week when the temperatures in one city rose (increased) every day, and the temperatures in
another city fell (decreased) every day. Copy the data into a table in your document. Format the table
nicely and label it appropriately.
Download