 Edwin L. (Ted) Woollett
 Professor Emeritus, Physics & Astron., CSULB
 Ph.D.  Kansas State Univ, 1965
 Computational Physics



Maxima by Example
Maxima (link to project page) is a
freely available and powerful computer algebra system (CAS)
which is an open source cousin of the commercial Macsyma CAS.
Maxima has powerful symbolic, numerical, and graphical capabilities, and
you can download as many copies as you need without the hassle of license negotiations
with Mathematica or Maple.
Maxima is being steadily improved by an energetic development team
of volunteers. An email
"mailing list" provides an effective and friendly means of
getting and providing advice on the practical use of Maxima with your research or
project.
Maxima by Example is a series of tutorial notes which
include many examples of the power of Maxima.
Designed for the new user, we include some "nuts and bolts" suggestions for working
with the Maxima software, especially for the Windows user. The posted files use 12 point type,
which makes for easier reading at the computer screen, but costs more to print.
Reading these notes on your computer makes more sense than printing them out, although
you may want to print out the first page which has the table of contents. It is easier to
keep a live set of notes up to date than a book.
NONPROFIT PRINTING AND DISTRIBUTION OF THE CHAPTER PDF FILES IS PERMITTED.
Notepad++ is my Windows editor of choice for editing Maxima, html, and tex files. The Sourceforge download page is
here.
Chapter 1, Introduction to Maxima
Chapter 1 has been completely restructured and rewritten in order to provide a better introduction
to this series of notes. Note that the name of the file has been changed to mbe1intro.pdf.
The Latex file mbe1intro.tex contains the complete latex source code, and can be used by
Maxima users to construct their own personal notes or class handouts.
 mbe1intro.pdf : Introduction to Maxima, August 11, 2009, Maxima 5.19.0, 57 pages
 mbe1intro.tex : Latex code for Ch. 1, August 11, 2009, Maxima 5.19.0
 mbe1toc.txt : Ch. 1 Detailed Table of Contents, August 11, 2009
 mbe1code.txt : Ch.1 Code input text file: August 11, 2009, Maxima 5.19.0
 mbe1util.mac : Ch. 1 Maxima Utility Functions: August 11, 2009, Maxima 5.19.0
Chapter 1 Topics
 What is Maxima?
 Introduction to the wxMaxima Interface
 Introduction to the Xmaxima Interface
 Creating and Using a Startup File
 Maxima Expressions, Numbers, Operators, Constants, and Reserved Words
 Input and Output Examples
 Maxima Power Tools at Work
 User Defined Maxima Functions
 History of Maxima
The text file mbe1util.mac is free software: you can redistribute it and/or modify
it under the terms of the GNU GENERAL PUBLIC LICENSE as published by the Free Software Foundation.
Chapter 2, Plots, Files, Read, Write, and Fit
Chapter 2 has been revised to include a large section on working with
files from within Maxima. The new software file mfiles.mac includes many
useful file manipulation functions. The small file mfiles1.lisp is loaded
in by mfiles.mac.
Since Jan. 19, 2012, all updates reflect the necessity of using the complete file path (in ver. 5.26.0 thru 5.31) for all
of the "file name slots" in the file manipulation functions defined in mfiles.mac.
To save typing, one can define (in your maximainit.mac file) a function mkp (make path)
which makes use of a global parameter bpath which is a string which provides the base
of the path to your work folder. One can then use mkp("myfile1.txt") instead of
"c:/work2/myfile1.txt" as an argument to a file name slot. This is discussed at length
in the introduction to the File section of chapter two.
 mbe2plotfit.pdf : Jan. 6, 2014, Maxima 5.31.2, 40 pages
 mbe2plotfit.tex : Jan. 6, 2014, Latex code file
 mbe2toc.txt : Detailed table of contents, Jan. 6, 2014
 mbe2code.txt : Code file: Jan. 6, 2014, Maxima 5.31.2
 qplot.mac : Maxima code for quick plots, Oct. 3, 2011, Maxima 5.25.1
 mfiles.mac : Maxima code for file work, Jan. 19, 2012, Maxima 5.28.0
 mfiles1.lisp : Lisp code loaded by mfiles.mac, Oct. 3, 2011, Maxima 5.25.1
 coffee.dat : Coffee cooling tab separated data file: July, 13, 2009
Chapter 2 Topics
Introduction to plot2d
 First Steps with plot2d
 Parametric Plots
 Line Width and Color Controls
 Discrete Data Plots: Point Size, Color, and Type Control
 Plot of a Discontinuous Function
 Using qplot for Quick Plots of One or More Functions
 Multiple Plots Using the Embedded Option
Working with Files Using the Package mfiles.mac
 file_search, probe_file, ls, and dir
 ftype, file_length, file_info
 print_file, print_lines
 rename_file, delete_file, copy_file, file_convert, ftext_replace
 Break file lines with pbreak(), email reply with reply_to
 Search File with search_file
 Search Multiple files with search_mfiles
 read_data, read_text, write_data, with_stdout
Least Squares Fit to Experimental Data
 Syntax of lsquares_estimates
 Coffee Cooling Model
 Experiment Data for Coffee Cooling
 Least Squares Fit of Coffee Cooling Data
