100% found this document useful (11 votes)
33 views

Instant Access to An introduction to programming with Mathematica 3rd Edition Paul R. Wellin ebook Full Chapters

Wellin

Uploaded by

coitevelekjo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (11 votes)
33 views

Instant Access to An introduction to programming with Mathematica 3rd Edition Paul R. Wellin ebook Full Chapters

Wellin

Uploaded by

coitevelekjo
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

Download the full version of the ebook at

https://ebookfinal.com

An introduction to programming with


Mathematica 3rd Edition Paul R. Wellin

https://ebookfinal.com/download/an-introduction-
to-programming-with-mathematica-3rd-edition-paul-
r-wellin/

Explore and download more ebook at https://ebookfinal.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Programming with Mathematica 4th Revised edition Edition


Paul Wellin

https://ebookfinal.com/download/programming-with-mathematica-4th-
revised-edition-edition-paul-wellin/

ebookfinal.com

An Introduction to Network Programming with Java 1st


Edition Jan Graba

https://ebookfinal.com/download/an-introduction-to-network-
programming-with-java-1st-edition-jan-graba/

ebookfinal.com

An Introduction to Bootstrap Methods with Applications to


R 1st Edition Michael R. Chernick

https://ebookfinal.com/download/an-introduction-to-bootstrap-methods-
with-applications-to-r-1st-edition-michael-r-chernick/

ebookfinal.com

Practical Programming An Introduction to Computer Science


Using Python 3 Second Edition Paul Gries

https://ebookfinal.com/download/practical-programming-an-introduction-
to-computer-science-using-python-3-second-edition-paul-gries/

ebookfinal.com
Introduction to the mathematics of operations research
with Mathematica 2. ed Edition Hastings

https://ebookfinal.com/download/introduction-to-the-mathematics-of-
operations-research-with-mathematica-2-ed-edition-hastings/

ebookfinal.com

Observation and Experiment An Introduction to Causal


Inference 1st Edition Paul R. Rosenbaum

https://ebookfinal.com/download/observation-and-experiment-an-
introduction-to-causal-inference-1st-edition-paul-r-rosenbaum/

ebookfinal.com

Simply Java An Introduction to Java Programming


Programming Series 1st Edition James Levenick

https://ebookfinal.com/download/simply-java-an-introduction-to-java-
programming-programming-series-1st-edition-james-levenick/

ebookfinal.com

MATLAB An Introduction with Applications 3rd Edition Amos


Gilat

https://ebookfinal.com/download/matlab-an-introduction-with-
applications-3rd-edition-amos-gilat/

ebookfinal.com

An Introduction to Stata Programming 2nd Edition


Christopher F. Baum

https://ebookfinal.com/download/an-introduction-to-stata-
programming-2nd-edition-christopher-f-baum/

ebookfinal.com
An introduction to programming with Mathematica 3rd
Edition Paul R. Wellin Digital Instant Download
Author(s): Paul R. Wellin, Richard J. Gaylord, Samuel N. Kamin
ISBN(s): 9780521846783, 0521846781
Edition: 3
File Details: PDF, 6.48 MB
Year: 2005
Language: english
This page intentionally left blank
An Introduction to Programming with Mathematica
r

An Introduction to Programming with Mathematica r is de-

signed to introduce the Mathematica programming language


to a wide audience. Since the last edition of this book was
published, significant changes have occurred in Mathemat-
ica and its use worldwide. Keeping pace with these changes,
this substantially larger, updated version includes new and
revised chapters on numerics, procedural, rule-based, and
front end programming, and gives significant coverage to
the latest features up to, and including, version 5.1 of the
software.

Mathematica notebooks, available from www.cambridge.org/


0521846781, contain examples, programs, and solutions to
exercises in the book. Additionally, material to supplement
later versions of the software will be made available. This is
the ideal text for all scientific students, researchers, and pro-
grammers wishing to deepen their understanding of Math-
ematica, or even those keen to program using an interac-
tive language that contains programming paradigms from
all major programming languages: procedural, functional,
recursive, rule-based, and object-oriented.
An Introduction to
Programming
with
Mathematica r
Third Edition

Paul R. Wellin | Richard J. Gaylord | Samuel N. Kamin


  
Cambridge, New York, Melbourne, Madrid, Cape Town, Singapore, São Paulo

Cambridge University Press


The Edinburgh Building, Cambridge  , UK
Published in the United States of America by Cambridge University Press, New York
www.cambridge.org
Information on this title: www.cambridge.org/9780521846783

This book is in copyright. Subject to statutory exception and to the provision of


relevant collective licensing agreements, no reproduction of any part may take place
without the written permission of Cambridge University Press.

First published in print format 2005

- ---- eBook (NetLibrary)


- --- eBook (NetLibrary)

- ---- hardback


- --- hardback

Cambridge University Press has no responsibility for the persistence or accuracy of


s for external or third-party internet websites referred to in this book, and does not
guarantee that any content on such websites is, or will remain, accurate or appropriate.

Mathematica, Mathlink and Mathsource are registered trademarks of Wolfram


Research, Inc. All other trademarks used herein are the property of their respective
owners. Mathematica is not associated with Mathematica Policy Research, Inc. or
MathTech, Inc.

Wolfram Research is the holder of the copyright to the Mathematica software system
described in this document, including without limitation such aspects of the system as
its code, structure, sequence, organization, “look and feel”, programming language, and
compilation of command names. Use of the system unless pursuant to the terms of a
license granted by Wolfram Research or an otherwise authorized by law is an
infringement of the copyright.
1 An introduction to Mathematica

Mathematica is a very large and seemingly complex system. It contains hundreds of


functions for performing various tasks in science, mathematics, and engineering,
including computing, programming, data analysis, knowledge representation, and
visualization of information. In this introductory chapter, we introduce the elementary
operations in Mathematica and give a sense of its computational and programming
breadth and depth. In addition, we give some basic information that users of Mathemat-
ica need to know, such as how to start Mathematica, how to get out of it, how to enter
simple inputs and get answers, and finally how to use Mathematica’s documentation to
get answers to questions about the system.

1.1 A brief overview of Mathematica

Numerical computations
Mathematica has been aptly described as a sophisticated calculator. With it you can enter
mathematical expressions and compute their values.
12
.08
In[1]:= Sin .86 Log 1
12
Out[1]= 0.481899

You can store values in memory.


In[2]:= rent 350
Out[2]= 350

In[3]:= food 175


Out[3]= 175

In[4]:= heat 83
Out[4]= 83
2 An Introduction to Programming with Mathematica

In[5]:= rent food heat


Out[5]= 608

Yet Mathematica differs from calculators and simple computer programs in its ability to
calculate exact results and to compute to an arbitrary degree of precision.
1 1 1
In[6]:=
15 35 63
1
Out[6]=
9

In[7]:= 2500
Out[7]= 3273390607896141870013189696827599152216642046043064789483291
368096133796404674554883270092325904157150886684127560071009
217256545885393053328527589376

In[8]:= N , 500
Out[8]= 3.14159265358979323846264338327950288419716939937510582097494
459230781640628620899862803482534211706798214808651328230664
709384460955058223172535940812848111745028410270193852110555
964462294895493038196442881097566593344612847564823378678316
527120190914564856692346034861045432664821339360726024914127
372458700660631558817488152092096282925409171536436789259036
001133053054882046652138414695194151160943305727036575959195
309218611738193261179310511854807446237996274956735188575272
48912279381830119491

Symbolic computations
One of the more powerful features of Mathematica is its ability to manipulate and compute
with symbolic expressions. For example, you can factor polynomials and simplify trigono-
metric expressions.
In[9]:= Factor x5 1

Out[9]= 1 x 1 x x2 x3 x4

3
In[10]:= TrigReduce Sin
1
Out[10]= 3 Sin Sin 3
4
1 An introduction to Mathematica 3

You can simplify expressions using assumptions about variables contained in those expres-
sions. For example, if k is assumed to be an integer, sin 2 k x simplifies to sin x .
In[11]:= Simplify Sin 2 k x ,k Integers
Out[11]= Sin x

This computes the conditions for which a general quadratic polynomial will have both
roots equal to each other.
In[12]:= Reduce x,a x2 b x c 0 y,a y2 b y c 0 x y , a, b, c

b2
Out[12]= a 0 && b 0 a 0 && b c 0 a 0 && c
4a

You can create functions that are defined piecewise.


In[13]:= Piecewise 1, x 0 , Sin x x
1 x 0
Out[13]= Sin x
x
True

The knowledge base of Mathematica includes algorithms for solving polynomial equations,
and computing integrals.
In[14]:= Solve x3 ax 1 0, x
1 3 1 3
2
3
a 9 3 27 4 a3
Out[14]= x 1 3
,
9 3 27 4 a3 21 3 32 3

1 3 a
x 1 3
22 3 31 3 9 3 27 4 a3
1 3
1 3 9 3 27 4 a3
,
2 21 3 32 3
1 3 a
x 1 3
22 3 31 3 9 3 27 4 a3
1 3
1 3 9 3 27 4 a3
2 21 3 32 3

1
In[15]:= x
1 x4
1
Out[15]= 2 ArcTan 1 2 x 2 ArcTan 1 2 x
4 2
Log 1 2 x x2 Log 1 2 x x2
4 An Introduction to Programming with Mathematica

Graphics
The ability to visualize functions or sets of data often allows us greater insight into their
structure and properties. Mathematica provides a wide range of graphing capabilities.
These include two- and three-dimensional plots of functions or data sets, contour and
density plots of functions of two variables, bar charts, histograms and pie charts of data
sets, and many packages designed for specific graphical purposes. In addition, the Mathemat-
ica programming language allows you to construct graphical images “from the ground up”
using primitive elements, as we will see in Chapter 9.
Here is a simple two-dimensional plot of the function sin x 2 sin x2 .

In[16]:= Plot Sin x 2 Sin x2 , x, ,


1

0.5

3 2 1 1 2 3

0.5

Out[16]= Graphics

You can combine two or more plots in a single graphic by enclosing them inside curly
braces.
In[17]:= Plot Sin x , Sin 2 x , x, 0, 2 ;
1

0.5

1 2 3 4 5 6

0.5

1
1 An introduction to Mathematica 5

Here is a plot of the sinc function, given in the previous section.


In[18]:= Plot Piecewise 1, x 0 , Sin x x , x, 2 ,2 ;
1

0.8

0.6

0.4

0.2

6 4 2 2 4 6

0.2

Here is a surface of constant negative curvature, represented parametrically by the three


functions , , and . This surface is often referred to as Dini’s surface.
In[19]:= Cos Sin ;
Sin Sin ;

0.2 Cos Log Tan ;


