1. Using Mathematica® for computational learning
For the past five years at St John’s Anglican College we have used Mathematica with our senior
mathematics students. We have gradually expanded its use from an initial trial with Year 11
Mathematics B and C classes to the point where it is now used, to varying degrees, across all year
levels (7 – 12). Mathematica is a symbolic mathematical computation program, or computer algebra
program, developed by Wolfram Research and is available at
https://www.wolfram.com/mathematica/.
The advantages of using Mathematica on a computer over a graphics calculator include, being able
to use a keyboard and mouse for efficient interaction and connecting to a data projector to display
work. Using a computer screen you can see what you’re doing quite clearly and have access to
superior graphics quality. There is also the facility to cut and paste graphics and code straight into
another application, such as a word processor.
Mathematica also has a superior library of instructions to that of a graphics calculator and the scope
to allow students to develop complex solutions to computational problems. Mathematica enables
the development of your own resources within its Notebook environment, so both content and the
computations occur in the same screen; i.e. the Notebooks are interactive and not just readable
documents. Mathematica allows formatting and styling of text and images within the Notebook and
can have executable code ready to go, or functions can be added as users progress.
Students at St John’s use Mathematica across the full range of complexity, from solving basic
computations any calculator could do right through to writing their own programs that are capable
of modelling and solving more complex real-life situations.
The following task demonstrates a simple modelling application that can be done using
Mathematica to determine a line of best fit for a set of data; taken from a larger assignment that
examines the relationship between logistic and exponential functions.
Developing a logistic model in Mathematica
The table below shows the height of a sunflower changing with time. In this task we will model this
data using a logistic model:
Source: http://seattlecentral.edu/qelp/sets/009/009.html
Week 1 2 3 4 5 6 7 8 9 10 11 12
Height (cm) 17.93 36.36 67.76 98.10 131.00 169.50 205.50 228.30 247.10 250.50 253.80 254.50
2. Using Mathematica students are first able to enter the data into a variable, called data:
The text that follows the “In[#]:=” is what is entered by the user and the “Out[#]:=” is followed by
the output that Mathematica produces in response.
The data can then be modelled by any function, as specified by the function FindFit. This example
below generates values for the parameters 𝑐𝑐, 𝑑𝑑 and 𝑟𝑟 with the independent variable being 𝑡𝑡. The
natural number ‘e’ can be represented in Mathematica as either a capital ‘E’ or the ‘e’ used below
which is available from the palettes menu.
These values can then be substituted into the function and plotted, but one handy feature of
Mathematica is that it provides some likely next steps. In this case we can select plot fit from the
context menu that appears below the output line, as circled above.
This produces the relevant code to show the line of best fit and the data on the same graph:
Larger data sets can be imported
directly into Mathematica from a
delimited text file or csv.
Variables in Mathematica are very
easy to work with as they don’t need
to be declared or defined previously.
3. We can also use a different function called NonlinearModelFit if we’re interested in doing some
further analysis. In this example the model is stored to a variable simply called model:
We can present the function as either the equation or the parameters determined:
We can examine the accuracy of our model to the original data:
We can use these results to then work out other values, such as the percentage errors:
This takes the “FitResiduals” values of model and divides each by the original value from data, then
multiplies by 100. The instruction - data[[All, 2]] - tells Mathematica to get all the values from the
second column of data.
In this demonstration I’ve focused primarily on the calculation side of Mathematica, but as
mentioned in the beginning it also has graphical and presentation features that can be utilised to
produce a more visually pleasing product. The following code presents the data generated earlier in
a table format:
These are three examples of over
forty properties that can be
examined directly.
4. Over the past five years we have gradually increased the use of Mathematica within the College and
continue to see it as a fundamental element of our STEM program. As computational thinking and
coding become more and more significant aspects of the curriculum we believe that being proficient
users of Mathematica effectively positions our students for the challenges they will face in the
future.
Mathematica is a registered trademark of Wolfram Research, Inc.