The new function read_data is designed to work correctly with unix, mac,
and windows type text files.
read_data uses the new function read_line which is a replacement for the
current Maxima function readline.
The new function print_file correctly reads unix, mac, and windows
files and is a replacement for the current Maxima function printfile.
Chapter 3: Ordinary Differential Equation Tools
 mbe3ode1.pdf : Sept. 16, 2010, Maxima 5.18.1, 44 pages
 mbe3ode1.tex : Sept. 16, 2010, Latex code file
 mbe3toc.txt : Detailed Table of Contents, July, 19, 2009
 mbe3code.txt : Code input text file: July, 19, 2009, Maxima 5.18.1
Chapter 3 Topics
 Solution of One First Order Ordinary Differential Equation (ODE)
 Exact Solution with ode2 and ic1
 Exact Solution with desolve
 Numerical Solution and Plot with plotdf
 Numerical Solution with Fourth Order RungeKutta: rk
 Solution of One Second Order or Two First Order ODE's
 Exact Solution with ode2, ic2, and eliminate
 Exact Solution with desolve, atvalue, and eliminate
 Numerical Solution and Plot with plotdf
 Numerical Solution with Fourth Order RungeKutta: rk
 Ex.1: Fall in Gravity with Air Friction: Terminal Velocity
 Ex.2: One Nonlinear First Order ODE
 Ex.3: One First Order ODE Which is Not Linear in Y'
 Ex.4: Linear Oscillator with Damping
 Ex.5: Underdamped Linear Oscillator with Sinusoidal Driving Force
 Ex.6: Regular and Chaotic Motion of a Driven Damped Planar Pendulum
 Using contrib_ode for ODE's
Chapter 4: Solving Equations
 mbe4solve.pdf : Jan. 29, 2009, Maxima 5.17.1, 48 pages
 mbe4solve.tex : Jan. 29, 2009, Latex code file
 mymnewton.mac : Jan. 29, 2009, Maxima 5.17.1
 mbe4solve.txt : cut and paste code: April 9, 2008, Maxima 5.14
Chapter 4 Topics
 One Equation or Expression: Symbolic Solution or Roots (solve)
 One Equation Numerical Solutions: allroots, realroots, find_root
 Two or More Equations: Symbolic and Numerical Solutions (linsolve, linsolve_by_lu
 eliminate, newton, mnewton, implicit_plot, draw package implicit)
Chapter 4 provides numerous examples of using Maxima tools to solve equations.
Extra attention has been given to matrix methods for sets of linear equations,
using linsolve_by_lu. The chapter ends with an interactive work session
implementing a homemade "mymnewton" which is followed by creation of a homemade
mymnewton function which has at its core a linsolve_by_lu matrix based
function. Readers can download the text file "mymnewton.mac" and experiment
with the code and experiment with adapting the code for their own uses.
Many of the examples in Chapter 4 are related to common questions sent in to the "Maxima Mailing List".
Chapter 5: Matrix Solution Methods
Chapter 5 shows the use of Maxima matrices for the solution of eigenvalue and eigenvector problems,
and the analytic matrix solution of sets of first order ordinary differential equation initial value problems.
 mbe5matrix.pdf : Mar. 30, 2016, Maxima 5.36.1, 95 pages
 mbe5matrix.tex : Mar. 30, 2016, Latex code file
 mbe5.mac : Maxima matrix functions code: Mar. 30, 2016, Maxima 5.36.1
Chapter 6: Differential Calculus
 mbe6calc1.pdf : July 21, 2008, Maxima 5.15, 57 pages
 mbe6calc1.tex : July 21, 2008, Latex code file
 vcalc.mac : A Maxima package for Vector Calculus: July 19, 2008, Maxima 5.15
 vcalcdem.mac : Batch File Illustrating vcalc.mac: July 19, 2008, Maxima 5.15
 calc1code.txt : Copy and Paste Code: July 21, 2008, Maxima 5.15
 cylinder.mac : Cylindrical Coordinates: July 19, 2008, Maxima 5.15
 sphere.mac : Spherical Polar Coordinates: July 19, 2008, Maxima 5.15
Chapter 6 Topics
 Differentiation of Explicit Functions: diff(..) and Total Differential
 Critical and Inflection Points of a Curve Defined by an Explicit Function
 Tangent and Normal of a Point of a Curve Defined by an Explicit Function
 Maxima and Minima of a Function of Two Variables
 Tangent and Normal of a Point of a Curve Defined by an Implicit Function
 Limit Examples using Maxima's limit(..) Function
 Taylor Series Expansions using taylor(..)
 Vector Calculus Calculations and Derivations using vcalc.mac
 Maxima Derivation of Vector Calculus Formulas in Cylindrical Coordinates
 Maxima Derivation of Vector Calculus Formulas in Spherical Polar Coordinates
The text file vcalc.mac is free software: you can redistribute it and/or modify
it under the terms of the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991,
as published by the Free Software Foundation. For more information see
the license information at the top of the file.
Chapter 7: Symbolic Integration
 mbe7sint.pdf : Sept. 16,2010, Maxima 5.18.1, 35 pages
 mbe7sint.tex : Sept. 16,2010, Latex code file
 mbe7code.txt : Copy and Paste Code: Apr. 29, 2009, Maxima 5.18.1
Chapter 7 Topics
 Examples of Use of integrate
 Piecewise Defined Functions
 Area Between Curves Examples
 Arc Length of an Ellipse
 Double Integrals : Area and Moment of Inertia of an Elliptical Laminate
 Triple Integrals: Volume and Moment of Inertia of a Solid Ellipsoid
 Derivative of a Definite Integral with respect to a Parameter
 Integration by Parts
 Change of Variables
