Cover Page

Symbolic Mathematics for Chemists

A Guide for Maxima Users

Fred Senese

Frostburg State University
MD, USA







Wiley Logo


To my dearest wife, Hazel, without whose tolerance, patience, support and love this book would not have been possible.

Preface

Maxima is a free open source symbolic math engine, similar to commercial systems like Mathematica, Matlab, and Maple. It can be used to symbolically solve problems in algebra, trigonometry, calculus, and differential equations. It is available for Windows, Macintosh, Linux, and Android platforms, and is directly downloaded by over 100 000 users each year. Several different graphical user interfaces are available, including wxMaxima, XMaxima, emacs, and TeXmacs. Maxima is also a component of several computer algebra systems, including Sage, SMath Studio, and the Euler Math Toolbox.

This Maxima primer focuses on problem solving, model building, and data analysis in chemistry. It can be used as a companion text for physical chemistry, courses in mathematical chemistry, or any chemistry course that requires computation and data analysis. It is not intended to be a replacement for the Maxima manual, nor is it intended to be a chemistry textbook.

Structure of the Book

Chapter 1 (Fundamentals) introduces wxMaxima, the graphical user interface for Maxima, and gives a quick tour of the General Math pane, includes dialogs for basic plotting, algebra, and calculus.

Chapter 2 (Storing and Transforming Data) explores Maxima’s data types, including numbers, strings, lists, and matrices. It also shows how Maxima can import and export data from files.

Chapter 3 (Plotting Data and Functions) shows how to use Maxima to draw scatter plots, histograms, three-dimensional surface plots, and contour plots.

Chapter 4 (Programming Maxima) focuses on writing programs that perform iterative calculations and conditionally execute commands.

Chapter 5 (Algebra) shows you how to rewrite, factor, expand, and extract pieces of expressions and equations in Maxima. It also demonstrates the solution of equations and systems of equations, and interpolation of data using polynomials and cubic splines.

Chapter 6 (Differentiation, Integration, and Minimization) uses Maxima to perform the basic operations of calculus, including computation of limits, differential expansions, derivatives, and integrals. We’ll also see how to minimize and maximize functions, find points of inflection, and compute power series and Taylor series expansions for functions.

Chapter 7 (Matrices and Vectors) applies Maxima to algebraic and differential vector and matrix calculations.

Chapter 8 (Error Analysis) uses Maxima to estimate errors in datasets and propagate them through calculations. It also shows how statistics and assumptions about the distribution of errors can be used to objectively test hypotheses about the data.

Chapter 9 (Fitting Data to a Straight Line) applies linear least-squares fits to datasets, and shows you how to assess the quality of the fit.

Chapter 10 (Fitting Data to a Curve) fits nonlinear models to data, and shows how errors in the fit parameters can be estimated using the jackknife and bootstrap methods.

Chapter 11 (Differential Equations) demonstrates symbolic, power series, and numerical solution of differential equations, as well as graphical visualization of the solutions with direction fields.

Chapter 12 (Operators and Integral Transforms) shows how quantum mechanical operators can be defined directly in Maxima. It also introduces Maxima’s powerful Fourier transform and fast Fourier transform functions.

Features of the Worksheets

A comprehensive set of worksheets form the core of the book. The worksheets address the full range of computations that students encounter in an undergraduate physical chemistry course.

The worksheets themselves are not printed in their entirety in the book. They are available for download at http://booksupport.wiley.com

Each worksheet begins with clearly defined goals and learning objectives. These will be listed both in the book and at the beginning of the worksheet, along with a detailed abstract that provides motivation and context for the material. Prerequisite and follow-up worksheets are described and linked in the abstract. Users should not have to refer to the book while using the worksheets. The presentation will be practical and conversational; rigor will be retained without burdening students with fussy details.

The worksheets are not computer programs. They do not simply plot a graph or print the answer for a textbook problem. Each worksheet is a cohesive and complete guided inquiry that uses symbolic math to illuminate a topic in chemistry.

Students will have different levels of comfort with symbolic math, and the worksheets are designed with this in mind. Step-by-step instructions and clear, detailed examples are given for beginners. Troubleshooting hints and case studies provide practical experience and foster critical thinking for those who have mastered the basics. Proficient users are offered avenues for further exploration.

The worksheets do not simply present information, like a textbook; they engage students directly by asking them to write symbolic mathematics themselves. Students aren’t simply asked to tweak the values of a few variables and observe the effect on a calculated result or graph. The focus is on critical thinking, creative problem solving, and the ability to connect concepts.

Each worksheet includes summary problems that ask students to integrate the ideas and techniques presented. The worksheets end with suggested projects for more proficient users. The projects offer new contexts for application of what has been learned, along with a bibliography for more advanced study.

Conventions Used in This Book

  • “Maxima” refers to Maxima 5.37.1 running through the wxMaxima 15.08.1 graphical user interface.
  • Code in text is typeset in Courier font. Options for commands are set in italicized Courier.
  • Maxima input lines are printed with gray background and numbered lines; and output is printed in white, with Maxima’s output labels shown in red. For example:

    (%i1) 2+2;
    (%o1) 4
  • In key sequences, spaces are shown by either image or by explicit space characters image.
  • When keys are to be pressed simultaneously, they will be separated by a plus sign; for example image+image means “press the Ctrl and c keys at the same time”.
  • The format for especially important commands are marked with a gear.
  • Maxima tries to do calculations exactly with integers and rational numbers whenever it can. By default, it prints warnings when a floating point number is converted into a rational number. The printing of these messages has been switched off in the text using ratprint: false.

Installing Maxima

Maxima for desktops can be downloaded for free at http://sourceforge.net/projects/maxima/files/. Click on the directory for your operating system (Maxima-Linux, Maxima-Windows, or Maxima-MacOS) and download the installer for the latest version.

  • The Windows download is a single self-contained .exe installer; just click on the file to start the installation.
  • The MacOS X download is a single .dmg disk image1. Double-click on the file to mount it as a disk. A window showing the contents of the disk should appear. Drag and drop the Maxima, wxMaxima, and Gnuplot applications into the Applications directory.
  • For installation instructions under Linux, see http://maxima.sourceforge.net/download.html . You must install both the maxima and maxima-exec-clisp packages.

A portable distribution of Maxima (which can be installed on a flash drive) is available. Search for “portable Maxima” to find the latest version.

An Android version of Maxima is available from Google Play at https://play.google.com/store/apps/details?id=jp.yhonda&hl=en. See https://sites.google.com/site/maximaonandroid/ for details.

Acknowledgements

I’d like to thank Frostburg State University for supporting this work, and my colleagues in the Department of Chemistry for their support and encouragement. Jerry Simon in particular made suggestions that improved the book. I would also like to thank the reviewers of the initial proposal for the book for their frank comments, and my editors Sarah Higginbotham, Sarah Keegan, Lesley Jebaraj, and Jenny Cossham for their patience and guidance. Ann Seidel did a wonderful job in creating online versions of the worksheets. I dedicate this book to my dear friends Corrie Haldane and Michelle Kaseler, who helped and supported me in innumerable ways during the writing of this book.

Note