2

In[22]:= ParametricPlot3D , , , , 0, 4 , , .05, 1 , Axes False,


Boxed False, PlotPoints 30, AspectRatio 1.75 ;
6 An Introduction to Programming with Mathematica

Working with data


The ability to plot and visualize data is extremely important in engineering and all of the
social, natural, and physical sciences. Mathematica can import and export data from other
applications, plot the data in a variety of forms, and be used to perform numerical analysis
on the data.
The file dataset.m contains pairs of data points, in this case representing body
mass vs. heat production for 13 different animals. The data are given as (m, r), where m
represents the mass of the animal and r the heat production in kcal per day. First we set up
a platform independent path to the file and then import that file.
In[23]:= datafile ToFileName $BaseDirectory,
"Applications", "IPM3", "DataFiles" , "dataset.m"
Out[23]= C:\Documents and Settings\All Users\Application Data\
Mathematica\Applications\IPM3\DataFiles\dataset.m

In[24]:= data Import datafile, "Table"


Out[24]= 0.06099, 6.95099 , 0.403, 28.189 ,
0.62199, 41.1 , 2.50999, 120.799 ,
2.95999, 147.9 , 3.33, 182.8 , 8.19999, 368.8 ,
28.1999, 981.299 , 57.4, 1303.29 , 72.2999, 1512.5 ,
340.199, 7100.29 , 711, 10101.1 , 5000., 29894.9

You can immediately plot the data using the ListPlot function.
In[25]:= ListPlot data, PlotStyle PointSize .02 ;
17500

15000

12500

10000

7500

5000

2500

200 400 600 800


1 An introduction to Mathematica 7

This plots the data on log–log axes.


In[26]:= logplot ListPlot Log data , PlotStyle PointSize .02 ;
10

2 2 4 6 8

You can then fit a straight line to the log-data by performing a linear least squares fit. In
this example, we are fitting to the model a m x, where a and m are the parameters to be
determined in the model with variable x.
In[27]:= f FindFit Log data , a m x, a, m , x
Out[27]= a 4.15437, m 0.761465

Here is a plot of the linear fit function.


In[28]:= fplot Plot a m x . f, x, 3, 9 ;

10

2 2 4 6 8
8 An Introduction to Programming with Mathematica

Finally, you can see how well the fitted function approximates the log plot by combining
these last two graphics.
In[29]:= Show fplot, logplot ;

10

2 2 4 6 8

Programming
With a copy of The Mathematica Book (Wolfram 2003) or one of the many tutorial books
(see, for example, Glynn and Gray 1999) describing the vast array of computational tasks
that can be performed with Mathematica, it would seem you can compute just about
anything you might want. But that impression is mistaken. There are simply more kinds of
calculations than could possibly be included in a single program. Whether you are inter-
ested in computing bowling scores or finding the mean square distance of a random walk
on a torus, Mathematica does not have a built-in function to do everything that a user could
possibly want. What it does have – and what really makes it the amazingly useful tool it is –
is the capability for users to define their own functions. This is called programming, and it
is what this book is all about.
Sometimes, the programs you create will be succinct and focused on a very specific
task. Mathematica possesses a rich set of tools that enable you to quickly and naturally
translate the statement of a problem into a program. For example, the following program
defines a test for perfect numbers, numbers that are equal to the sum of their proper
divisors.
In[30]:= PerfectQ n_ : Apply Plus, Divisors n 2n
We then define another function that selects those numbers from a range of integers that
pass this PerfectQ test.
In[31]:= PerfectSearch n_ : Select Range n , PerfectQ
1 An introduction to Mathematica 9

This then finds all perfect numbers less than 1,000,000.


In[32]:= PerfectSearch 106
Out[32]= 6, 28, 496, 8128

Here are two functions for representing regular polygons. The first defines the
vertices of a regular n-gon, while the second uses those vertices to create a polygon graph-
ics object that can then be displayed with the built-in Show function.
In[33]:= vertices n_Integer, r_: 1 :
2 2
Table r Cos , r Sin , , 0, n 1
n n

In[34]:= RegularPolygon n_ :
Graphics Line vertices n . a_, b__ a, b, a ,
AspectRatio Automatic

In[35]:= Show RegularPolygon 5

Out[35]= Graphics

As another example of a succinct program, here is an iterative function that imple-


ments the well-known Newton method for root finding.
f #
In[36]:= NewtonZero f_, xi_ : NestWhile # &, xi, Unequal, 2
f' #

In[37]:= g x_ : x3 2 x2 1

In[38]:= NewtonZero g, 2.0


Out[38]= 1.61803

Of course, sometimes the task at hand requires a more involved program, stretching
across several lines (or even pages) of code. For example, here is a slightly longer program
to compute the score of a game of bowling, given a list of the number of pins scored by
each ball.
10 An Introduction to Programming with Mathematica

In[39]:= BowlingScore pins_ :


Module score , score x_, y_, z_ : x y z;
score 10, y_, z_, r___ : 10 y z score y, z, r ;
score x_, y_, z_, r___ :
x y z score z, r ;x y 10;
score x_, y_, r___ : x y score r ; x y 10;
score If pins 2 pins 1 10, pins, Append pins, 0
Here is the computation for a “perfect” game – 12 strikes in a row.
In[40]:= BowlingScore 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Out[40]= 300

These examples use a variety of programming styles: functional programming,


rule-based programming, the use of anonymous functions, and more. We do not expect
you to understand the examples in this section at this point – that is why we wrote this
book! What you should understand is that in many ways Mathematica is designed to be as
broadly useful as possible and that there are many calculations for which Mathematica does
not have a built-in function, so, to make full use of its many capabilities, you will some-
times need to program. The main purpose of this book is to show you how.
Another purpose is to teach you the basic principles of programming. These princi-
ples – making assignments, defining rules, using conditionals, recursion, and iteration – are
applicable (with great differences in detail, to be sure) to all other programming languages.

Symbolic and interactive documents


In addition to the computational tools that Mathematica provides for what many profession-
als associate with technical computing, it also contains tools for creating and modifying the
user interface to such tasks. These tools include hyperlinks for jumping to other locations
within a document or across files, buttons to perform tasks that you might normally
associate with a command-line interface, and tools to modify and manipulate the appear-
ance and functionality of your Mathematica notebooks directly. In this section we will give
a few short examples of what is possible, waiting until Chapter 10 for a methodical look at
how to program these elements.
The first example takes the code necessary to display a polyhedron and puts it in a
button. The two lines of code that could be evaluated normally in a notebook first load a
package and then display an icosahedron in the notebook.
In[41]:= Needs "Graphics`Polyhedra`"
1 An introduction to Mathematica 11

In[42]:= Show Stellate Polyhedron Icosahedron

Out[42]= Graphics3D

Here is a short program that creates a button containing the above two expressions.