Chapter 8: Numerical Integration
The newly revised chapter 8 includes new package functions nint, quad, mdefint, and ndefint
for 1d and 2d numerical integration, available after loading the file nint.mac.
The new package loaded by apnint.mac (nint.mac should be loaded first) makes available
two functions for arbitrary precision quadrature in 1 dimension, apnint and apquad.
For routine 1d numerical integration (quadrature), you can simply use the syntax:
nint (expr,x,x1,x2)
where expr can be either real or complex. The new function nint will first try the Maxima
function integrate (if feasible), and if not successful, will use the Maxima quadpack functions.
You can force Maxima to just use the quadpack functions with the syntax:
quad (expr,x,x1,x2),
again with expr being either real or complex.
You can also force Maxima to try integrate (if nint avoids integrate for a given integranddomain)
by using the syntax:
mdefint (expr,x,x1,x2)
for a symbolic answer, and
ndefint (expr,x,x1,x2)
for a numerical answer calculated from the symbolic
integrate answer using bigfloat methods with 32 digit precision.
The 2d syntax is similar to Mathematica's:
nint(f,[x,x1,x2],[y,y1,y2])
is an approximate numerical value of
integrate( integrate (f,y,y1,y2), x,x1,x2).
A number of optional arguments can be used to control or request the
quadpack method to be used.
Arbitrary precision quadrature using apnint has the syntax
apnint(expr,x,x1,x2,rp,wp),
in which rp is the requested precision of the answer, and wp is the working precision.
The function apnint first tries using integrate, if feasible, and if not successful, uses
one of two numerical methods we discuss in Ch.9.
The function apquad has the same syntax:
apquad(expr,x,x1,x2,rp,wp),
and avoids integrate, forcing use of one of two possible numerical methods.
In both of these arbitrary precision cases, if the domain is nonfinite, then x1 should be finite
and x2 should be the symbol inf.
 mbe8nint.zip : Dec. 14, 2013 zip code of all Ch. 8 files
 mbe8nint.tar.gz : Dec. 14, 2013 tar.gz code of all Ch. 8 files
 mbe8nint.pdf : 11/16/2012, Maxima 5.28.0, 35 page pdf file
 mbe8nint.tex : 11/16/2012, Maxima 5.28.0, Latex code file
 mbe8code.txt : Copy and Paste Code: 11/16/2012, Maxima 5.28.0
 nint.mac Dec. 14, 2013, Maxima 5.28.0
 nint.lisp Oct. 31,2012, Maxima 5.28.0
 mydefint.mac Oct. 31,2012, Maxima 5.28.0
 quad1d.mac Oct. 31,2012, Maxima 5.28.0
 quad2d.mac Oct. 31,2012, Maxima 5.28.0
 quad_util.mac Oct. 31,2012, Maxima 5.28.0
 nint_test.mac Oct. 31,2012, Maxima 5.28.0
 apnint.mac Dec. 14, 2013, Maxima 5.28.0
 dequad.mac 11/16/2012, Maxima 5.28.0
 tsquad.mac Dec. 14, 2013, Maxima 5.28.0
Chapter 8 Topics
 Using nint and quad for One or Two Dimensional Quadrature
 Using apnint and apquad for Arbitrary Precision Quadrature
 Using the Wolfram Alpha Web Site for Integrals
 Direct Quadpack Use of quad_qags, quad_qag, and quad_qagi
 Sharper Tools: Use of quad_qagp, quad_qawo, quad_qaws, quad_qawc, and quad_qawf
 Numerical Integration Decision Trees
Chapter 9: Bigfloats and High Accuracy Quadrature
A valuable feature of a computer algebra system is the ability to
do arithmetic with high precision. Chapter 9 presents four
methods of high accuracy quadrature, including examples and test integrals.
 mbe9bfloat.pdf : May 30, 2016, Maxima 5.36.1, 40 pages
 mbe9bfloat.tex : May 30, 2016, Latex code file
 mbe9code.txt : Copy and Paste Code: May 30, 2016, Maxima 5.36.1
 bfloat.mac : May 30, 2016, Maxima 5.36.1
 quadmaxima.lisp : May 30, 2016, Maxima 5.36.1
 quad_de.mac : May 30, 2016, Maxima 5.36.1
 quad_ts.mac : May 30, 2016, Maxima 5.36.1
 quad_gs.mac : May 30, 2016, Maxima 5.36.1
Chapter 9 Topics
 The Use of Bigfloat Numbers in Maxima,
 Bigfloat Numbers Using bfloat, fpprec, and fpprintprec.
 Using print and printf with Bigfloats,
 Adding Bigfloats having Differing Accuracy,
 Highly Accurate Roots of Polynomials using bfallroots,
 Highly Accurate Roots using bf_find_root,
 Bigfloat Number Gaps and Binary Arithmetic,
 Effect of Floating Point Precision on Function Evaluation,
 High Accuracy Quadrature with Maxima,
 Using bromberg for High Accuracy Quadrature,
 A Double Exponential Quadrature Method for a <= x < inf,
 The tanhsinh Quadrature Method for a <= x <= b,
 The GaussLegendre Quadrature Method for a <= x <= b
The text files bfloat.mac, quad_de.mac, quad_ts.mac, and quad_gs.mac
are free software: you can redistribute them and/or modify
them under the terms of the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991,
as published by the Free Software Foundation. For more information see
the license information at the top of the files.
Chapter 10: Fourier Series, Fourier and Laplace Transforms.
 mbe10fltrans.pdf : Sept. 16, 2010, Maxima 5.18.1, 38 pages
 mbe10fltrans.tex : Sept. 16, 2010, Latex code file
 mbe10code.txt : Copy and Paste Code: Apr. 29, 2009, Maxima 5.18.1
Chapter 10 Topics:
 Fourier Series Expansion Examples,
 Fourier Integral Transform Pair Examples,
 Dirac Delta (Unit Impulse) Function Examples,
 Laplace Transform Integral Examples,
 Inverse Laplace Transform Examples and Residues
Chapter 11: Fast Fourier Transform Tools.
Chapter 11 and the software file qfft.mac have been revised and greatly simplified to allow use
of the new simplified Maxima package fft.lisp, effective with Maxima ver. 5.19.0, August 2009.
The latex code file is made available for the convenience of instructors who would like to
incorporate parts of Ch. 11 in their class notes and handouts.
 mbe11fft.pdf : Ch. 11, Fast Fourier Transform Tools, Aug. 13, 2009, Maxima 5.19.0, 28 pages
 mbe11fft.tex : Latex Source Code, Aug. 13, 2009, Maxima 5.19.0
 mbe11code.txt : Copy and Paste Code: Aug. 13, 2009, Maxima 5.19.0
 mbe11toc.txt : Table of Contents: Aug. 13, 2009, Maxima 5.19.0
 qfft.mac : Aug. 13, 2009, Maxima 5.19.0
Chapter 11 Topics
 FFT Spectrum of a Monochromatic Signal,
 FFT Spectrum of a Sum of Two Monochromatic Signals,
 FFT Spectrum of a Rectangular Wave,
 FFT Spectrum Sidebands of a Tone Burst Before and After Filtering,
 Cleaning a Noisy Signal using FFT Methods,
 Basic Ideas of the Fast Fourier Transform,
 Derivation of the Discrete Fourier Transform
The text file qfft.mac is free software: you can redistribute it and/or modify
it under the terms of the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991,
as published by the Free Software Foundation. For more information see
the license information at the top of the file.
Chapter 12: Dirac Algebra and Quantum Electrodynamics, Version 2
A Version 2 Maxima Dirac algebra package is demonstrated using examples from Quantum Electrodynamics.
The file dirac2.mac loads the rest of the Dirac package files: simplifyingnew.lisp, dgcon2.mac, dgtrace2.mac,
dgeval2.mac, and dgmatrix2.mac. The file dgfunctions2.txt has an alphabetical list of the package functions.
Eleven batch files carry out typical calculations.
Separate sections of Ch. 12 are devoted to a review of high energy physics notation (which agrees with Peskin
and Schroeder), trace and contraction theorems, to a review of covariant polarization 4vectors for physical (external) photons, and to the use of simplifyingnew.lisp.
A 22 page introduction to typical uses, with examples given in an interactive session context, has been created to allow easier and quicker access to the syntax and abilities of the package.
The Dirac package code has been rewritten and the code greatly simplified. The more complicated examples
now run about 35% faster. A suite of test files has been added, and is available as either a zip file
or a tar.gz file.
The author is indebted to Maxima developer Barton Willis for his suggestion to use the recursive simplification lisp code simplifying.lisp, and for his advice in exploiting the power of that code.
The following Windows zip file contains all Chapter 12 files (except the test suite), including the pdf.
mbe12dirac2.zip : 41511, Maxima 5.23.2, 488 KB
The following tar.gz file contains all Ch. 12 files (except the test suite), including the pdf file.
mbe12dirac2.tar.gz : 1122012, Maxima 5.23.2, 479 KB
 mbe12dirac2.pdf : Ch. 12, Dirac Algebra and
Quantum Electrodynamics, 41511, Maxima 5.23.2, 83 pages,
 mbe12dirac2.tex : Ch. 12 Latex code file
 simplifyingnew.lisp : Recursive simplification code, 41511, Maxima 5.23.2
 dirac2.mac : The Dirac package driver, 41511, Maxima 5.23.2
 dgcon2.mac : Symbolic contraction code: 41511, Maxima 5.23.2
 dgtrace2.mac : Symbolic trace code, 41511, Maxima 5.23.2
 dgeval2.mac : Frame dependent code, 41511, Maxima 5.23.2
 dgmatrix2.mac : Explicit Dirac spinors and matrices, 41511, Maxima 5.23.2
 dgfunctions2.txt : Alphabetical list of the Dirac
package functions, 41511, Maxima 5.23.2
 bhabha1.mac : High energy electronpositron scattering,
41511, Maxima 5.23.2
 bhabha2.mac : Arbitrary energy electronpositron scattering,
41511, Maxima 5.23.2
 compton0.mac : Photon plus scalar charged particle scattering,
41511, Maxima 5.23.2
 compton1.mac : Photon plus lepton scattering,
41511, Maxima 5.23.2
 moller0.mac : Scalar plus scalar charged particle scattering,
41511, Maxima 5.23.2
 moller1.mac : High energy limit of electronelectron scattering,
41511, Maxima 5.23.2
 moller2.mac : Arbitrary energy electronelectron scattering,
