computertutorial_2
computertutorial_2
Computer tutorial 2
1 Introduction
The way of working is the same as last week. Please review it in case you forgot.
Today, we will be addressing a number of new features. We start by adding “ornaments” to symbols.
The mostly used ornament is the apostrophe, to which mathematicians refer as a prime, as in 𝑦 ′ . This
is simply done by typing a superscript apostrophe to the symbol 𝑦.
Slightly more involved are ornaments on top of letters, as in 𝑥̅ or 𝑦̂. Here, we use the Accent option
from the equation toolbar. It contains many types: the dot (𝑥̇ ), the arrow (𝑥⃗), the bar (𝑥̅ ), the tilde (𝑥̃),
the hat (𝑥̂), etc. There is also the option to stack symbols, as in
𝑎𝑛 = ⏟𝑎 ×𝑎 × ⋯× 𝑎
𝑛 terms
Finally, it also contains the box that can contain an equation:
𝐸 = 𝑚𝑐 2
Of course you must take care whether or not to include subscripts or superscripts in such ornaments.
Compare ̅̅̅𝑎𝑛 and 𝑎̅𝑛 . Also compare ̅̅̅̅̅̅̅
𝑥 + 𝑦 and 𝑥̅ + 𝑦̅.
1 1 1
For parentheses the differences are more important. For instance, consider (2 𝑥 2 − 2) versus (2 𝑥 2 −
1
2
).
Especially when parentheses at different levels co-exist, the size can help to make the distinction.
Consider, for instance,
2
2
(𝑥 + 𝑦)
((𝑥 − 𝑦) + )
𝑥
The Bracket menu offers also other types of parenthesis (like [these] and {these}), as well as some
other symbols.
The equation editor can also be used for typing vectors, matrices, and equations that include several
𝑥 if 𝑥 > 0
3 𝑎 𝑏
lines. Examples are ( ), [ ], and |𝑥| = { 0 if 𝑥 = 0. Mind that it may be needed to arrange
−4 𝑐 𝑑
−𝑥 if 𝑥 < 0
12345 12345
the contents with respect to alignment: compare ( ) and ( ). The right button of the mouse
6 6
helps you to arrange this. Finally, in some cases we need matrices with lines separating the columns
𝑎 𝑏𝑒
( | ). You may achieve this by selecting brackets with separators.
𝑐 𝑑𝑓
Long equations may span several lines. For instance, the equation 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 +
9 + 10 = 55 spans two lines. Line breaks go automatically, but you may wish to control them. In a
long derivation in display style, for instance, you may write
(𝑎 + 𝑏)2 =
(𝑎 + 𝑏)(𝑎 + 𝑏) =
𝑎(𝑎 + 𝑏) + 𝑏(𝑎 + 𝑏) =
𝑎2 + 𝑎𝑏 + 𝑏𝑎 + 𝑏 2 =
𝑎2 + 2𝑎𝑏 + 𝑏 2
Finally, you may speed up typing equations and omit using the mouse by using programming code. For
instance, when you type “x^2” the equation may convert this automatically into 𝑥 2 . Similar for “\alpha”
1
which gives 𝛼. And “1/2” gives 2. In some cases, you first need to add a space (or = or so) before this
automatic conversion works. And you may have to turn some options (autocorrect?) on.
Which shortcuts to use? Move with the mouse over the symbol, and you’ll see it for next time:
So, to type 𝜕 you need not navigate to the appropriate menu item, but you can just type “\partial”. You
can also go to Math Autocorrect, and you’ll find the full list:
An easy solution is to place it approximately at the right place, and then use the arrow keys to fine-tune
the position of the cursor inside a formula. Further, use [shift]-arrow (e.g., [shift][left]) to select a
fragment, for copying, deleting, or moving.
Today, we’ll explore how to make graphs in Excel. We restrict the discussion to graphs in a numerical
context, which includes two types of graphs:
• function graphs;
• data graphs.
Function graphs are the well-known graphs in a book on mathematics: straight lines, parabolas, the
exponential function, etc. Data graphs present the information from empirical data, for instance a
histogram of the results of an exam, or a piechart of which share of the population uses a car for
commuting and which share travels by train.
To make a data graph, we must have a worksheet filled with data. We fill a worksheet with our data:
Now click Insert - Charts - Column and two things happen: an empty graph area is added to the
worksheet, and a new toolbar (Chart Tools, containing two options: Design and Format) is added to the
menu.
We must now tell Excel which data we would like to display. Click Select Data.
A series is a column of a data matrix that we wish to display. Here the series is in the range from B2
until B11, so we insert that range as Series Values. We can do so by typing the range, or – and that is a
clever way – by clicking into the first cell (B2) and then using ctrl-arrow or even ctrl-shift-arrow to
move to B11, thus selecting the entire range. However you do it, the result is as follows:
Note that Excel adds “Sheet2!” in front of the range, to indicate that we take the range from that specific
worksheet. In our case its name is Sheet2, but it might also be called Sheet1, Students2018, or any other
name.
In addition, we may wish to give the series a name. Because the data represent the grades for maths, not
for stats, a natural name is “maths”. We may indeed type in that name, but we may also refer to the
content of cell B1, so that updating this content into, for instance, “mathematics” will be reflected
automatically.
Now click OK, and another OK, and you will find your first bar graph!
Basically, we’re done. You have a bar chart with the two sets of values. But one thing is still wrong:
the labels at the horizontal axis. Now they are “1” to “10”, but we would like to change this into “0-1”
to “9-10”. Go back to Select Data, but now click Edit in the right pane (Horizontal (Category) Axis
Labels), and add a reference to the data in column A.
Exercise 1: Type in the data above, and reproduce the graph with the histograms for maths and stats.
Next you might wish to fine-tune the graph. The toolbar with Chart Tools provides many options for
doing so. Many of these options can also be accessed by right-clicking in a specific part of the graph.
Options include:
• choosing colors and/or patterns of the bars;
• changing how the axes are shown;
• setting gridlines and/or tickmarks;
• changing or moving the legend and/or title.
We will discuss one such option: changing the numbers at the vertical axis. First go to these options.
An extra menu will become visible:
In particular note the Axis Options and Text Options” as well as the four symbols below them. These
symbols code for Fill & Line, Effects, Size & Properties and Axis options. Let’s first explore this last
one. We want to have the axis not run from 0 to 50, but from 0 to 75. Use the Bounds - Maximum for
this. You may see that the minimum also changes, so fix it to 0. Try the effect of changing the “Units”
to 25. Move down to “Tickmarks”, and select the Major type Outside. Now go to Fill & Line. The Line
Color is a bit greyish, and I prefer black.
This will darken the colors of the axis and the tickmarks, but not of the numbers besides the axis. To
change that, go to Text Options, and select Text Fill & Outline, and next the Text Fill Color. Let’s also
add an axis text: “number of students”. In the Chart Tools, select Add Chart Element and choose Axis
Titles - Primary Vertical. Now a default “Axis Title” appears. You can click it and change it into
“Number of students”. Let’s also turn it 90 degrees, using Size & Properties - Text Direction. The text
is again not pure black, so let’s change that as well, using the Text Options. The bar colors are blue and
Below is an example where many such changes have been introduced. Try to reconstruct the graph
below!
Finally, when our graph is ready, we of course wish to copy it to the Word document which describes
the entire research. This is less straightforward than you might think. You can just use the copy icon or
keyboard shortcut ([ctrl]c) when you have selected the graph, switch to Word, and use the paste icon or
keyboard shortcut ([ctrl]v). It works, but this is very dangerous! Change one number in your Excel file,
and you will see that the graph in Excel will automatically update. That is a good thing. But now watch
what has happened in your Word file: the copied graph has also updated! In other words, the copy to
Word is a “soft” copy. With a soft graph, you risk that your beautifully composed graph suddenly
It will bring an extra form that allows you to control the way of copying: as a hard copy (Picture or
Bitmap), or as a soft copy.
Exercise 3: Copy the graph from Excel to Word, and explore which copy types are “safe”.
Besides the bar chart, Excel offers many other types of graphs. We mention those that will be part of
our course:
• line charts;
• dot charts;
• pie charts.
Notice that Excel in some cases uses different terms, and on top offers additional graph types. See our
catalogue below:
The basic principles of making such graphs are the same as those for bar charts discussed above.
50
40
Number of students
30
20
10
0
0-1 1-2 2-3 3-4 4-5 5-6 6-7 7-8 8-9 9-10
Grade
Sometimes, we want to explore the shape of a mathematical function. For example, how does the graph
of 𝑓(𝑥) = √𝑒 𝑥 look like? Excel provides an excellent way to make a quick-and-dirty plot. We define a
column (e.g., A) that contains the numbers −10.0, −9.9, −9.8, etc. until 9.9 and 10.0. Next we define
another column (e.g., B) that contains the formula “=SQRT(EXP(A1))”, copied dozens of times to
below. Next, a simple scatterplot (with dots and/or lines) will show a graph:
Functions of two variables play an important role in the course. They can be put in graphical form using
𝑧 = 𝑓(𝑥, 𝑦). The coordinates for 𝑥 and 𝑦 then define a plane, and the 𝑧-coordinate the “height”. For
example, consider the function 𝑓(𝑥, 𝑦) = 𝑒 𝑥 √𝑦, on a domain [−1,1] × [0,1]. First we make a
spreadsheet with a range of values for 𝑥 and 𝑦:
Of course, we do this by typing the formula once, and then copying. You need to work in a clever way
with the $-sign to do this. Finally, use Insert Chart - Surface. Unfortunately, Excel requires you to do
this while selecting the data. In the end, tweaking a bit with the axes, we get a nice result:
Instead of a projected 3D plot, we may also make a level curve (contour plot).
Exercise 6: Reproduce the two function plots above, representing 𝑓(𝑥, 𝑦) = 𝑒 𝑥 √𝑦.
If you make a quick-and-dirty spreadsheet, it can be dirty indeed. But there are many situations in which
you need to more carefully:
• if you need to share it with other persons;
• if you work on it for several weeks (e.g., for your bachelor thesis);
• if it becomes really complex.
In such cases, it is very important to keep to certain rules. Below, we give a few examples.
A) Indicate the meaning of the numbers. If you have a cell for 𝑥, for 𝑦, and for 𝑓(𝑥, 𝑦) = √𝑥 2 + 2𝑦,
add extra cells to indicate the meaning of the cells. For instance, don’t type
but type
B) In long rows or column with a large amount of numbers of similar type, don’t include other numbers.
For instance, if you have a list of the population of all US states, don’t add a last line “average”.
Why is this a bad idea? Well, if you need the total population for some calculation, it is very tempting
to do “=SUM(B2:B52)” or “=SUM(B:B)”. This will obviously be wrong.
C) Use several tabsheets. It can be convenient to arrange different different types of information in
different tabsheet. Sheets can be given a convenient name, for instance “prices” by right-clicking the
tab and clicking “Rename”.
At the digital exams, we sometimes ask you to not only give the answer of a calculation, but also to
provide a screenshot of the Excel set-up. In such cases, please add a clear structure and use intermediate
𝑦√𝑒 𝑥
steps. For instance, if we ask “Type in Excel the function 𝑓(𝑥, 𝑦) = 𝑥 2 +3𝑥𝑦−𝑦2, using the input 𝑥 = 2
and 𝑦 = 5 and make a screenshot of the result”, we advise the following: