How to do it in Mathematica

This page will be used to accumulate short Mathematica notebooks with examples that we encounter in Physics 7701. It is not intended to be exhaustive!
The notebooks here were written assuming Mathematica version 7 or later (you may get an advisory with later versions but this is not likely to cause problems).

Recent changes to this page:



Date RevisedNotebookComments
02-Sep-2013 Complex integration examples Some sample integrals that can also be done as contour integrals.
25-Sep-2011 Spherical coordinates volume integrals Sample integrals for doing a three-dimensional volume integral in spherical coordinates.
23-Nov-2011 Gaussian quadrature tests, Part 1 Some sample tests of gaussian quadrature (Gauss-Legendre and Gauss-Laguerre with N=3).

Return to Contents

Complex Numbers and Functions

Date RevisedNotebookComments
02-Sep-2013 Finding Residues Using the Residue command in Mathematica.
05-Sep-2012 Complex Series Examples of expanding complex functions in series and determining the radius of convergence.
29-Aug-2012 Complex Roots Examples of how to solve zn = a.
29-Sep-2011 Complex Trigonometry Examples of trig functions with complex arguments and also converting back and forth from expoential to trig.

Return to Contents

Differential Equations

Date RevisedNotebookComments
23-Nov-2011 Green's functions, Part 1 A look at Green's functions for a sample Helmholtz equation example.
04-Nov-2011 Diffusion Part 1 Animated solution to a diffusion problem (not derived; just plotted).
04-Sep-2013 Solving some PS#3 differential equations Examples of answers for the differential equations in PS#3, including using extracting the equations in convenient form.
25-Sep-2011 Nonlinear Diff Eq Mathematica notebook solving the nonlinear Duffing differential equation, looking at the time dependence, phase space plots, Poincare sections, and the power spectrum.
25-Sep-2011 Nonlinear Pendulum Mathematica notebook solving the nonlinear pendulum differential equation for various initial conditions, looking at the time dependence, phase space plots, Poincare sections, and the power spectrum.

Return to Contents

Special Functions

Date RevisedNotebookComments
13-Nov-2011 Legendre polynomials Plots of polynomials and checks of orthogonality.
13-Nov-2011 Laguerre polynomials Plots of polynomials and checks of orthogonality.
23-Nov-2011 Spherical harmonics Plots of spherical harmonics. 3D!!

Return to Contents

Fourier Series and Transforms

Date RevisedNotebookComments
14-Oct-2013 Fourier Transforms 1 Basic examples of taking Fourier transforms and inverses. Also a bit on the implementation of the theta (step) function.
15-Sep-2013 Fourier scribble Created by Mario Carneiro, with revisions by Dick Furnstahl. [Original version] Build up a mouse-drawn curve in a Fourier series.
11-Sep-2013 Fourier Series Basic integrals and plots of Fourier Series.
24-Oct-2011 Fourier Series 2 Comparing full, sine, and cosine Fourier Series.
26-Oct-2011 Fourier Series 3 Generalized string plucking and harmonics. Includes animation!
18-Sep-2013 Gibb's overshoot A physics-style analysis.

Return to Contents

Dirac Delta Functions

Date RevisedNotebookComments
31-Oct-2011 Dirac Delta function Basics of using the built-in delta function in Mathematica.

Return to Contents


Date RevisedNotebookComments
07-Nov-2011 Defining Simplication Rules Simplication rules for logarithms are defined for a private function.
29-Sep-2011 Trig Simplification Simplifying cos[3θ] and simplifying cos[nπ] enforcing the assumption that n is an integer.

Return to Contents


Date RevisedNotebookComments

Return to Contents

Sample Mathematica notebooks

On some machines clicking the link will start Mathematica directly. If not, "right click" to save the file and then read it into Mathematica separately.

Date AddedNotebookComments
23-Sep-2011 Calculate area A simple Mathematica notebook defining a function to calculate the area of a circle, including forcing numerical output and multiple definitions of a function with different numbers of arguments. Also, making it into a program.
23-Sep-2011 Defining n! Mathematica notebook with many ways to define n!.
23-Sep-2011 Rolling dice Mathematica notebook that simulates the rolling of dice, where the outcome is a random integer from 1 to 6. Histograms are generated for different numbers of "trials" (i.e., throws of the dice), providing visualization of how the fluctuations scale with the number of trials.
25-Sep-2011 3D Square Well Mathematica notebook to find the eigenvalues of a spherical three-dimensional square well by matching solutions.

Return to Contents

Your comments and suggestions are appreciated.
[OSU Physics] [Math and Physical Sciences] [Ohio State University]
How to do it in Mathematica.
Last modified: .