41511, Maxima 5.23.2
 moller3.mac : Use of explicit matrix trace methods and symbolic
trace methods for the squared polarized amplitudes for arbitrary energy electronelectron
scattering, 41511, Maxima 5.23.2
 MSQcomp.mac : a function definition loaded by moller3.mac,
41511, Maxima 5.23.2
 pair1.mac : Unpolarized two photon annihilation of an
electronpositron pair, 41511, Maxima 5.23.2
 pair2.mac : Polarized two photon annihilation of an
electronpositron pair, 41511, Maxima 5.23.2
 photon1.mac : Sum identities for photon polarization 3vectors,
41511, Maxima 5.23.2
 dgtest2.zip : test suite zip file, 41511, Maxima 5.23.2
 dgtest2.tar.gz : test suite tar.gz file 1122012, Maxima 5.23.2
A file which is not in the zip or tar.gz files is a lisp file written by Leo Butler which
allows Windows users to avoid a bug in using the Maxima function timedate. See Sec. 12.3 for
a discussion of the use of newtimedate.lisp.
Three independent methods of calculation are provided by the Dirac package.
 The symbolic methods are available for the calculation of either unpolarized differential cross sections or
polarized differential cross sections.The symbolic methods allow unpolarized differential cross sections to be first expressed in an arbitrary frame in terms of the Mandelstam variables s, t, and u.
 An alternative path (but frame dependent) to either unpolarized or polarized differential cross sections is the use of explicit Dirac matrices (we use the same conventions as Peskin and Schroeder) and explicit matrix trace and contractions on Lorentz indices.
 The third path is the use of explcit Dirac spinors and matrices to first calculate all possible polarized amplitudes (ie.,for various helicity choices) and then the sum of the squares reproduces the unpolarized results.
The Dirac package files are free software: you can redistribute them and/or modify
them under the terms of the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991,
as published by the Free Software Foundation. For more information see
the license information at the top of the file.
Chapter 13: 2D Plots and Graphics using qdraw
Chapter 13 presents many examples which use qdraw.mac, an interface to Maxima's draw2d function.
qdraw(...) provides much quicker access to many features of draw2d, with default plot properties of interest
to users from the physical sciences and engineering. This chapter is the old chapter 5.
 mbe13qdraw.pdf : April 29, 2016, Maxima 5.36.1, 51 pages
 mbe13qdraw.tex : April 29, 2016, Latex code file
 qdraw.mac : A Graphics Interface to draw2d: April 29, 2016, Maxima 5.36.1
 qdrawcode.txt : Copy and Paste Code: April 29, 2016, Maxima 5.36.1
 faithful.dat : Old Faithful Geyser data file
 fit1.dat : Data File
 fit2.dat : Data File
Chapter 13 Topics
 Quick Plots for Explicit Functions: ex(...)
 Quick Plots for Implicit Functions: imp(...)
 Contour Plots with contour(...)
 Density Plots
 Explicit Plots with Greater Control: ex1(...)
 Scatterplots and Data Plots and pts(...) Syntax
 Implicit Plots with Greater Control: imp1(...)
 Parametric Plots with para(...)
 Polar Plots with polar(...)
 Geometric Figures: line(...)
 Geometric Figures: rect(...)
 Geometric Figures: poly(...)
 Geometric Figures: circle(...) and ellipse(...)
 Geometric Figures: vector(..)
 Geometric Figures: arrowhead(..)
 Using Greek Letters, Math Symbols, and Adjustable Font Size with Labels
 Even More with more(...)
 Programming Homework Exercises
The text file qdraw.mac is free software: you can redistribute it and/or modify
it under the terms of the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991,
as published by the Free Software Foundation. For more information see
the license information at the top of the pdf file.
Chapter 14: Fitting a Model Function to Data
Chapter 14 provides examples of the use of a new set of Maxima functions (defined in fit.mac).
These new functions not only return the bestfit parameter values, but also the estimated parameter
uncertainties and the chi squared probability of the results.
These new functions assume one independent variable and one corresponding dependent
variable and are called fit_line, fit_slope, fit_y_intercept, lfit, and nlfit.
These new functions also allow for the use, while finding best fit model parameters,
of the estimated uncertainties of the measured dependent variable.
 mbe14.zip : Jan 15, 2017, zip file contains all following files.
 mbe14fit.pdf : Jan 15, 2017, Maxima 5.36.1, 66 pages
 mbe14fit.tex : Jan 15, 2017, Latex code file
 fit.mac : Maxima code, Jan 15, 2017, Maxima 5.36.1
 qdraw.mac : A Graphics Interface to draw2d: Jan 15, 2017, Maxima 5.36.1
 coffee.dat : coffee cooling data file
 mbe14fit1.dat : Ex. 1 Data File
 mbe14fit2.dat : Ex. 2 Data File
 mbe14fit3.dat : Ex. 3 Data File
 mbe14fit4.dat : Ex. 4 Data File
 mbe14fit5.dat : Ex. 5 Data File
 mbe14fit6.dat : Ex. 6 Data File
 mbe14fit7.dat : Ex. 7 Data File
 mbe14fit8.dat : Ex. 8 Data File