Cell[BoxData[
ButtonBox[
RowBox[{"Stellate", " ", "Icosahedron"}],
ButtonFunction:>CompoundExpression[
Needs[ "Graphics`Polyhedra`"],
Show[Stellate[Polyhedron[Icosahedron]]]
],
ButtonEvaluator->Automatic],
"Input",
Active->True]

The formatted version of the above cell can be displayed by choosing Show Expression
from the Format menu. When you do that, it will look like the following:

Stellate Icosahedron

Clicking the button will cause the Mathematica code in the ButtonFunction to be
immediately evaluated and the following graphics will then be displayed in your notebook.
Functions are available to jump around to different parts of a Mathematica notebook
and perform various actions. Here is a short piece of code that creates a button which,
upon being clicked, moves the selection to the next cell and then evaluates that cell.
12 An Introduction to Programming with Mathematica

Cell[TextData[{
Cell[BoxData[
ButtonBox["EVALUATE",
ButtonFunction:>FrontEndExecute[ {
FrontEnd`SelectionMove[
ButtonNotebook[ ], All, ButtonCell],
FrontEnd`SelectionMove[
ButtonNotebook[ ], Next, Cell],
FrontEnd`SelectionEvaluate[
ButtonNotebook[ ]]}],
Active->True]]],
StyleBox[" MATHEMATICA INPUT"]
}], "Text"]

The formatted version of the above cell can be displayed by choosing Show Expression
from the Format menu. When you do that, it will look somewhat like the following
(although we have removed some of the text formatting above to improve readability of the
code). Clicking the EVALUATE button will cause the input cell immediately following to
be selected and then evaluated.

EVALUATE MATHEMATICA INPUT

In[43]:= 3 4 5
Out[43]= 27

The following example demonstrates how you can use Mathematica functions to
perform some of the user interface actions that you would normally associate with key-
board and mouse events. By using such techniques, you can create a specific set of actions
that will follow certain evaluations. For example, if you were creating an electronic quiz for
your students, you could include “hint” buttons within your class notebooks that would
open a new notebook with hints and suggestions upon clicking.
This creates a new notebook that contains three cells – a Section cell, a Text cell,
and an Input cell. Upon evaluation, the NotebookPut command below will cause a new
notebook to appear, containing the three specified cells. The screen shots below show
what appears in the user interface after evaluating each of the preceding inputs.
1 An introduction to Mathematica 13

In[44]:= nb NotebookPut
Notebook
Cell "Symbolic and Interactive Documents", "Section" ,
Cell "Cells and notebooks are Mathematica expressions.",
"Text" ,
Cell "Integrate Sin x Cos x ,x ", "Input"

Out[44]= NotebookObject Untitled 1

This moves the selection bar past the last cell in the above notebook.
In[45]:= SelectionMove nb, Next, Cell, 4
14 An Introduction to Programming with Mathematica

We then select the most previous cell.


In[46]:= SelectionMove nb, Previous, Cell

Finally, we evaluate the selected cell.


In[47]:= SelectionEvaluate nb

In Chapter 10 we will give a detailed discussion of how to modify and manipulate the
user interface through the use of the symbolic programming techniques that are discussed
throughout this book.
1 An introduction to Mathematica 15

1.2 Using Mathematica


Before you can do any serious work, you will need to know how to get a Mathematica
session started, how to stop it, and how to get out of trouble when you get into it. These
procedures depend somewhat on the system you are using. You should read the system-spe-
cific information that came with your copy of Mathematica; and you may need to consult a
local Mathematica guru if our advice here is not applicable to your system.

Getting into and out of Mathematica


The most commonly used interface is often referred to as a notebook interface in which
the user creates and works in interactive documents. Personal computers running Win-
dows, Macintosh operating systems, Linux, and most flavors of Unix all support this
graphical user interface, which normally starts up automatically when you begin your
Mathematica session.
There are some situations where you may want to start up Mathematica from a
command prompt and issue commands directly through that interface, bypassing the
notebook interface entirely. For example, you may have a very long computation that you
need to run in batch mode. Typically, Mathematica is started up on these systems by typing
math at a command prompt. We will not discuss using Mathematica through a command
prompt any further. If you are interested in this mode you should consult the documenta-
tion that came with your copy of Mathematica.

Starting Mathematica and first computations


To start Mathematica you will have to find and then double-click on the Mathematica icon
on your computer, which will look something like this:

The computer will then load parts of Mathematica into its memory and soon a blank
window will appear on the screen. This window is the visual interface to a Mathematica
notebook and it has many features that are useful to the user.
Notebooks allow you to write text, perform computations, write and run programs,
and create graphics all in one document. Notebooks also have many of the features of
common word processors, so those familiar with word processing will find the notebook
interface easy to learn. In addition, the notebook provides features for outlining material
which you may find useful for giving talks and demonstrations.
16 An Introduction to Programming with Mathematica

When a blank notebook first appears on the screen (either from just starting Mathe-
matica or from selecting New in the File menu), you can start typing immediately. For
example, if you type N[Pi,200] press (hold down the Shift key while pressing
the Enter key) to evaluate an expression. Mathematica will evaluate the result and print the
200-decimal digit approximation to on the screen.

Notice that when you evaluate an expression in a notebook, Mathematica adds input
and output prompts. In the example notebook above, these are denoted In[1]:= and
Out[1]=. These prompts can be thought of as markers (or labels) that you can refer to
during your Mathematica session.
1 An introduction to Mathematica 17

You should also note that when you started typing Mathematica placed a bracket on
the far right side of the window that enclosed the cell that you were working in. These cell
brackets are helpful for organizational purposes within the notebook. Double-clicking on
cell brackets will open any collapsed cells, or close any open cells as can be seen in the
previous screen shot.
Double-clicking on the cell bracket containing the 1.1 A Brief Overview of Mathe-
matica cell will open the cell to display its contents:

Using cell brackets in this manner allows you to organize your work in an orderly
manner, as well as to outline material. For a complete description of cell brackets and
many other interface features, you should consult the documentation that came with your
version of Mathematica.
For information on other features such as saving, printing, and editing notebooks,
consult the manuals that came with your version of Mathematica.

Entering input
New input can be entered whenever there is a horizontal line that runs across the width of
the notebook. If one is not present where you wish to place an input cell, move the cursor
up and down until it changes to a horizontal bar and then click the mouse once. A horizon-
tal line should now appear across the width of the window. You can immediately start
typing and an input cell will be created.
18 An Introduction to Programming with Mathematica

Input can be entered exactly as it appears in this book. To get Mathematica to evalu-
ate an expression that you have entered, press - ; that is, hold down the Shift key
and then press the Enter key.
You can enter mathematical expressions in a traditional looking two-dimensional
format using either palettes for quick entry of template expressions, or keyboard equiva-
lents. For example, the following expression can be entered by using the Basic Input
palette, or through a series of keystrokes. For details of inputting mathematical expres-
sions, read your user documentation or read the section on 2D Expression Input in the
Help Browser.
1
In[1]:= x
1 x3
1 2x
ArcTan 1 1
3
Out[1]= Log 1 x Log 1 x x2
3 3 6

As noted previously, Mathematica enters the In and Out prompts for you. You do
not type these prompts. You will see them after you evaluate your input.
You can refer to the result of the previous calculation using the symbol %.
In[2]:= 264
Out[2]= 18446744073709551616

In[3]:= % 1
Out[3]= 18446744073709551617

You can also refer to the result of any earlier calculation using its Out[i] label or,
equivalently, %i.
In[4]:= Out 1
1 2x
ArcTan 1 1
3
Out[4]= Log 1 x Log 1 x x2
3 3 6

In[5]:= %2
Out[5]= 18446744073709551616

Ending a Mathematica session


To end your Mathematica session, choose Exit from the File menu. You will be prompted
to save any unsaved open notebooks.
1 An introduction to Mathematica 19

Getting out of trouble


From time to time, you will type an input which will cause Mathematica to misbehave in
some way, perhaps by just going silent for a long time (if, for example, you have inadvert-
ently asked it to do something very difficult) or perhaps by printing out screen after screen
of not terribly useful information. In this case, you can try to “interrupt” the calculation.
How you do this depends on your computer’s operating system:

• Macintosh: type . (the Command key and the period) and then type a

• Windows 95/98/NT/2000/XP: type . (the Alt key and the period)

• Unix: type - . and then type a and then

These attempts to stop the computation will sometimes fail. If after waiting a reason-
able amount of time (say, a few minutes), Mathematica still seems to be stuck, you will have
to “kill the kernel.” (Before attempting to kill the kernel, try to convince yourself that the
computation is really in a loop from which it will not return and that it is not just an
intensive computation that requires a lot of time.) Killing the kernel is accomplished by
selecting Quit Kernel from the Kernel menu. The kernel can then be restarted without
killing the front end by first selecting Start Kernel Local under the Kernel menu, or you
can simply evaluate a command in a notebook and a new kernel should start up
automatically.

The syntax of inputs


You can enter mathematical expressions in a linear syntax using arithmetic operators
common to almost all computer languages.
In[6]:= 39 13
Out[6]= 3

Alternately, you can enter this expression in the traditional form by typing 39, / , then
13.
39
In[7]:=
13
Out[7]= 3

The caret (^) is used for exponentiation.


In[8]:= 2^5
Out[8]= 32
20 An Introduction to Programming with Mathematica

You can enter this expression in a more traditional typeset form by typing 2, ^ , and
then 5.
In[9]:= 25
Out[9]= 32

Mathematica includes several different ways of entering typeset expressions, either


directly from the keyboard as we did above, or via palettes available from the File menu.
Below is a brief table showing some of the more commonly used typeset expressions and
how they are entered through the keyboard. You should read your documentation and
become comfortable using these input interfaces so that you can easily enter the kinds of
expressions in this book.

Expression FullForm Keyboard shortcut


x2 SuperscriptBox x, 2 x 6, 2
xi SubscriptBox x, i x ,i
x
y
FractionBox x, y x ,y

x SqrtBox x 2, x
x y GreaterEqual x, y x ,y

Table 1.1: Entering typeset expressions

You can indicate multiplication by simply putting a space between the two factors, as
in mathematics. You can also use the asterisk (*) for that purpose, as is traditional in most
computer languages.
In[10]:= 25
Out[10]= 10

In[11]:= 2 5
Out[11]= 10

Mathematica also gives operations the same precedence as in mathematics. In particu-


lar, multiplication and division have a higher precedence than addition and subtraction, so
that 3 + 4 * 5 equals 23 and not 35.
In[12]:= 3 45
Out[12]= 23
1 An introduction to Mathematica 21

Functions are also written as they are in mathematics books, except that function
names are capitalized and their arguments are enclosed in square brackets.
In[13]:= Factor x5 1

Out[13]= 1 x 1 x x2 x3 x4

Almost all of the built-in functions are spelled out in full, as in the above example.
The exceptions to this rule are well-known abbreviations such as D for differentiation,
Sqrt for square roots, Log for logarithms, and Det for the determinant of a matrix.
Spelling out the name of a function in full is quite useful when you are not sure whether a
function exists to perform a particular task. For example, if we wanted to compute the
conjugate of a complex number, an educated guess would be:
In[14]:= Conjugate 3 4
Out[14]= 3 4

Whereas square brackets [ and ] are used to enclose the arguments to functions,
curly braces { and } are used to indicate a list or range of values. Lists are a basic data type
in Mathematica and are used to represent vectors and matrices (and tensors of any dimen-
sion), as well as additional arguments to functions such as in Plot and Integrate.
In[15]:= a, b, c . x, y, z
Out[15]= ax by cz

In[16]:= Plot Sin x 2 Sin x , x, 2 ,2 ;


1

0.5

6 4 2 2 4 6

0.5

In[17]:= Integrate[Cos[x], {x, a, b}]


Out[17]= Sin a Sin b

In the Plot example, the list {x,-2 ,2 } indicates that the function
sin x 2 sin x is to be plotted over an interval as x takes on values from 2 to 2 .
The Integrate expression above is equivalent to the mathematical expression
b
a
cos x x.
22 An Introduction to Programming with Mathematica

Mathematica has very powerful list-manipulating capabilities that will be explored in


detail in Chapter 3.
When you end an expression with a semicolon (;), Mathematica computes its value
but does not display it. This is very helpful when the result of the expression would be very
long and you do not need to see it. In the following example, we first create a list of the
integers from 1 to 10,000, suppressing their display with the semicolon, and then compute
their sum and average.
In[18]:= nums Range 10000 ;

In[19]:= Apply[Plus, nums]


Out[19]= 50005000

%
In[20]:=
Length nums
10001
Out[20]=
2
An expression can be entered on multiple lines, but only if Mathematica can tell that
it is not finished after the first line. For example, you can enter 3* on one line and 4 on the
next.
In[21]:= 3 *

4
Out[21]= 12

But you cannot enter 3 on the first line and *4 on the second.
In[22]:= 3
*4
Out[22]= 3

If you use parentheses, you can avoid this problem.


In[23]:= (3
*4)
Out[23]= 12

With the notebook interface, you can input as many lines as you like within an input
cell; Mathematica will evaluate them all when you enter still obeying the rules
stated above for any incomplete lines.
1 An introduction to Mathematica 23

Finally, you can enter a comment – some words that are not evaluated – by entering
the words between (* and *).
In[24]:= D[Sin[x], (* differentiate Sin[x] *)
{x, 1}] (* with respect to x once *)
Out[24]= Cos x

Alternate input syntax


There are several different ways to write expressions in Mathematica. Usually, you will
simply use the traditional notation, fun[x], for example. But you should be aware of
several alternatives to this syntax that are widely used.
Here is an example using the standard function notation for writing a function with
one argument.
In[25]:= N
Out[25]= 3.14159

This uses a prefix operator.


In[26]:= N
Out[26]= 3.14159

Here is a postfix operator notation.


In[27]:= N
Out[27]= 3.14159

For functions with two arguments, you can use an infix notation. The following
expression is identical to N[ ,30].
In[28]:= N 30
Out[28]= 3.14159265358979323846264338328

Finally, many people prefer to use a more traditional syntax when entering and
working with mathematical expressions. You can compute an integral using standard
Mathematica syntax.
In[29]:= Integrate 1 Sin x , x
x x
Out[29]= Log Cos Log Sin
2 2
24 An Introduction to Programming with Mathematica

The same integral, represented in a more traditional manner, can be entered from palettes
or keyboard shortcuts.
1
In[30]:= x
Sin x
x x
Out[30]= Log Cos Log Sin
2 2
Many mathematical functions have traditional symbols associated with their opera-
tions and when available these can be used instead of the fully spelled-out names. For
example, you can compute the intersection of two sets using the Intersection function.
In[31]:= Intersection a, b, c, d, e , b, f, a, z
Out[31]= a, b

Or you can do the same computation using more traditional notation.


In[32]:= a, b, c, d, e b, f, a, z
Out[32]= a, b

To learn how to enter these and other notations quickly, either from palettes or
directly from the keyboard using shortcuts, refer to the 2D Expression Input section in the
Front End category of the Help Browser.

The front end and the kernel


When you work in Mathematica you are actually working with two separate programs.
They are referred to as the front end and the kernel. The front end is the user interface. It
consists of the notebooks that you work in together with the menu system, palettes (which
are really just notebooks), and any element that accepts input from the keyboard or mouse.
The kernel is the program that does the calculations. So a typical operation between the
user (you) and Mathematica consists of the following steps, where the program that is
invoked in each step is indicated in parentheses:

• enter input in the notebook (front end)

• send input to the kernel to be evaluated by pressing - (front end)

• kernel does the computation and sends it back to the front end (kernel)

• result is displayed in the notebook (front end)

There is one remaining piece that we have not yet mentioned; that is MathLink.
Since the kernel and front end are two separate programs, a means of communication is
1 An introduction to Mathematica 25

necessary for these two programs to “talk” to each other. That communication protocol is
called MathLink and it comes bundled with Mathematica. It operates behind the scenes,
completely transparent to the user.
MathLink is a very general communications protocol that is not limited to communi-
cation between the front end and the kernel, but can also be used to set up communication
between the front end and other programs on your computer, programs like compiled C
and Fortran code. It can also be used to connect a kernel to a word processor or spread-
sheet or many other programs.
MathLink programming is beyond the scope of this book, but if you are interested,
there are several books and articles that discuss it (see the References at the end of this
book).

Errors
In the course of using and programming in Mathematica, you will encounter various sorts
of errors, some obvious, some very subtle, some easily rectified, and others not. We have
already mentioned that it is possible to send Mathematica into an infinite loop from which
it cannot return. In this section, we discuss those situations where Mathematica does finish
the computation, but without giving you the answer you expected.
Perhaps the most frequent error you will make is misspelling the name of a function.
Here is an illustration of the kind of thing that will usually happen in this case.
In[33]:= Sine 1.5
General::spell :
Possible spelling error: new symbol name "Sine" is
similar to existing symbols Line, Sin, Sinh . More…

Out[33]= Sine 1.5

Whenever you type a name that is close to an existing name, Mathematica will print a
warning message like the one above. You may often use such names intentionally, in which
case these messages can be annoying. In that case, it is best to turn off the warnings.
In[34]:= Off General::spell
Now, Mathematica will not report that function names might be misspelled; and,
when it cannot find a definition associated with a misspelled function, it returns your input
unevaluated.
In[35]:= Intergate x2 , x

Out[35]= Intergate x2 , x
26 An Introduction to Programming with Mathematica

You can turn these spell warnings back on by evaluating On[General::spell].


In[36]:= On General::spell
Having your original expression returned unevaluated – as if this were perfectly
normal – is a problem you will often run into. Aside from misspelling a function name, or
simply using a function that does not exist, another case where this occurs is when you give
the wrong number of arguments to a function, especially to a user-defined function. For
example, the BowlingScore function takes a single list argument; if we accidentally leave
out the list braces, then we are actually giving BowlingScore 12 arguments.
In[37]:= BowlingScore 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Out[37]= BowlingScore 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10

Of course, some kinds of inputs cause genuine error messages. Syntax errors, as
shown above, are one example. The built-in functions are designed to usually warn you of
such errors in input. In the first example below, we have supplied the Log function with an
incorrect number of arguments (it expects one or two arguments only). In the second
example, FactorInteger operates on integers only and so the real number argument
causes the error condition.
In[38]:= Log 2, 16, 3
Log::argt : Log called with 3
arguments; 1 or 2 arguments are expected. More…

Out[38]= Log 2, 16, 3

In[39]:= FactorInteger 12.5


FactorInteger::facn : Argument 12.5` in
FactorInteger 12.5 is not an exact number. More…

Out[39]= FactorInteger 12.5

Getting help
Mathematica contains a vast array of documentation that you can access in a variety of
ways. It is also designed so that you can create new documentation for your own functions
and program in such a way that users of your programs can get help in exactly the same
way as they would for Mathematica’s built-in functions.
If you are aware of the name of a function but are unsure of its syntax or what it does,
the easiest way to find out about it is to evaluate ?function. For example, here is the
usage message for ParametricPlot.
1 An introduction to Mathematica 27

In[40]:= ?ParametricPlot
ParametricPlot fx, fy , u, umin, umax produces a parametric
plot of a curve with x and y coordinates fx and fy generated
as a function of t. ParametricPlot fx, fy , gx, gy , ... ,
u, umin, umax plots several parametric curves. More…

Also, if you were not sure of the spelling of a command (Integrate, for example),
you could type the following to display all built-in functions that start with Integ.
In[41]:= ?Integ*

System`
Integer IntegerExponent IntegerQ Integrate
IntegerDigits IntegerPart Integers

Clicking on one of these links will produce a short usage statement about that
function. For example, if you were to click on the Integrate link, here is what would be
displayed in your notebook.
Integrate f, x gives the indefinite integral of f with respect
to x. Integrate f, x, xmin, xmax gives the definite
integral of f with respect to x from xmin to xmax. Integrate
f, x, xmin, xmax , y, ymin, ymax gives a multiple
definite integral of f with respect to x and y. More…

Clicking the More… hyperlink would take you directly to the Help Browser where a
much more detailed explanation of this function can be found.
You can also get help by highlighting any Mathematica function and pressing the F1
key on your keyboard. This will take you directly into the documentation for that function
in the Help Browser.

The Help Browser


Mathematica contains a very useful addition to the help system called the Help Browser.
The Help Browser allows you to search for functions easily and it provides extensive
documentation and examples.
To start the Help Browser, select Help Browser… under the Help menu. You should
quickly see something like the following:
28 An Introduction to Programming with Mathematica

Notice the eight category tabs near the top of the Help Browser window. Choosing
the Add-ons & Links tab will give you access to all of the packages that come with each
implementation of Mathematica. Similarly, choosing The Mathematica Book tab will give
you access to the entire Mathematica book that ships with each professional version of
Mathematica.
Suppose you were looking for information about three-dimensional parametric
graphics. First click the Built-in Functions tab, then select Graphics and Sound on the left,
then 3D Plots and finally ParametricPlot3D. The Help Browser should look like this:

Notice that in the main window, the Help Browser has displayed information about
the ParametricPlot3D function. This is identical to the usage message you would get
if you entered ?ParametricPlot3D.
1 An introduction to Mathematica 29

Alternatively, you could have clicked the Master Index tab and searched for “Paramet-
ricPlot3D” or even simply “parametric” and then browsed through the index to find what
you were looking for.
Many additional features are available in the Help Browser and you are advised to
consult your documentation for a complete list and description.
2 The Mathematica language

Expressions are the basic building blocks from which everything is built. Their
structure, internal representation, and how they are evaluated are essential to under-
standing Mathematica. In this chapter we focus on the Mathematica language with
particular emphasis on the structure and syntax of expressions. We will also look at
how to define and name new expressions, how to combine them using logical opera-
tors, and how to control properties of your expressions through the use of attributes.

2.1 Expressions

Introduction
Although it may appear different at first, everything that you will work with in Mathematica
has a similar underlying structure. This means things like a simple computation, a data
object, a graphic, the cells in your Mathematica notebook, even your notebook itself, all
have a similar structure – they are all expressions, and an understanding of expressions is
essential to mastering Mathematica.

Internal forms of expressions


When doing a simple arithmetic operation such as 3 4 5, you are usually not concerned
with exactly how a system such as Mathematica actually performs the additions or multiplica-
tions. Yet you will find it extremely useful to be able to see the internal representation of
such expressions as this will allow you to manipulate them in a consistent and powerful
manner.
Internally, Mathematica groups the objects that it operates on into different types:
integers are distinct from real numbers; lists are distinct from numbers. One of the reasons
that it is useful to identify these different data types is that specialized algorithms can be
used on certain classes of objects that will help to speed up the computations involved.
32 An Introduction to Programming with Mathematica

The Head function can be used to identify types of objects. For numbers, it will
report whether the number is an integer, a rational number, a real number, or a complex
number.
1
In[1]:= Head 7 , Head , Head 7.0 , Head 7 2
7
Out[1]= Integer, Rational, Real, Complex

In fact, every Mathematica expression has a Head that gives some information about
that type of expression.
In[2]:= Head a b
Out[2]= Plus

In[3]:= Head 1, 2, 3, 4, 5
Out[3]= List

Atoms
The three basic building blocks of Mathematica – the atoms – from which every expression
is ultimately constructed are, symbols, numbers, and strings.
A symbol consists of a letter followed without interruption by letters and numbers.
For example, both f and the built-in Integrate are symbols.
In[4]:= Head f
Out[4]= Symbol

In[5]:= Head Integrate


Out[5]= Symbol

In Mathematica, built-in constants all are Symbols.


In[6]:= Head , Head , Head EulerGamma
Out[6]= Symbol, Symbol, Symbol

Symbols can consist of one or more concatenated characters so long as they do not begin
with a number.
In[7]:= Head myfunc
Out[7]= Symbol
2 The Mathematica language 33

The four kinds of numbers – integers, real numbers, complex numbers and rational
numbers – are shown in the list below.
5
In[8]:= Head 4 , Head , Head 5.201 , Head 3 4
7
Out[8]= Integer, Rational, Real, Complex

A string is composed of characters and is enclosed in quotes. They will be discussed


in detail in Section 3.5.
In[9]:= Head "Mathematica"
Out[9]= String

The structure of expressions


As mentioned earlier, everything in Mathematica is an expression. Expressions are either
atomic, as described in the previous section, or they are normal expressions, which have a
head and contain zero or more elements. Normal expressions are of the following form,
where h is the head of the expression and the ei are the elements which may themselves be
atomic or normal expressions.

h e1 , e2 , …, en

Although we indicated that you can use Head to determine the type of atomic
expressions, this is entirely general. For normal expressions, Head simply gives the head of
that expression.
In[10]:= Head a b c
Out[10]= Plus

To see the full internal representation of an expression, use FullForm.


In[11]:= FullForm a b c
Out[11]//FullForm=
Plus a, b, c

In[12]:= FullForm a, b, c
Out[12]//FullForm=
List a, b, c

The important thing to notice is that both of these objects (the sum and the list) have
very similar internal representations. Each is made up of a function (Plus and List,
34 An Introduction to Programming with Mathematica

respectively), each encloses its arguments in square brackets, and each separates its argu-
ments with commas.
Regardless of how an atomic or normal expression may appear in your notebook, its
structure is uniquely determined by its head and parts as seen using FullForm. This is
important for understanding the Mathematica evaluation mechanism which depends on the
matching of patterns based on their FullForm representation, a subject we will turn to in
detail in Chapter 6.
The number of elements in any expression is given by its length.
In[13]:= Length a b c
Out[13]= 3

Here is a more complicated expression.


In[14]:= expr Sin x a x2 bx c

Out[14]= c bx a x2 Sin x

Its head is Times because it is composed of the product of Sin[x] and the quadratic
polynomial.
In[15]:= Head expr
Out[15]= Times

Its length is 2 since it only contains two factors.


In[16]:= Length expr
Out[16]= 2

Although the FullForm of this expression is a little harder to decipher, if you look
carefully you should see that it is composed of the product of Plus[c,Times[b,x],
Times[a,Power[x,2]]] and Sin[x].
In[17]:= FullForm expr
Out[17]//FullForm=
Times Plus c, Times b, x , Times a, Power x, 2 , Sin x

There are several important differences between atomic expressions and nonatomic
expressions. While the heads of all expressions are extracted in the same way – using the
Head function – the head of an atom provides different information than the head of other
expressions. For example, the head of a symbol or string is the kind of atom that it is.
In[18]:= Head Integrate
Out[18]= Symbol
Random documents with unrelated
content Scribd suggests to you:
Cilliers, die de Kommandant was, in afwezigheid van Pieter Retief. Oom
Charel stond [116]voor zijn tent, en rookte rustig een pijp toen David
aankwam. Hij was geheel uit adem, en half stokkend, zeide hij:

„Oom Charel, die Zulu’s kom aan; hullie het al die menschen in Botha’s kamp
vermoord.”

De dappere oude krijger had niets meer noodig.

„Lager maken, die Zulu’s kom,” riep hij uit. „Trek de wagens bij elkaar,” en
zoo volgde het eene bevel na het andere. David zadelde snel zijn paard af,
en liet het los staan bij zijn wagen. Hij had thans geen tijd om voor het arme
dier te zorgen hoe graag hij dit ook wilde. Integendeel hij moest eerst helpen
zorgen voor de bescherming der vrouwen en kinderen.

Een levendig tooneel vond nu plaats. In een oogenblik waren alle handen
aan het werk om de wagens in een vasten kring te trekken, zoo na mogelijk
bij elkaar. Het volk werd gezonden om bosschen en takken te kappen, om de
openingen tusschen de wagens op te vullen. Het vee werd toen zoover
mogelijk aan een anderen kant van een nabijzijnden berg gejaagd, om uit het
gezicht der Kaffers te zijn, en daar werd het aan zijn lot overgelaten.
Geweren werden schoongemaakt, en Charel Cilliers liet de ammunitiewagen
openen en deelde kruid en lood uit.

De vrouwen waren ook hier behulpzaam; zij hielpen [117]geweren


schoonmaken, en een aantal hunner waren spoedig bezig kogels te gieten in
de daarvoor bestemde kogelvormen. Oom Charel was overal; hier gaf hij
order om een opening nog dichter te maken; hier vermaande hij de jongeren
om bedaard te schieten en goed korrel te vatten, zoodat de ammunitie niet
verspild werd want „elke kogel moet zijn Kaffer krijgen;” daar weder stelde hij
angstige vrouwen en meisjes gerust; dan ging hij naar de tent van Retief, en
troostte diens vrouw, die thans helaas, het ergste vreesde.

„Oom, Charel, waar is die kanon,” vroeg David Malan op eens.

„Mijn machtig, kerel, ik hêt die heele kanon vergeet. Hij staat daar achter bij
die tent. Loop haal hem gauw met een spul kerels dan zal ons hem hier bij
den ingang plaatsen.”
De ingang was eene kleine ruimte van zoowat 8 voet breed, die thans met
takken en bosschen dicht versperd was. Het kanon werd nu hier gebracht.
Het was een oud koperen mondstuk, op een affuit dat waarschijnlijk een oud
scheepskanon was geweest, en dat door een der trekkers was
medegebracht. Het was algemeen beschouwd geweest als een nutteloos
ding, maar heden kon het toch van nut zijn.

„Ons kan niet banja met die ding schiet,” zeide Oom Charel, „want dit vat te
veel kruit, maar als [118]die Kaffers het ons hier te warm maak, dan kan ons
een paar schoten op hen los.”

„Maar ons hêt geen kogels, Oom Charel,” zeide een der Boeren.

„Ons kan die ding met stukken lood en oud ijzer laden; hullie noem dit
schroot,” zeide de heer Alfred Smith, dien wij reeds kennen als de meester
en secretaris.

„Weet jij iets van die goed af, meester?” vroeg Charel Cilliers, die zelf maar
weinig met die „goed” te doen had gehad.

„Ja, Oom Charel, zoo’n beetje” was het antwoord van den meester. „Ik heb al
met zulke dingen gewerkt.”

In der waarheid was meester vroeger matroos op een Engelsch oorlogsschip


geweest, en had hij dus wel degelijk kennis van een kanon, en toen Oom
Charel hem nu tot „kanonnier” benoemde, wees meester spoedig dat hij zijn
baantje niet vergeten had. In een oogenblik had hij een laadstok er voor
gemaakt uit een stuk hout, en een spul oude lappen en veegde hij het kanon
uit. Hij zuiverde het zundgat, en sneed een spul stokjes, waaraan hij lapjes
deed, die als lont moesten dienen en daarop liet hij door een spul volk alle
stukken oud ijzer, pot-pooten en wat maar tot „schroot” kon dienen bij
elkander maken. Met behulp der vrouwen liet hij toen kruid- [119]en
schrootpatronen maken van oud linnen en binnen zeer korten tijd stonden er
twintig ladingen kant en klaar bij het kanon.

Al dit werk nam nauwelijks den tijd van twee uur op, want men werkte met
ijver en kracht. Geen Kaffer was nog te bespeuren, en men gebruikte den tijd
om zich nog steeds beter gereed te maken en de meest zorgvuldige
maatregelen te nemen. Er waren zoo wat negentig weerbare mannen in het
kamp, buiten de kleurlingen, en een aantal dezer had men ook gewapend
met geweren zoodat het geheel der verdedigers een goed eind over de
honderd was. Een aantal spaargeweren werden aan de vrouwen gegeven
om die aan de mannen achter de wagens te overhandigen, indien hun eigen
geweren te warm werden.

Het was bijna tien uur toen een der Boeren riep: „Daar kom hullie!” en
inderdaad op den rand, die zoowat duizend treden aan de zuidzijde van het
lager was, begon zich een dichte drom Kaffers te vertoonen.

„Op jullie plek,” riep de oude Cilliers, „moet niet schiet voor hullie op ons is.
En God, de God van Israël sta ons thans bij,” voegde hij er langzaam en
eerbiedig bij.

De Kaffers schenen op den rand eene consultatie te houden, hoe om het


kamp op de beste wijze aan [120]te vallen. Zij hadden waarschijnlijk niet
verwacht, dat zij de Boeren aldus tot weêrstand gereed zouden vinden, en
dachten dat ook hier zij hen verrast zouden hebben. Eindelijk zag men een
reusachtige Kaffer, op wiens hoofd een groote vederbos prijkte, zijn armen
zwaaien en hierop begon een deel van het Zulu-impi zich te verspreiden. Zij
vormden de twee „hoorns,” totdat het geheele lager omringd was door eenige
duizenden Zulu’s. En nu volgde een helsch lawaai, dat ontzetting in de harten
der vrouwen joeg en de mannen de tanden op elkander deed knarsen. De
Zulu’s sloegen met hunne assegaaien tegen hunne schilden, en hieven hun
oorlogskreet aan. Toen—kwamen zij met een geweldige vaart van alle zijden
op het lager aanstormen.

De Boeren lieten hen naderen tot op zestig treden van de wagens, en toen
dreunden de geweerschoten, en een honderdtal Zulu’s beten in het stof.
Doch de anderen stuitten niet, doch kwamen aan. Thans vuurde elke Boer
voor zichzelve zoo snel hij kon, en schoot ieder zijn naastbijzijnden Kaffer
neder. De strijd werd fel. De geweerschoten knalden onophoulijk, en het
geraas was oorverdoovend. Bij den ingang had Charel Cilliers tien fluksche
mannen geplaatst en deze hadden hunne handen vol, om de Zulu te beletten
door de takken en bosschen te komen. Doch [121]spoedig vormden de lijken
der gevallen Zulu’s hier een breede borstwering.
David stond voor op de wagenkist van een wagen, en elke kogel uit zijn
geweer deed een Kaffer nedertuimelen. Martje stond dicht bij hem, achter
den wagen; zij had een geladen geweer in haar hand, gereed om dit aan
David te reiken, zoodra zijn eigen geweer te warm werd. Doch dit was thans
niet noodig. De Zulu’s op zulk een ontvangst niet voorbereid, en geen kans
ziende, om door den kogelregen in het lager te komen, namen de vlucht, ten
minste voor het oogenblik, en liepen zoo snel zij konden naar het randje waar
hunne makkers, die nog geen deel aan den strijd hadden genomen, stonden.

Een groot aantal der aanvallers lagen dood of gewond voor het lager; bij
verre de meesten echter van deze waren dood.

De Zulu’s hielden nu weder raad, en zij konden dit gerust doen, want zij
waren buiten het bereik der oude Sanna’s, die niet verder schoten dan uiterst
tweehonderd treden. De Boeren kregen nu een goed half uur rust, en dit was
hun uiterst welkom, want het gevecht was hevig geweest. Tot op dit
oogenblik was er slechts een Boer licht gewond, daar een stoutmoedige
Kaffer, hem met een assegaai in den arm gestoken had. De dappere kerel
liet de wond [122]door zijne vrouw verbinden, en was daarna weer even
gereed om op zijn post te gaan.

Na verloop van een half uur begon er weder beweging onder de Kaffers te
komen. Doch ditmaal veranderden zij van tactiek. In plaats van het lager te
omringen kwamen zij nu in een dichten drom aan, en dat wel direct op de
opening van het lager. Zij hadden begrepen dat dit het zwakste punt van het
lager was, en wilden nu met geweld en door hun overmacht zich hier een
weg banen. Doch Charel Cilliers bemerkte dadelijk hun doel, hij was te veel
ervaren om zich te laten verschalken. Een twintigtal man bij de wagens
latende, liet hij al de anderen post vatten in de nabijheid van den ingang.

„Nu komt mijn tijd,” zeide meester, toen hij de Kaffers zag naderen, „jullie
moet nou voor pad geven.” En met deze woorden nam hij zijn lont in de hand
en liet de vier jonge Boeren, die hem hielpen, alles in gereedheid brengen
om het kanon weder te laden, zoodra het afgeschoten was.

De Zulu’s kwamen stadig aan, tot op een afstand van tweehonderd treden;
toen maakten zij een wilden schielijken aanval op de opening. Doch de
ontvangst die zij kregen van het thans geconcentreerde vuur der Boeren,
was geenszins malsch, en toen nu meester zijn kanon tusschen de dichte
massa afvuurde, en stukken [123]ijzer door hunne rijen heenvlogen, deinsden
zij een oogenblik terug. Maar ook net maar een oogenblik—toen kwamen zij
met vernieuwden moed aan. Doch tegen den kogelregen die thans op hen
nederkletterde en tegen de drie schoten die meester snel op hen loste, was
zelfs Zulu-moed niet bestand, en met verlies van een groot aantal dooden,
sloegen zij op wilde vlucht.

„Goed gedaan meester, dat is braaf,” riep Charel Cilliers uit toen de Zulu’s
weg waren. „Daar die Oû Griet is al te kwaai voor hullie. Maar nou moet jullie
oppas, kerels; die ergste zal nog komen. Die andere Zulu’s zal ons nou pak.”

Inderdaad waren het slechts twee regimenten der „witschilden,” of jonge


krijgers die den aanval op het lager gedaan hadden.

De Ringkoppen of Zwartschilden hadden bedaard aangekeken naar het werk


hunner jongere broeders. Nu deze geheel verslagen en moedeloos
terugkwamen, stootten zij een verachtelijk Hu! Hu! uit, en maakten zij zich
gereed om te toonen hoe spoedig zij hunnen vijand overmeesterden.

Thans volgden zij weder hun oude tactiek en onder bevel van den man met
den vederbos, begonnen zij het lager te omringen. Ieder der Boeren was nu
weder op zijn ouden post. De Zulu’s sloegen als bezetenen op hunne
schilden, en hieven [124]een ontzettenden krijgskreet aan, die het bloed in de
aderen der dapperste Boeren deed verstijven. Een storm, en de Zulu’s waren
bij de wagens. Doch de Boeren weerden zich dapper; de gedachte aan de
vrouwen en kinderen gaf hun heldenmoed. De geweren knalden zonder
ophouden. De Kaffers klommen tot op de wagens, doch vonden daar ook
hunnen dood; geen Kaffer kwam het lager binnen.
De dappere Martje schiet de Zulu neer!

David was op zijn ouden post, en Martje stond weder bij hem, met het
geladen geweer in de hand. Onze held had juist een forsche Kaffer den
doodskogel gegeven, op geen drie treden afstand, toen een tweede Kaffer,
bij den wagen opsprong, en voor David zijn geweer geladen had, den
assegaai ophief om den jongen Boer dien in de borst te boren. Davids leven
hing aan een draad. Hij trachtte instinctmatig de assegaai met zijn geweer
weg te keeren, doch hij voelde, dat de dood hem voor oogen stond. Daar
knalde een schot, en de Zulu, door een kogel in het hart getroffen, stortte
zielloos van den wagen neder. Het was Martje geweest die het schot had
gevuurd. Zij had het gevaar gezien waarin haar minnaar zweefde, en in een
oogwenk was het zware geweer aan haar schouder, en trok zij den trekker.
Doch David kon dit niet zien, want hij had geen tijd om om te kijken. Zoodra
de Kaffer nederstortte [125]laadde hij zijn geweer weder en hield hij aan met
vuren op de aanvallers.

„Martje, die ander geweer,” riep hij opeens en het dappere meisje reikte hem
dit. Zij had het weder geladen, en ontving nu het brandend heete geweer, dat
zij dadelijk begon af te koelen met koud water.

Het was inderdaad zooals Charel Cilliers gezegd had: het ergste kwam nu
eerst. Een achttal Boeren waren reeds min of meer zwaar gewond; twee
zelfs waren er gedood. Bij den ingang was de strijd het hevigst, en slechts
door het nu en dan afvuren van het kanon, dat de Zulu’s schrik inboezemde
omdat bij elk schot een aantal hunner tegelijk vielen, was men in staat deze
gevaarlijke positie te verdedigen. Op raad van Cilliers begonnen de Boeren
nu hunne geweren met „loopers” te laden, waarvan er gelukkig een geruimen
voorraad in het lager was. Op den korten afstand waren deze van meer effect
dan de kogels, en de Zulu’s vonden dit spoedig uit. Zij deden nog één
wanhopige poging om de overwinning te behalen, doch tevergeefs. Toen
sloegen zij op de vlucht; een wilde vlucht, waar geen keeren meer aan was.
Ditmaal hielden zij niet meer stil op het randje; neen zij gingen het randje
over en de jongere krijgers volgden hen zoo snel hunne voeten hen konden
dragen. [126]

De Boeren wachtten eenigen tijd om te zien of de vijand niet weder


terugkomen zou, en toen na verloop van een half uur geen vijand opdaagde,
zond Cilliers een der Boeren om te zien waar zij waren. Deze liep naar het
randje en keek behoedzaam er over. Daarop zwaaide hij zijn hoed en kwam
hij hard terugloopen.
„Oom Charel, hullie loop daar ginter over die zwart randen, en hullie loopt
nog dat het zoo barst. Terugkom zal hullie niet vandaag.”

Charel Cilliers antwoordde niet. Hij knielde neder daar in het lager, en
zwijgend volgde een ieder, mannen, vrouwen en kinderen zijn voorbeeld. En
toen ging er een dankgebed op tot den God van Abraham, van Izaäk en van
Jakob, die ook de God der Boeren was, voor de overwinning aan de
belegerden geschonken, en de redding uit hunnen nood. De stem van den
eerwaardigen, dapperen grijsaard sidderde van ontroering, en diep gevoel,
terwijl hij het gebed deed en zijn nauw hoorbaar Amen ging verloren in het
krachtig Amen! van zijne volgelingen. Zoo vochten die oude Voortrekkers;
gedurende den strijd weerden zij zich als leeuwen; na den strijd was hun
eerste gedachte om den Heer de glorie te geven van de overwinning. [127]

[Inhoud]
HOOFDSTUK XII.

Het laat zich begrijpen, dat de Boeren vermoeid waren na de inspanning


hunner krachten, en toch was er nog werk volop. Het was reeds twee uren en
men had nog niets genoten. Eerst moest men dus den inwendigen mensch
versterken, en dit werd dan ook spoedig gedaan.

Daarna moest men de gevallen vijanden begraven. Bijna dertienhonderd


Zulu’s telde men dood, behalve een vijftig- of zestigtal gewonden. Deze
werden doodeenvoudig afgemaakt, en hoewel er personen mogen zijn, die
dit wreed mogen noemen, zoo moet men niet vergeten, dat het bloed der
Boeren natuurlijk [128]kookte, en ook dat er geen gelegenheid bestond voor
hospitalen. De gewonden kregen dus een kogel voor den kop, en daarmeê
was de zaak uit.

Een aantal diepe slooten werden toen spoedig gegraven, en daarin wierp
men de dooden, die toen met aarde en steenen bedekt werden. Hierop werd
het volk gezonden om het vee in den berg bij elkander te maken, en het terug
te brengen.

Toen de nacht viel deed Charel Cilliers sterke wachten op eenigen afstand
van het lager plaatsen, want men kon niet weten of de Zulu’s misschien geen
nachtelijken aanval zouden wagen. In het lager sliep ook elk man met het
geweer naast zich, en werden groote vuren den geheelen nacht
aangehouden. Doch de nacht ging rustig voorbij en geen vijand vertoonde
zich.

Den volgenden morgen vroeg liet Cilliers een dertigtal mannen opzadelen om
hem te begeleiden naar de andere kampen, want men was angstig omtrent
het lot der andere Emigranten. Toen men bij het kamp der Krugers kwam,
bevond men dat ook de bewoners daarvan den vorigen dag een harden strijd
hadden gehad, doch dat ook daar de Zulu’s waren afgeslagen, en dit met
verlies van slechts een doode en twee gewonden aan de zijde der Boeren.
Een aantal mannen uit dit kamp sloot zich bij Cilliers [129]aan, en men trok
naar het volgende lager, dat der De Klerks. Hier hadden de Boeren zwaar
geleden; een zestal hunner was gedood en achttien waren gewond, en ware
het niet dat het slechts een betrekkelijk gering aantal Zulu’s waren, die dit
kamp hadden aangevallen, dan was de uitslag, waarschijnlijk anders
geweest, want de ammunitie in dit kamp was juist aan het opraken, toen de
Zulu’s de vlucht namen.

Nadat ook hier een twintigtal mannen zich bij den trein aangesloten hadden,
vervolgde men in treurigheid, den weg naar het kamp der Botha’s; want hier
wist men was er geen kans geweest voor de Emigranten om zich te
verdedigen.

Het tooneel, dat zich dan ook hier voor de oogen van Cilliers en zijne
metgezellen vertoonde, was dan ook een uiterst treurige. Het kamp was eene
verwoesting. Gebroken en verbrande wagens lagen overal rond; de tenten
waren tegen den grond geslagen; het huisraad lag kort en fijn op den grond
en daartusschen lagen de lijken van mannen, vrouwen en kinderen allen
gedood door de vreeselijke steek-assegaai der Zulu’s. Eenenveertig mannen,
zesenvijftig vrouwen en eenhonderd vijfentachtig kinderen, allen blanken,
waren daar ternedergestrekt, en behalve hen nog tweehonderd drieenvijftig
kleurling-dienstboden. Een twintigtal Zulu’s hadden ook [130]het leven bij den
aanval ingeschoten. George Biggar, de jonge Engelschman van de Baai, die
gekomen was om bezigheid met de Boeren te doen, lag dood op een hoop
lijken. Het vreeselijkste van dit treurig schouwspel was dat een aantal dezer
lijken vreeselijk verminkt waren.

Een tijd lang stonden Cilliers en de zijnen in zwijgen dit alles aan te kijken.
Tranen rolden langs de wangen van de meest geharde Boeren; sommigen
weenden overluid. Maar spoedig begreep men dat het thans tijd van
handelen was. Een aantal graven werden tusschen de puinhoopen
uitgehaald, ten einde de laatste eer aan de verslagenen te bewijzen. De
zeilen der tenten werden stuk gesneden om als lijkdoeken te dienen, en
daarop begon men de lijken uit te zoeken, en ze zoo goed mogelijk in het zeil
te wikkelen.

David Malan was onder degenen, die met Cilliers waren gekomen, en hij
werkte hard samen. Hij was juist bezig om met een half dozijn anderen een
hoop lijken weg te dragen, toen hij op eens een zucht hoorde. Hij keek
nauwkeurig en luisterde. De zucht werd zacht herhaald, en scheen te komen
van een jong meisje dat onder de lijken lag.
„Hier is een vrouw, die nog leeft,” riep de jongeling verbaasd uit, en op dit
geroep kwamen er een tiental Boeren aangeloopen. [131]

Men haalde het meisje van onder de lijken weg. Zij was vreeselijk gewond en
had negentien assegaai steken ontvangen. Naast haar lag een tweede
meisje en ook zij haalde nog adem, hoewel zij eenentwintig wonden had.
Men haalde water voor de twee gewonden, maar zij waren niet in staat te
drinken. Charel Cilliers was thans nader gekomen met Gert Maritz, en zij
lieten uit een stukkene katel spoedig een draagbaar maken, en zonden de
arme gewonden naar het naastbijzijnde kamp. Hier werden zij verpleegd, en
de verwondering mijner lezers zal groot wezen, als ik hen hier vertel dat
beiden het leven behielden. De namen dezer meisjes waren Johanna van der
Merwe en Catharina Prinsloo.

Niettegenstaande de uiterste zorg door de Emigranten gebruikt, werd geen


ander levend persoon gevonden, en men ging voort met de dooden te
begraven. Den geheelen dag was men daarmede bezig en de zon was juist
aan het ondergaan, toen de laatste schop aarde op de graven geworpen
werd.

Charel Cilliers wilde eenige woorden tot de verzamelden spreken, toen


iemand uitriep: „Daar kom vijf menschen te paard aan,” en allen wendden
toen hunne oogen naar de aangewezen richting, vanwaar men de ruiters met
snelheid zag aankomen.

Binnen weinige minuten waren zij bij de Boeren, [132]en nu bleken het drie
blanken en twee kleurlingen te zijn. De blanken waren de Eerwaarde Lindley,
zendeling in Natal, en Richard Wood, en John Cane twee der Engelschen die
in de Baai woonden. De kleurlingen waren hunne achterruiters. De
Eerwaarde Lindley, die Hollandsch sprak, vroeg naar den leider der Boeren,
en beiden Cilliers en Maritz traden voor.

„Ik zie dat gij hier een treurig tooneel hebt gehad,” zeide de heer Lindley, zijn
oog over de verwoesting latende gaan.

Maritz deelde daarop het gebeurde mede, en de tranen biggelden langs de


wangen van den zendeling, toen hij de treurige tijding vernam.
Na eenig zwijgen gaf hij antwoord: „Vrienden, Gods hand drukt zwaar op u,
en het spijt mij dat ik uwe droefheid slechts vermeerderen moet. Ik en mijne
vrienden zijn naar u gekomen, om u mede te deelen dat uw leider Pieter
Retief met de zijnen op verraderlijke wijze door Dingaan vermoord is.”

En daarop deelde de heer Lindley het verhaal van dien moord aan de
aanwezigen mede, zooals hij het vernomen had uit den mond van den heer
Owen de zendeling te Umkungunhlovu, die den dag na den moord gevlucht
was naar de zendelingsstatie bij de Baai.

De arme Emigranten waren sprakeloos van droefheid. [133]Geen man was er


onder hen of hij had een familiebetrekking of een dierbaren vriend verloren,
door den moord aan Retief en de zijnen aangedaan. Cilliers wenkte den
zendeling en de twee Engelschen om met hen samen te gaan en in diepe
stilte reed men naar de lagers terug. Bij elk lager scheidde het troepje
mannen dat er behoorde, zich stil af, terwijl de overigen hunnen weg
vervolgden. Het was laat in den avond toen Cilliers met hen die uit Retiefs
lager waren gekomen, het hunne bereikte in gezelschap van den heer
Lindley en de Engelschen. Het was op langzamen stap dat men het lager
binnen reed, en de teruggeblevenen zagen dadelijk dat er iets vreeselijks
gebeurd was. Doch toen de moord aan de Bushmansrivier en de dood van
den Kommandant-Generaal en de zijnen in het lager bekend werd, toen ging
er een geween en weeklachten op die hartverscheurend waren. De vrouwen
en kinderen, vele waarvan thans weduwen en weezen waren, huilden
bitterlijk; de mannen stom, stil en verslagen. Slechts een man scheen zijn
tegenwoordigheid van geest te behouden, en dat was de Eerwaarde Lindley.
Als een waardige volger van Christus ging hij van tent tot tent om
troostwoorden te spreken tot de gebrokenen van harte, en hen te wijzen op
den grooten Redder uit ellende. [134]Over het algemeen hebben de
Emigranten weinig op gehad met de zendelingen, maar eene groote
uitzondering was voorzeker de Eerwaarde Lindley, een man die zich
uitermate verdienstelijk heeft gemaakt aan de Boeren, en wiens naam dan
ook door alle Afrikaners in eere behoort gehouden te worden. Het was een
gevoel van dankbaarheid en eer voor de nagedachtenis van dien braven
man, die de Boeren bewogen een dorpje in den Vrijstaat den naam van
Lindley te geven. Moge zijn naam steeds in eere worde gehouden! [135]
[Inhoud]
HOOFDSTUK XIII.

Den dag na het verhaalde in het vorige hoofdstuk lieten Cilliers en Maritz de
andere lagers weten dat er op den daaropvolgenden dag eene groote
volksvergadering bij Retiefs lager zou worden gehouden, en dat daarna de
Eerwaarde Lindley godsdienstoefening zou houden.

Op den bepaalden dag, ’s morgens ten negen uren waren de Emigranten


dan ook allen bij elkander en vond de volksvergadering plaats. Charel Cilliers
werd weder eenstemmig tot Voorzitter gekozen, en na den heer Lindley
gevraagd te hebben om in het gebed voor te gaan, die dit dan ook op zeer
treffende [136]wijze deed, sprak de oude held met diepe ontroering de
vergadering toe, als volgt:

„Vrienden, wij zijn heden bij elkander gekomen om over gewichtige zaken te
spreken. Het is nu zoowat een jaar geleden sinds wij de Kolonie verlieten, om
van de dwingelandij der Engelsche Regeering verlost te worden. Maanden
lang hebben wij rondgezworven en ten laatste scheen het alsof wij in dit
schoone land rust zouden vinden. Maar heden, hoe treurig is het niet met ons
gesteld. Onze geliefde Kommandant-Generaal ligt met zesenzestig onzer
broeders dood bij Dingaans kraal, en op een paar uur afstand liggen een
aantal onzer broeders en zusters die de slachtoffers van den Zulu-koning zijn
geworden. Gevaren omringen ons aan alle kanten, en de Heer slechts weet
of binnen een week een onzer nog levend zal zijn, want elk oogenblik kan de
geheele Zulu macht op ons zijn. Onder zulke omstandigheden moeten wij
thans beslissen wat ons te doen staat, en om de opinie van het volk te
hooren is deze vergadering bijeengeroepen.”

Charel Cilliers ging zitten na deze weinige woorden gesproken te hebben, en


daarop sprong een zekere Jan Grobbelaar op en zeide:

„Vrienden, ons is hier in dit land gekomen om vermoord te worden, en voor


niets anders. Tegen [137]de Zulu’s als zij ons aanvallen kunnen wij ons niet
verweren. Onze ammunitie is bijna gedaan, en ik geloof dat niets anders voor
ons overblijft als om zoo spoedig mogelijk onze wagens op te pakken, en
terug te gaan naar de Kolonie. Liever nog onder de Engelschen dan om hier
vermoord te worden.”

Een paar stemmen riepen uit: „Ons zeg ook zoo. Laat ons hier dit land
uitgaan.”

Er ontstond thans plotseling eene ontroering in het lager, en in een oogenblik


waren de vrouw van Pieter Retief en de vrouw van Hendrik De Wet, wiens
man te Umkungunhlovu, en wiens zoon te Bushmansrivier gevallen waren, in
het midden van de vergadering, bij de tafel waar Charel Cilliers zat.

„Schaam jullie je niet?” riep Anna de Wet uit; „Is jullie mannen? Is daar niet
bloed gevallen, dat gewroken moet worden? Zal jullie nou weggaan, en zal
Pieter Retief en al onze mannen en kinderen daar bij Dingaans kraal liggen
en om wraak schreeuwen naar den Goeden God? En zullen al die menschen
bij Bushmansrivier vermoord zijn, en zal jullie niets doen om hunne
moordenaars te straffen? Foei, Jan Grobbelaar, jij is een lafaard, en die wat
saâm met jou schreeuw ook. Loopt! gaat terug! jullie mans, naar de Kolonie;
wij vrouwens zullen hier [138]blijven, en wij zullen zelf onze mans en
bloedverwanten wreken.”

Een aantal vrouwen en meisjes schaarden zich nu bij de twee vrouwen en


bewezen dat zij geheel met deze saamstemden.

Charel Cilliers had eenige moeite om de vrouwen tot bedaren te brengen, en


toen hem dit gelukt was, en er weder stilte heerschte stond een eerwaardige
oude man, Petrus Greyling, een der meest geachte Emigranten op, en vroeg
of hij kon spreken, waarop hij zeide:

„Vrienden, ik ben een oude man, en ik heb veel in de wereld doorleefd, maar
steeds heb ik een ding bevonden, en dat is, dat wij allen in de hand Gods
zijn, en moeten buigen onder Zijnen wil. Wat de Heer doet is welgedaan, en
drukt Zijn hand zwaar op ons, en kastijdt Hij ons dan doet Hij zulks om ons te
straffen voor onze zonden, en ons tot bekeering te brengen. God heeft ons
en ons volk thans zwaar beproefd, maar wie zal zeggen dat wij het niet
verdiend hebben? Wie kan de menigte onzer zonden tellen? Doch de Heer
kent die allen. Maar laten wij ons nederbuigen voor den Almachtigen, en
laten wij Hem ootmoedig om vergiffenis vragen voor onze vele zonden, en
God, die de Israëlieten in hunne diepste ellende niet verlaten heeft, zal ons
ook niet verlaten, en de heidenen niet over ons laten triomfeeren. [139]Laat
ons thans tot God bidden, en Oom Charel zal ons in het gebed voorgaan.”

Eerbiediglijk namen allen de hoeden af: eerbiediglijk knielde men neder. In


krachtige taal smeekte Charel Cilliers, zooals de Hoogepriester van Israël
eens deed, den Almachtigen Schepper van Hemel en Aarde, om de zonden
van dit Zijn volk te vergeven, en Zijn toorn niet op het te doen nederdalen.
„Gij weet, O Heer onze ellende; Gij kent onze omstandigheden; geen hulp is
er voor ons dan Gij alleen, O God! Wees ons dan genadig en verleen ons
Uwe hulp, in den naam van onzen Verlosser, Uwen Zoon, Jezus Christus
Amen!” Zoo sloot de brave leider zijn gebed, en daarop hief hij den 130sten
psalm aan:

„Uit diepten van ellende.”

en men zong toen het eerste en het vierde vers van dat heilig gedicht.

Nadat eenige tijd zwijgend en stil was voorbijgegaan, gedurende welke een
ieder met zijn gedachten scheen bezig te zijn, nam Cilliers weder het woord.

„Mannen, broeders,” zoo sprak hij: „ik wil u mijn gevoelens omtrent deze zaak
in het kort mededeelen. Ik zelf gevoel dat wij dit land thans niet kunnen
verlaten, zonder het bloed onzer geliefden gewroken te hebben. Doch wij zijn
thans te zwak om tegen Dingaan op te rukken. Daarom zal ik voorstellen
[140]dat boden worden gezonden naar onze vrienden en broeders te Winburg.
Toen wij vertrokken van Winburg, zeiden beide Kommandanten Potgieter en
Uys, dat, als wij hen ooit noodig hadden zij ons zouden komen helpen, en ik
ben zeker, dat als zij hooren in welken toestand wij zijn, zij dadelijk met alle
beschikbare macht zullen overkomen. Ondertusschen echter moeten wij nog
iets doen, en dat is wij moeten een Kommandant kiezen, want Retief is
helaas! er niet meer om ons aan te voeren en te leiden. Ik beschouw dat er
niemand beter geschikt is om Retiefs plaats in te nemen dan de heer Gert
Maritz en daarom zal ik hem als Kommandant voorstellen. Als er natuurlijk
andere voorstellen zijn, dan kunnen die thans gemaakt worden.”

De vergadering echter was blijkbaar van gevoelen dat de heer Cilliers de


rechte weg ingeslagen had. Maritz werd dan ook gekozen als Kommandant,
en het werd aan hem overgelaten om de boden naar Potgieter en Uys te
zenden. Deze vroeg toen om vrijwilligers om zulks te doen, en een
honderdtal mannen staken hunne handen op, waaruit de nieuwe
Kommandant er vier koos.

De heer John Cane, die gebroken Hollandsch sprak, vroeg toen verlof om
een paar woorden te zeggen en toen dit hem toegestaan werd, verklaarde
[141]hij, dat indien de Emigranten tegen Dingaan wilden optrekken, hij en de
andere Engelschen in de Baai gereed waren om hen te helpen, en dat zij met
een sterke macht der hun onderhoorige kleurlingen naar Umkungunhlovu
zouden gaan van de eene zijde, terwijl de Boeren dit van de andere zijde
konden doen, op die wijze zou men Dingaans macht verdeelen en zou hij
gemakkelijker overwonnen worden.

Charel Cilliers bedankte den heer Cane voor zijn edelmoedig offer, en men
besloot om zoodra men gereed was, de Engelschen in de Baai te doen
weten wanneer men tegen Dingaan zou optrekken.

Na nog verdere discussie waarin onder anderen besloten werd, dat de


andere Emigranten naar het lager van Retief zouden komen, daar men zich
dan gezamenlijk beter kon verdedigen tegen eenigen aanval der Zulu’s
verdaagde de vergadering.

Dien middag hield de Eerw. Lindley eene godsdienstoefening, waarin hij


eene hartroerende toespraak tot de Boeren hield, en hen wees op het lot der
Israëlieten in de woestijn, dat hij met het hunne vergeleek, voornamelijk
daarop wijzende dat God Zijne getrouwen nooit verlaat maar hen steeds op
de meest wonderbare wijze redt. Ook doopte hij een aantal kinderen. Ten
slotte gaf hij te kennen [142]dat hij verplicht was om den volgenden dag naar
de zendelingsstatie terug te gaan, doch dat hij hoopte om na verloop van
omtrent een maand terug te komen, en dat hij dan weder eene
godsdienstoefening zou houden.

Na afloop der godsdienstige plechtigheid, ging David Malan naar oom Gert
Maritz, en vroeg of de Eerw. Lindley ook huwelijken kon inzegenen.

„Ja David,” antwoordde Maritz, „ik zie niet in waarom hij dit niet zou kunnen
doen, als hij net die formulier van onze kerk volgt. Dit is goed dat je daarover
praat, want ik weet van een paar andere paren die ook willen trouwen, en ik
zal er met oom Charel en nog een paar broeders over praten.”

„Dit is goed, oom,” zeide David, „maar oom moet toch als het u belieft niet
zeggen dat ik met oom er over gesproken heb.”

Gert Maritz beloofde dit dan ook.

Vroeg den volgenden morgen reden twee troepjes ruiters het lager uit in
verschillende richtingen. De heer Lindley en de zijnen reden zuidwaarts, en
vier jonge Boeren met vier achterruiters, en eenige handpaarden, sloegen
den noordelijken weg in over de Drakensbergen naar Winburg. [143]

[Inhoud]
HOOFDSTUK XIV.

Potgieter en Uys deden niet lang naar zich wachten. Nauwelijks hadden zij
de brieven van hunne stamgenooten ontvangen, of zij maakten zich voor den
tocht gereed, en het viel hun geenszins moeielijk om de noodige
manschappen bij elkander te krijgen. Tweehonderd fluksche kerels waren in
een oogwenk gereed om hen te vergezellen en contributies in kruid en lood
als ook geweren werden in menigte aangeboden. Daar er onder de Boeren
aan de Natalzijde gebrek aan meel was, nam men ook een goede
hoeveelheid er van samen, en zoo gebeurde het dat zeven wagens met de
expeditie samen gingen. [144]

Op den 7den Maart trokken de twee Kommandanten met hunne manschappen


het lager bij Blauwkrantzrivier binnen, en eenige dagen later kwamen ook de
wagens, die men achtergelaten had aan. Potgieter en Uys waren diep
getroffen toen zij al de bijzonderheden van den moord van Retief en van het
kamp der Botha’s hoorden, en Uys zwoer een duren eed dat hij het bloed van
zijn trouwen vriend en strijdmakker zou wreken. Men begon dadelijk plannen
te maken om tegen Dingaan op te trekken, maar nu kwam, ongelukkig, de
oude jaloerschheid onder de leiders weer voor den dag. Maritz als
Kommandant der Emigranten in Natal, beschouwde zich gerechtigd om aan
het hoofd der expeditie tegen Dingaan te staan, doch hiervan wilde noch
Potgieter noch Uys iets weten, en toen de koppige Maritz op zijn recht bleef
staan, dreigden de andere twee om met de hunnen naar Winburg terug te
gaan. Te vergeefs trachtte Charel Cilliers en anderen om vrede te bewaren;
Maritz voelde zich in zijn eer gekrenkt, en daar een sterke partij der
Emigranten op zijn hand was, weigerde hij volstrekt toe te geven. Eenige
zeer ergerlijke tooneelen vonden plaats, en ten laatste werd de zaak aan het
volk verwezen. Op de vergadering voor dit doel gehouden, werden er eenige
warme discussies over de zaak gevoerd, [145]maar ten laatste kwam men tot
eene schikking. Gert Maritz zou in het lager blijven als Kommandant.
Potgieter en Uys zouden gezamenlijk tegen Dingaan optrekken, doch ieder
zou het bevel over zijn eigen afdeeling voeren. Zij zouden zooveel mogelijk
samenwerken, maar de een zou onder den ander niet staan.
Terwijl deze onaangename twisten aan den gang waren, was er eene groote
eenigheid tusschen de twee hoofdpersonen in dit verhaal, David Malan en
Martje Joubert, en die eenigheid was zoo groot, dat zij besloten om door de
Eerw. Lindley bij zijn eerstkomend bezoek één te worden gemaakt. Jacobus
Malan en diens vrouw gaven graag hunne toestemming tot hun huwelijk en
ook oom Frans en zijne vrouw hadden er niets op tegen. Het is onnoodig om
hier te zeggen, dat er geen groote preparaties voor het huwelijk werden
gemaakt; en dat van bruids-tabbertjes en strooimeisjes, die thans zoo
gewoon, zelfs bij de Boeren-huwelijken zijn, geen sprake was. Eerstens had
men in dien goeden ouden tijd niet zulke gekheden in het hoofd, en
bovendien waren de omstandigheden er niet naar. Doch het zwart zijden
tabbertje, waarin Martje’s moeder gehuwd was, werd voor den dag gehaald,
van den bodem uit Tante’s kist, en werd een beetje veranderd, [146]om het
Martje van pas te maken. En oom Jacobus zwarte kistkleeren werden door
Davids moeder insgelijks wat veranderd om als trouwpak voor den zoon te
dienen. Men was overeengekomen, dat hoewel David en Martje in hun eigen
tent zouden slapen, zij bij Martje’s ouders zouden inwonen, en aldaar zouden
eten, want Martje kon nog moeilijk door hare moeder gemist worden.

Op den 17den Maart kwam de Eerw. Lindley inderdaad naar het lager terug,
en nog dienzelfden avond hield hij kerk. Voor hij echter de
godsdienstoefening begon gaf hij kennis, dat de volgende paren zich in het
huwelijk wilden begeven (hier las hij de namen van zes paartjes voor), en dat
zoo iemand eenige objecties had tegen zulke huwelijken hij of zij daar en dan
moest opstaan, en de objecties opgeven. Doch niemand was er, die objecties
had en daarop stond Gert Maritz op en verklaarde, dat namens het volk der
Emigranten hij toestemming tot de huwelijken gaf. Deze eenvoudige wijze
volgde men, daar de toestanden niet geschikt waren voor het loopen van drie
geboden, zooals de oude wet eigenlijk vereischte.

Den volgenden morgen om tien ure was er een heel leven in het lager, om de
inzegeningen der huwelijken te zien, en wij, die thans zoo hoog op onze
[147]beschaafdheid en (ik wou bijna zeggen Engelsche) manieren roemen,
zouden zeker heel wat gelachen hebben om de kleedij van bruidegoms en
bruids. Doch dat kwam er niet op aan; de liefde was er toen even goed (en
misschien in zuiverder mate) als zij er thans is.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like