81,99 €
An essential guide to using Maxima, a popular open source symbolic mathematics engine to solve problems, build models, analyze data and explore fundamental concepts
Symbolic Mathematics for Chemists offers students of chemistry a guide to Maxima, a popular open source symbolic mathematics engine that can be used to solve problems, build models, analyze data, and explore fundamental chemistry concepts. The author — a noted expert in the field — focuses on the analysis of experimental data obtained in a laboratory setting and the fitting of data and modeling experiments. The text contains a wide variety of illustrative examples and applications in physical chemistry, quantitative analysis and instrumental techniques.
Designed as a practical resource, the book is organized around a series of worksheets that are provided in a companion website. Each worksheet has clearly defined goals and learning objectives and a detailed abstract that provides motivation and context for the material. This important resource:
Written for advanced undergraduate and graduate students in chemistry and instructors looking to enhance their lecture or lab course with symbolic mathematics materials, Symbolic Mathematics for Chemists: A Guide for Maxima Users is an essential resource for solving and exploring quantitative problems in chemistry.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 582
Veröffentlichungsjahr: 2018
Cover
Preface
Structure of the Book
Features of the Worksheets
Conventions Used in This Book
Installing Maxima
Acknowledgements
1 Fundamentals
1.1 Getting Started With wxMaxima
1.2 A Tour of the General Math Pane
1.3 Controlling Execution
1.4 Using Packages
2 Storing and Transforming Data
2.1 Numbers
2.2 Boolean Expressions and Predicates
2.3 Lists
2.4 Matrices
2.5 Strings
3 Plotting Data and Functions
3.1 Plotting in Two Dimensions
3.2 Plotting in Three Dimensions
4 Programming Maxima
4.1 Nouns and Verbs
4.2 Writing Multiline Functions
4.3 Decision Making
4.4 Recursive Functions
4.5 Contexts
4.6 Iteration
5 Algebra
5.1 Series
5.2 Products
5.3 Equations
5.4 Systems of Equations
5.5 Interpolation
6 Differentiation, Integration, and Minimization
6.1 Limits
6.2 Differentials
6.3 Derivatives
6.4 Maxima, Minima, and Inflection Points
6.5 Integration
6.6 Power Series
6.7 Taylor Series
7 Matrices and Vectors
7.1 Vectors
7.2 Matrices
7.3 Vector Calculus
8 Error Analysis
8.1 Classifying Experimental Errors
8.2 Probability Density
8.3 Estimating Precision
8.4 Hypothesis Testing
8.5 Propagation of Error
9 Fitting Data to a Straight Line
9.1 The Ordinary Least-Squares Method
9.2 Multiple Linear Regression
9.3 WLS
9.4 Fitting Data to a Line with Errors in Both
X
and
Y
9.5 Calibration and Standard Additions
10 Fitting Data to a Curve
10.1 Transforming Data to a Linear Form
10.2 Polynomial Least-Squares Fitting
10.3 Nonlinear Least-Squares Models
10.4 Estimating Error in Nonlinear Fit Parameters
11 Differential Equations
11.1 Symbolic Solutions of ODEs
11.2 Power Series Solution of ODEs
11.3 Direction Fields
11.4 Solving Systems of Linear Differential Equations
11.5 Numerical Solution of ODEs
11.6 Solving Partial Differential Equations
12 Operators and Integral Transforms
12.1 Defining Operators
12.2 Fourier Series
12.3 Fourier Transforms
12.4 The Laplace Transform
Glossary
References
Index
End User License Agreement
Chapter 01
Table 1.1 Common mathematical functions.
Chapter 02
Table 2.1 System variables for controlling floating point calculations and results.
Table 2.2 Built-in dimensionless mathematical constants in Maxima.
Table 2.3 Some useful physical constants available in Maxima’s
physical_constants
package.
Table 2.4 Relational operators that compare the values of two expressions or variables.
Table 2.5 Predicate functions that can be used in logical tests.
Table 2.6 Useful format codes for
printf
.
Chapter 03
Table 3.1 Options to control the display of a
plot2d
plot.
Table 3.2 Special options for
plot3d
.
Table 3.3 Examples of options for
draw3d
in Maxima.
Table 3.4 Gnuplot commands for controlling contour plots.
Chapter 04
Table 4.1 Features that can be associated with a variable or function name using
declare(f,
feature
)
.
Chapter 06
Table 6.1 General-purpose
quadpack
functions for numerical integration of a function
f
of
x
over an interval [
a
,
b
].
Table 6.2 Error codes returned by
quadpack
functions.
Chapter 08
Table 8.1 Functions for performing common tasks with Poisson-distributed variables.
Table 8.2 Functions for performing common tasks with a normally distributed variable
X
with mean
μ
and standard deviation
σ
.
Chapter 09
Table 9.1 Items that can be extracted from the
linear_regression
output.
Chapter 10
Table 10.1 Nonlinear models can sometimes be cast into linear form using transformations.
Chapter 11
Table 11.1 Options for
plotdf
.
Chapter 12
Table 12.1 Operator properties that can be declared with
declare("
Aop
,"
property
)
, where
Aop
is the name of the operator.
Chapter 01
Figure 1.1 An input cell in wxMaxima divides the cell into input and output sections, with a glyph on the left that provides a way to hide output or select the cell for copying, cutting, or deleting.
Figure 1.2 The wxMaxima toolbar.
Figure 1.3 Annotating a worksheet with text blocks and comments.
Chapter 02
Figure 2.1 Points in the complex plane can be represented in either rectangular form (
) or polar form (
r
e
iθ
).
Chapter 03
Figure 3.1 Filling in the Plot 2d dialog to plot a function in Maxima.
Figure 3.2 Multiple curves on a high-resolution
plot2D
plot in Maxima. The inserted code is
plot2d([-sin(x), exp(-x), -sin(x)*exp(-x)], [x,0,3])
.
Figure 3.3 The spherical coordinates
r
,
θ
, and
ϕ
are related to the Cartesian coordinates
x
,
y
, and
z
.
Figure 3.4 The cylindrical coordinates
r
,
ϕ
, and
z
are related to the Cartesian coordinates
x
,
y
, and
z
.
Chapter 06
Figure 6.1 The value of sin(
x
)/
x
approaches one as
x
approaches zero.
Figure 6.2 The limit of the heat capacity of water as the temperature approaches the boiling point doesn’t exist; different limits are obtained by approaching the point from different directions.
Figure 6.3 The sign of the second derivative d
2
/d
x
2
can determine whether a critical point is a maximum (
), minimum (
), or inflection point (
).
Figure 6.4 Steepest descent methods find the first minimum that is “downhill” from an initial guess. For sin(
x
), an initial guess of
finds the minimum at
; an initial guess of
finds the minimum at 3π/2.
Figure 6.5 The definite integral corresponds to the area under the integrand curve.
Chapter 07
Figure 7.1 Vector components in three dimensions.
Figure 7.2 Vector addition C = A + B. The components of C are the sum of the components for A and B.
Figure 7.3 Rotation suggested by placing two vectors head-to-tail.
Figure 7.4 The cross product of two vectors points up for counterclockwise rotation and down for clockwise rotation. The length of the cross product vector is equal to the area of the shaded parallelogram.
Chapter 08
Figure 8.1 A series of measurements that contain both random and systematic errors. Systematic error shifts the average measurement away from the true value, affecting accuracy; random error scatters the measurements around their mean, affecting precision.
Figure 8.2 A cumulative distribution function (in red) gives the running area under a distribution function. The probability that the independent variable
X
is less than or equal to 1 is given by the shaded area under the distribution function, or the value of the cumulative distribution function at 1.
Figure 8.3 The 95% confidence interval for the standard normal distribution with mean zero and standard deviation 1 is [
, 1.96].
Figure 8.4 The probability of finding
t
with an absolute value greater than or equal to two is equal to the area under both tails on the
t
-distribution.
Chapter 09
Figure 9.1 Residuals
e
i
reflect the variation in the
y
i
data around
that the model does not explain.
Figure 9.2 The coefficients of determination for five different datasets, fitted to a line.
Figure 9.3
R
2
depends strongly on the variance of the independent variable. Partitioning the 300-point fit on the left into five 60-point subsets yields five
R
2
values that aren’t equal to each other or to the
R
2
of the overall fit, even though the actual data and its underlying linearity haven’t changed at all.
Figure 9.4 Systematic error (like instrument drift) can cause trends or clusters in the residuals when they are plotted against the run number.
Figure 9.5 Trends in residuals sometimes show flaws in a model equation. There may be a missing variable, or a missing higher order term or interaction for variables already included.
Figure 9.6 A non-normal distribution can lead to multiple outliers on a residuals plot. If the outliers aren’t symmetrically distributed, they will strongly distort the fit, as in the plot on the right.
Figure 9.7 Megaphones, footballs, and butterflies: when the standard deviation isn’t the same for all points, structures like these can appear on residual plots. The plot on the far right has a second problem; a line is being fit to curved data.
Figure 9.8 Is the dragonfly pattern in these residuals real, or is it just the result of random chance? Random error can obscure trends in the residuals, making interpretation of a scatter plot difficult. Objective statistical lack-of-fit tests can be helpful in cases like this.
Figure 9.9 When the model isn’t flexible enough to fit the data, or if it has the wrong form, the residual variance
s
2
will be larger than the error variance
σ
2
.
Figure 9.10 Both leverage and residual sizes determine the influence of a point on a fit. In (a), 49 points are fitted to a line. In (b) a 50-th point (red) with a large residual but low leverage is added; it changes the slope and intercept slightly. In (c), a point with a small residual but high leverage is added; again, the influence of the point on the fit is relatively small. In (d) a point with a large residual with high leverage is added. The fit is severely distorted.
Figure 9.11 Leverages for the data in Figure 9d. Two points are above the 2
p
/
N
cutoff (the red dashed line).
Figure 9.12 ESRs can identify outliers that the raw residuals miss. In the
xy
data on the top left plot, a plot of the raw residuals against
x
(top right) shows that the residual of the outlier isn’t much different from the residuals of the other points. Plotting the ESRs against
x
(bottom) clearly picks out the outlier.
Figure 9.13 Plot of ESRs against leverage for the data in Figure 9.10a. There are a few outliers with high ESRs, but their leverage is low that they won’t influence the fit. There is a lone point with high leverage and a moderate ESR that should be checked; it will have a much stronger influence on the fit than the other points.
Figure 9.14 In ordinary least-squares, we minimize the sum of the squared
y
residuals,
(left). When the error in
x
isn’t negligible, we have to minimize the sum of squared point-to-line distances,
.
Figure 9.15 Comparison of TLS and OLS fits with Pearson’s data, with Young’s weights. The TLS line minimizes both the
x
and
y
residuals, subject to the weights assigned in both the
x
and
y
directions; the OLS line minimizes only the
y
residuals, and treats all points as equally important.
Figure 9.16 Plot of the estimated standard error in calibrated values of
x
for an OLS fit of Pearson’s data, with and without the covariance term. Neglecting the covariance seriously overestimates the error with this data, especially for high values of
x
.
Figure 9.17 (a) Imprecision contours and 95% confidence contours for reading
x
from an OLS fit (using Pearson’s data). The contours are very gently curved. (b) Reading the confidence contours. If
, the value of
x
read from the fit line is 4, with a 95% confidence interval that stretches from about 2.8 to 5.2.
Chapter 10
Figure 10.1 Overfitting a set of four points.
Chapter 11
Figure 11.1 General solutions of Equation (11.7) when (a)
, (b)
, and (c)
.
Figure 11.2 Direction field for the first-order ODE in Equation (11.2).
Figure 11.3 Direction field for the first-order ODE in Equation (11.2), with a particular solution that passes through the point with
and [A] = 1 drawn in red.
Figure 11.4 The
plotdf
toolbar. From left to right, the icon functions are (1) close the window, (2) manipulate the ODE in use and plot new trajectories, (3) refresh the plot, (4) save the plot as a Postscript file, (5) zoom in, (6) zoom out, (7) plot the two variables in a pair of coupled autonomous equations against time (see Section 11.3.2), and (8) view help for
plotdf
.
Figure 11.5 Direction field for the first-order ODE in Equation (11.2), with a family of solution curves shown in red.
Cover
Table of Contents
Begin Reading
iii
iv
v
xiii
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
Fred Senese
Frostburg State UniversityMD, USA
This edition first published 2019© 2019 John Wiley & Sons Ltd
All rights reserved. No part of this publication maybe reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by law. Advice on how to obtain permission to reuse material from this title is available at http://www.wiley.com/go/permissions.
The right of Fred Senese to be identified as the author of this work has been asserted in accordance with law.
Registered OfficesJohn Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, USAJohn Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, UK
Editorial OfficeThe Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, UK
For details of our global editorial offices, customer services, and more information about Wiley products visit us at www.wiley.com.
Wiley also publishes its books in a variety of electronic formats and by print-on-demand. Some content that appears in standard print versions of this book may not be available in other formats.
Limit of Liability/Disclaimer of WarrantyIn view of ongoing research, equipment modifications, changes in governmental regulations, and the constant flow of information relating to the use of experimental reagents, equipment, and devices, the reader is urged to review and evaluate the information provided in the package insert or instructions for each chemical, piece of equipment, reagent, or device for, among other things, any changes in the instructions or indication of usage and for added warnings and precautions. While the publisher and authors have used their best efforts in preparing this work, they make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives, written sales materials or promotional statements for this work. The fact that an organization, website, or product is referred to in this work as a citation and/or potential source of further information does not mean that the publisher and authors endorse the information or services the organization, website, or product may provide or recommendations it may make. This work is sold with the understanding that the publisher is not engaged in rendering professional services. The advice and strategies contained herein may not be suitable for your situation. You should consult with a specialist where appropriate. Further, readers should be aware that websites listed in this work may have changed or disappeared between when this work was written and when it is read. Neither the publisher nor authors shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages.
Library ofCongress Cataloging-in-Publication Data
Names: Senese, Fred, author.Title: Symbolic mathematics for chemists : a guide for Maxima users / Fred Senese.Description: Hoboken, NJ: John Wiley & Sons, 2019. | Includes bibliographical references and index. |Identifiers: LCCN 2018024356 (print) | LCCN 2018033308 (ebook) | ISBN 9781119273233 (Adobe PDF) | ISBN 9781119273264 (ePub) | ISBN 9781118798690 (pbk.)Subjects: LCSH: Chemistry–Mathematics. | Logic, Symbolic and mathematical–Data processing.Classification: LCC QD39.3.M3 (ebook) | LCC QD39.3.M3 S46 2018 (print) | DDC 542/.8553–dc23LC record available at https://lccn.loc.gov/2018024356
Cover design by WileyCover image: © Billion Photos/Shutterstock; @ leminuit/Getty Images
To my dearest wife, Hazel, without whose tolerance, patience, support and love this book would not have been possible.
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.
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.
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.
“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 or by explicit space characters .
When keys are to be pressed simultaneously, they will be separated by a plus sign; for example + 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
.
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 image
1
. 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.
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.
1
Unfortunately Maxima binaries are only being distributed for Intel-based Macs at the time this book was written. You can build Maxima on other Macs with MacPorts. See
http://www.macports.org
for instructions.