Chapter 14 Topics
The most useful functions defined in fit.mac are listed here with the syntax. Mdata is a data matrix. sigL is a list of estimated measurement errors.
dof is the number of degrees of freedom (the number of data points minus the number of model parameters being fitted). ymodel is an expression
which includes some symbolic unknown parameters (to be found).
 fit_line (Mdata, sigL), Two Parameter Straight Line Fit
 fit_slope (Mdata, sigL, yintercept), One Parameter Straight Line Fit, Given the Yintercept
 fit_y_intercept (Mdata, sigL, slope), One Parameter Straight Line Fit, Given the Slope
 lfit (Mdata, sigL, ymodel, paramL), General Linear Fit
 nlfit (Mdata, sigL, ymodel, paramL, paraminitL), General Nonlinear Fit, LevenbergMarquardt Method
 moment (dataL)
 y_gaussian_PE (Mdata, dof, ymodel), Probable Data Error if Gaussian
 get_chi2 (Mdata, sigL, yfit_expr), ChiSquare Value Based on Fitted Parameters
 chi2 prob (chi2, dof), ChiSquare Probability and Reduced ChiSquare
 Vsearch (Mdata, sigL, ymodel, paramL, paramvaluesL), Visual Search for Parameter Values
 grid search(Mdata, sigL,ymodel,paramL,paraminitL,stepFactor), Grid Search Method
Nine examples are worked out in detail in the first part of the chapter.
Seven of these examples are taken from the text "Data Reduction and Error Analysis for the Physical Sciences," by Philip R. Bevington and D. Keith Robinson, 3rd Ed, 2003, McGraw Hill.
The chapter ends with a review of statistical concepts needed and
also a derivation of the matrix method used for the general linear fit function lfit.
A list of useful references concludes this chapter.
The text files fit.mac and qdraw.mac are free software: you can redistribute it and/or modify
it under the terms of the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991,
as published by the Free Software Foundation. For more information see
the license information at the top of the pdf file.
Quark Gluon Hard Scattering Processes
A simple tree level QCD hard scattering calculation. The batch file includes references and a copy of the batch file run. The version 2 Dirac package (dirac2.mac) needs to be loaded, and in addition the file qcd1.mac needs to be loaded as well. The latter file contains explicit matrix definitions of the eight SU(3) group
3 x 3 color matrices T[a], a = 1,2,..,8, and also calculates the antisymmetric gauge group structure contants f[a,b,c], and the symmetric structure constants d[a,b,c] for use in calculations.
 qcd1.mac Color matrices and structure constants
 qqqq1.mac Quarkquark scattering via gluon exchange, April 30, 2011, Maxima 5.24.0
A ClebschGordan Coefficient Package for Maxima
Contains (not very efficient) Maxima code for Wigner vector coupling coefficients (ClebschGordan coefficients)
cj (j1,j2,j3,m1,m2,m3) and the simply related Wigner 3j coefficients
threej (j1,j2,j3,m1,m2,m3), both for explicit integer and halfinteger arguments only.
clebsch.mac : Oct. 22, 2010, Maxima 5.21.1
The text file clebsch.mac is free software: you can redistribute it and/or modify
it under the terms of the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991,
as published by the Free Software Foundation. For more information see
the license information at the top of the file.
A Simple Maxima Lagrangian Mechanics Package
lag1.mac : Oct. 26, 2010, Maxima 5.22.1. This is a batch file which contains some simple
examples of deriving the second order equations of motion for a system described by a Lagrangian function of
generalized coordinates and velocities and for which no constraint equations are needed.
The results from the batch file run are in a comment at the end of lag1.mac.
lag2.mac : Oct. 26, 2010, Maxima 5.22.1. This Maxima code file contains code
which is automatically loaded in by lag1.mac.
The text files lag1.mac and lag2.mac are free software: you can redistribute them and/or modify
them under the terms of the GNU GENERAL PUBLIC LICENSE, Version 2, June 1991,
as published by the Free Software Foundation. For more information see
the license information at the top of the file.
Symbolic Pauli Matrix Commutator Expansions
pauli1.mac : Nov. 29, 2010, Maxima 5.22.1. This code file loads commutators.mac and uses
tellsimpafter methods to complete the symbolic expansion of Pauli matrices. Also included is code for
comparing explicit matrix calculations of commutators with the symbolic results. Note that the code
uses the convention that sig[k], for k = 1,2,3, (lower case first letter) represents the symbolic
Pauli matrix, and Sig[k], for k = 1,2,3, (upper case first letter) represents the explicit Pauli matrix.
At the end of this file are examples of use.
pauli2.mac : Nov. 29, 2010, Maxima 5.22.1. This code file loads commutators.mac and
uses defrule methods to complete the symbolic expansion of Pauli matrices.
At the end of this file are examples of use.
commutators.mac : Nov. 29, 2010, Maxima 5.22.1.
This Maxima code file, written by Maxima coordinator Robert Dodier, first creates a
new property 'bilinear', which can then be used in declare(comm,bilinear) declarations.
The file then uses defrule methods to create rules for the extraction of scalars,
numbers, and factors of %i to be removed from 'comm' arguments and rules for the
basic product rule expansion of a commutator of two operators or matrices.
At the end of this file are examples of use.
The text files commutators.mac, pauli1.mac, and pauli2.mac are free software:
you can redistribute them and/or modify them under the terms of
the GNU GENERAL PUBLIC LICENSE as published by the Free Software Foundation.
Computational Physics with Maxima or R
Chapter 1, Numerical Differentiation, Quadrature, and Roots
A brief introduction to both R and Maxima is followed by examination of builtin and package
tools for these three areas, with examples of use, and the design of homemade functions
designed to employ the simplest numerical methods for these three areas of numerical work.
 cp1.pdf : Ch. 1, Mar. 4, 2014, Maxima 5.28.0, R 3.0.1, 70 pages
 cp1.tex : Ch. 1 Latex code file
 cp1code.R : R code for Ch. 1, Mar. 4, 2014, R 3.0.1
 cp1code.mac : Maxima code for Ch. 1 , Mar. 4, 2014, Maxima 5.28.0
 cpnewton.mac : Maxima code for Ch. 1, Mar. 4, 2014, Maxima 5.28.0
