My Mathematica notebooks.

Here is a listing of my mathematica notebooks. The most recent of any of these notebooks can all be obtained from my github Mathematica repository.

The Wolfram CDF player can also be used to view a number of these notebooks after download.

• Jan 17, 2012 phy454/strainTensorCylindrical.cdf

Compute the cylindrical strain tensor components to second order.

Using the notation package for the first time to get results that make the mathematica notebook text intelligible as well as the final result.

Also use the Collect[] function for the first time to group the results according to the differential products of interest.

• Jan 17, 2012 phy454/strainTensorSphericalColumnVectors.cdf

Same as strainTensorSpherical, but I didn't pre-compute the line element differentials myself, instead letting mathematica do the grunt work.

Note that in this version, I specified the definitions of rcap, thetacap, and phicap manually, but had some commented out code to verify that I had this right.

This notebook was left using Collect instead of coefficient, so the collected factors do not match the text equation results without additional manual comparison work.

Also use this to output the column matrices for rcap, thetacap and phicap and drcap/dt.

• Jan 21, 2012 phy454/strainTensorSpherical.cdf

Like strainTensorCylindrical but for spherical coordinates.

Here I used Coefficient instead of Collect so that I could factor out the additional portions of the area element differentials for constancy and comparison with the Landau and Lifshitz equation.

• Feb 3, 2012 phy454/continuumProblemSet1Q1.cdf

PHY454. Problem set 1.

Final grunt calculation.

Mathematica features used: 3x3 matrix, IdentityMatrix, Tr (trace), MatrixForm, evaluate last expression.

• Feb 4, 2012 phy454/continuumProblemSet1Q2.cdf

PHY454 Problem set 1. Q2.

Confirm the characteristic equation calculated manually.

Find the root, by solving the characteristic equation.

Find the eigenvalues and normalized eigenvectors.

Interesting mathematica functions used: Map which applies operation to list, Normalize, Solve, Table, Total -- adding all elements in a list.

• Feb 5, 2012 phy454/continuumProblemSet1Q3.cdf

PHY454 Problem set 1. Q3.

Confirm some manual matrix calculations.

Used Cross product function, and Orthogonalize for Gram-Schmidt like expansion.

• Feb 8, 2012 phy454/continuumProblemSet1Q2animated.cdf

PHY454 Problem set 1. Q2.

Animate the stress tensor associated with the problem, for different points and values of Poisson's ratio.

This generalizes the solution of the problem since answers visually whether the point is under expansion (blue arrow) or under compression (red arrow) at each point in space.

Mathematica manipulate sliders are used to select the spatial points and the value of Poisson's ratio.

Used a number of new (for me) mathematica features: Table, Arrow, If, Part, multiple colors in Graphics3D, DiagonalMatrix, Diagonal (select diagonal into list), Tr (not Trace!), Map, Eigenvalues, Eigenvectors, and in a later version Eigensystem to replace the last two.

The code has links to various stackexchange questions for this notebook. There's an answer on scaling that's incorporated into the Graphics3D options. One more mathematica stackexchange question answered on this little notebook which motivated the Dynamic and DynamicModule calls now here, and one more that drove the change to use Eigensystem.

• Feb 12, 2012 phy454/partErrorTestStandalone2D.cdf

Based on phy454continuumProblemSet1Q2animated.cdf, with most stuff stripped out to ask about the errors on initial load in mathematica.stackexchange question.

• Mar 3, 2012 phy454/twoLayerInclinedFlowDifferentDensities.cdf

Plug in some numbers for the viscosities and densities for the inclined fluid flow down a plane problem. Insertion of an air layer above the water ends up with the air speed humongous! Steady state not realistic? What are the length scales required for steady state?

New mathematica functions used: WolframAlpha, ChemicalData.

• Mar 4, 2012 phy454/twoLayerInclinedFlowDifferentDensitiesTheCalculation.cdf

Redo the hand calculation in twoLayerInclinedFlowDifferentDensities.tex completely in mathematica and verify the results. I did it right.

Notable mathematica functions used: Do, Solve, Collect, ExpandAll.

• Mar 13, 2012 phy454/continuumProblemSet2Fig1r2.cdf

Generate figures for continuum mechanics problem set II figure 1. Using Show and ParametericPlot for the first time. First version used Wacom tablet and graphics drawing options to put in arrows. Text labels later added with Inkscape latex-pdf. Later version used Array of Arrows to draw vector field. Looks much better.

• Mar 14, 2012 phy454/continuumProblemSet2Fig3.cdf

Figure3 for continuum mechanics problem set II. Used ChemicalData again and used Piecewise.

• Mar 14, 2012 phy454/problemSetIIQ3exactSolution.cdf

Exact solution to Q3 velocities. Return to this and plot it later.

• Mar 16, 2012 phy454/continuumL17Figures.cdf

erf Plot. Using AxesLabel

• Mar 22, 2012 phy454/problemSetIIQ3PlotWithManipulate.cdf

Plotting the two layer constant pressure gradient solution.

• Mar 29, 2012 phy454/continuumL20Figures.cdf

Generate figures for lecture 20 notes.

Animation for the time evolution of a channel flow due to constant pressure gradient turned on at an initial time for fluid at rest before that.

• Apr 4, 2012 phy454/continuumL22Figures.cdf

Figure for last lecture. Defined a rectGraphic function, just to create a drawing area. Toss that in a mathematica module file to learn how to make one.

• Apr 11, 2012 phy454/couetteFlow.cdf

Plot the Couette flow solutions. This is by far my coolest attempt to use Mathematica to do visualization so far. The velocity field is plotted in the appropriate circular contours, albeit without arrows and without an envelope with the contours of the field profile. New tricks learned for this notebook include the use of Slider, Dynamic, and RadioButtonBar. Row and Column were used to group the sliders and labels and resulting plots. I coded up a really cool viscosity and density selector too, but that did not get used here so I commented it out and disabled the initialization cell that I had put in for the ChemicalData lookup. Things were also coded in a nice clean fashion so that I could use one helper function to generate both the Manipulate like controls and also the table that I used to save an animation for my pdf file with the original calculations.

• Apr 14, 2012 phy454/twoCylinders.cdf

Plot the flow between two infinite cylinders. Mathematica coding style is getting nicer. This has no prologue attempting to be self contained with a nice text description ... too much work to do that in Mathematica instead of Latex. Used Manipulate to generate an animation that includes the sliders. Tried embedding this in the associated pdf, but ffmpeg cant handle it, and I do not know how to coerce it to do so.

• Apr 15, 2012 phy454/twoCylinders3D.cdf

Take the previous calculation and display and do it in 3D instead. Very cool.

• Apr 15, 2012 phy454/demoTemplateTwoCylinders3D.nb

Add some explanatory text, and put in the format required for the wolfram demo upload page.

• Apr 25, 2012 phy454/bottomlessCoffee.cdf

Plot the Bessel function fitting for the spin down of a bottomless coffee cup. Also animate the time evolution of the spin down with a Manipulate slider. As mentioned in the text, this does not match reality too well.

• Apr 25, 2012 phy454/continuumFluidsReview.cdf

The integral for chapter 7, problem 2 of Landau's fluids. Curve for a fluid meniscus up a wall.

• Apr 27, 2012 phy454/coffeeCupWithBottom.cdf

Solving the PDE for the non-bottomless coffee cup problem. Find Bessel functions of order 1. Find the fitting coefficients for stirring above the bottom, in the layer of fluid lower than the stirring. Plot this function, and verify against boundary condition.