Chapter 1 Topics
 Introduction to R and Maxima
 Numerical Derivative Functions in R
 Testing Simple Numerical Derivative Algorithms with R and Maxima
 Quadrature Functions in R and Maxima
 Testing Trapezoidal and Simpson's Rule Algorithms with R and Maxima
 Dealing with Unbounded Integrals and End Point Singularities
 Root Finding Functions in R and Maxima
 Simple Divide and Conquer Strategy
 Testing NewtonRaphson and Secant Methods with R and Maxima
 Testing Bigfloat NewtonRaphson with Maxima
 Margins and Outer Margin Area in R Plots
 Drawing Circles Using R
Example 1: Semiclassical Quantization of Molecular Vibrations
Examples of "bottomup" programming in both R and Maxima for a physics problem which makes use of
both quadrature and root finding.
 example1.pdf : Example 1, Aug. 31, 2015, Maxima 5.28.0, R 3.0.1, 17 pages
 example1.tex : Example 1 Latex code file
 example1.R : R code for Example 1, Aug. 31, 2015, R 3.0.1
 example1.mac : Maxima code for Example 1 , Aug. 31, 2015, Maxima 5.28.0
 example1.zip : Example 1 zip file, Aug. 31, 2015
 example1.tar.gz : Example 1 tar.gz file, Aug. 31, 2015
Project 1: Classical Rutherford Scattering in a Central Potential
Scattering theory notation, and plots of the effective potential, scattering trajectories, scattering angles, and differential scattering cross sections for the Rutherford potential (repulsive and attractive) and for the
LennardJones potential. Includes a brief introduction to Maxima's rk() function and R's ode() function, which are used for the scattering trajectory plots.
 project1.zip : Project 1 zip file, Aug. 30, 2015
 project1.tar.gz : Project 1 tar.gz file, Aug. 30, 2015
 project1.pdf : Project 1, Aug. 30, 2015, Maxima 5.31.2, R 3.0.2, 56 pages
 project1.tex : Project 1 Latex code file
 cmass.R : R code for center of mass diagram, Aug. 30, 2015, R 3.0.2
 coord.R : R code for coordinate diagram, Aug. 30, 2015, R 3.0.2
 k1util.mac : Maxima utility functions, Aug. 30, 2015, Maxima 5.31.2
 lennard_jones.mac : Aug. 30, 2015, Maxima 5.31.2
 lennard_jones.R : Aug. 30, 2015, R 3.0.2
 rutherford_attract.mac : Aug. 30, 2015, Maxima 5.31.2
 rutherford_attract.R : Aug. 30, 2015, R 3.0.2
 rutherford_repulse.mac : Aug. 30, 2015, Maxima 5.31.2
 rutherford_repulse.R : Aug. 30, 2015, R 3.0.2
 scatt.R :R code for scattering angle diagram, Aug. 30, 2015, R 3.0.2
 sho1.R :R code for integration of simple harmonic oscillator, Aug. 30, 2015, R 3.0.2
Chapter 2, Initial Value Problems
A variety of initial value problems are solved using both R and Maxima.
Homemade codes for the Euler method and the classical fourth order RungeKutta method are demonstrated with numerous examples.
The standard Maxima methods rk and rkf45 are discussed, and the R deSolve package ode method is extensively discussed with many examples.
Finally, methods for solving initial value problems in which the derivatives are discontinuous and in which the dependent variables are discontinuous are discussed.
 cp2.zip : Ch. 2 zip file, Aug. 29, 2015
 cp2.pdf : Ch. 2, Aug. 29, 2015, Maxima 5.31.0, R 3.0.2, 71 pages
 cp2.tex : Ch. 2 Latex code file, Aug. 29, 2015
 k2util.mac : Maxima utility functions for Ch. 2, Aug. 29, 2015
 myode.mac : Maxima code for Ch. 2 , Aug. 29, 2015, Maxima 5.31
 myode.R : R code for Ch. 2, Aug. 29, 2015, R 3.0.2
 myrkf45.mac : rkf45 Adaptive Runge Kutta Maxima code, Aug. 29, 2015, Maxima 5.31
Chapter 2 Topics
 The Euler Method, Truncation Errors, Roundoff Errors, Instability
 4th Order RungeKutta Code for R and Maxima
 The Maxima Methods rk and rkf45
 The R package deSolve and Use of ode
 Solving O.D.E.'s with External Forcing Data
 Integrating O.D.E.'s with Discontinuous Derivatives
 Integrating O.D.E.'s with Discontinuous Dependent Variables Using R
 Events Specified with a data.frame
 Intravenous Drug Injection Model
 Using an Event Function at Specified Times
 Using an Event Function when a Root Condition is Satisfied
 Use of a Switching Parameter as a Dependent Variable
Example 2: Surfaces of Section for the HenonHeiles Potential
Examples of "bottomup" programming in both R and Maxima for the trajectories and
surfaces of section for a classical particle orbiting in the HenonHeiles
potential. This potential was first studied as a mathematical model to describe
the chaotic motion of a test star in an axisymmetric galactic mean gravitational field.
The June 3 update includes new code rk41 designed to land on the final point, providing
improved surface of section behavior.
 example2.pdf : Example 2, Aug. 28, 2015, Maxima 5.31, R 3.0.2, 25 pages
 example2.tex : Example 2 Latex code file, Aug. 28, 2015
 example2.R : R code for Example 2, Aug. 28, 2015, R 3.0.2
 example2.mac : Maxima code for Example 2 , Aug. 28, 2015, Maxima 5.31
 hhplota.R : R code for Example 2 , Aug. 28, 2015, R 3.0.2
 example2.zip : zip file contains all files for Example 2 , Aug. 28, 2015
Project 2: Structure of a White Dwarf Star
A pedagogical discussion of the differential equations for the mass profile m(r) and the mass density profile rho(r), assuming the cold
degenerate relativistic electron gas provides the internal pressure, and the nondegenerate heavy
nuclei provide the gravitational attraction. Both R and Maxima code are used in parallel treatments
to draw plots (for a given central density) of m(r), rho(r), kinetic energy profile k(r), gravitational energy profile u(r),
and to explore the total energy (including rest mass energy) as a function of central mass density and
the stellar mass, and to plot the stellar radius as a function of stellar mass.
 project2.pdf : Project 2, Aug. 25, 2015, Maxima 5.31.2, R 3.0.2, 27 pages
 project2.tex : Project 2 Latex code file, Aug. 25, 2015
 project2.R : R code for Project 2, Aug. 25, 2015, R 3.0.2
 project2.mac : Maxima code for Project 2 , Aug. 25, 2015, Maxima 5.31
 project2.zip : zip file contains all files for Project 2, Aug. 25, 2015
Chapter 3, Two Point Boundary Value and Eigenvalue Problems
Chapter 3 Topics
 Shooting Methods for 2nd Order ODE's
 Using the R Package bvpSolve
 MonoImplicit RungeKutta R Method bvptwp
 Poisson's Equation
 Wave Equation
Example 3: Schroedinger's Equation
Detailed investigation of energy levels and corresponding wave functions
for the finite rectangular potential well and the LennardJones 612 Potential.
RungeKutta integration is used for the finite well problem, and the Numerov
method is used for the LennardJones potential problem.
Files for Ch. 3 and Example 3
 cp3.zip : zip file, Aug. 24, 2015 , Maxima 5.31.2, R 3.0.2
 cp3.tar.gz : tar.gz file, Aug. 24, 2015 , Maxima 5.31.2, R 3.0.2
 cp3.pdf : Ch. 3 pdf file, Aug. 24, 2015
 cp3.tex : Ch. 3 latex file, Aug. 24, 2015
 cp3.mac : Maxima code for Ch. 3, Aug. 24, 2015, Maxima 5.31.2
 cp3.R : R code for Ch. 3, Aug. 24, 2015, R 3.0.2
 example3.pdf : Example 3 pdf file, Schroedinger's Equation, Aug. 24, 2015
 example3.tex : Example 3 latex file, Schroedinger's Equation, Aug. 24, 2015
 FW.mac : Maxima code for Finite Rectangular Well, Aug. 24, 2015, Maxima 5.31.2
 FW.R : R code for Finite Rectangular Well, Aug. 24, 2015, R 3.0.2
 LJ612.mac : Maxima code for LennardJones Potential, Aug. 24, 2015, Maxima 5.31.2
 LJ612.R : R code for LennardJones Potential, Aug. 24, 2015, R 3.0.2
R (link to project page) is a freely available, open source,
and powerful numerical interpreter with some similarities with the commercial Matlab platform.
Although primarily used (at present) for statistics and data science, R is increasingly being
used for numerical programming in the physical sciences. Combining the numerical abilities of R
with the symbolic and numerical abilities of Maxima provides a strong alternative to Mathematica, Maple, etc.
Ted Woollett was active in teaching and research for 35 years (beginning in
1966) as a faculty member in the Physics and Astronomy Department at California
State University, Long Beach.
His research included peer reviewed work in theoretical plasma physics,
nonequilibrium thermodynamics, theoretical xray spectra, high energy nuclear
physics, and physics & society issues.
Over the course of his service in teaching, Ted created a freshman
physics course "Man and Energy" which dealt with the physics side of societal issues
related to energy use and the environment. This popular course offered during the
1970's used a different text each semester the course was taught, and even included
one semester devoted to physics of the health implications of radiation.
Physics and astronomy courses taught to undergraduates and graduate students included
Elementary Particle Physics Phenomenology, Special Relativity, General Relativity,
Introduction to Astrophysics, Computational Physics, Plasma Physics, Statistical Physics,
Thermodynamics, Electricity and Magnetism, Quantum Mechanics, Classical Mechanics, and
Mathematical Methods of Physics.
Ted and Kathleen are now living in San Luis Obispo, on the Central Coast of California.
Monthly social "highlights" are the Morro Bay AAUW dineout group and the UnitarianUniversalist
bookclub,
"The Litwits".
His contact email address is now: woollett@charter.net
CSULB PHYSICS DEPT. HOME