This assignment was mostly a warmup to get us started in this class, but it highlighted a couple of important limitations of numerical differentiation.
Please see the solution description below:
Takeaways
A derivative is better with smaller evaluation steps. A central difference can prevent leading and lagging derivatives, provided you are ok
with losing some higher frequency content (tips of hills and troughs).
Assignment 2: Numerical Integration
Goals
This assignment introduces a use-case for numerical integration in the form of Fresnel diffraction.
Please see the solution description below:
Takeaways
Although I was taught calculus with the concept of a Riemann sum (and trapezoid sum), I had not implemented a programmatic version until
finishing this assignment. The equations which made the solution were given to us, but executing
this highlighted the power of breaking down a complicated problem into a set of solvable individual problems.
This also served as a good example of an equation which has no analytical solution, but which yields to a numerical approach.
My original submission for this class took the form of a C script and Latex-style writeup.
Assignment 3: Root Finding and Special Functions
Goals
This assignment was partially about finding access to special scientific functions for numerical analysis,
and partially about comparing a couple methods for root finding. In particular: how to access Bessel functions,
useful for all sorts of physics, and then comparing Regula Falsi or the False Position Method to the method of
Bisection for root finding.
Please see the solution description below:
Takeaways
Some algorithms accomplish the same task as another but more efficiently (using fewer function calls). Some algorithms vary in their efficiency if given
a different starting point or set of inputs. These conclusions are a bit obvious, but it still helps to see the differences in practice between,
for example, a bisection method and regula falsi.
My original submission for this class took the form of a Latex-style writeup.
Assignment 4: Ordinary Differential Equations and Chaotic Systems
Goals
This assignment introduced the Runge-Kutta method of ODE propagation and asked for solutions to a set of chaotic differential equations. My original solution
was pretty single-shot, so I tried to spend a little time making the python version more reusable and modular.
Please see the solution description below:
Takeaways
The Runge-Kutta method is a good way to propagate differential equations which have no analytical solution (if they can be written in the appropriate form).
It is sometimes worth it to make functions and algorithms more modular and reusable to avoid re-writing code. Being able to apply
your program to a wider range of tasks requires time and effort to architect correctly.
My original submission for this class took the form of a Latex-style writeup.
Assignment 5: Three or More Body Problem
Goals
This assignment implements an adaptive step-size version of the Runge-Kutta method using the Dormand-Prince coefficients to simulate planetary orbits.
Similarly to the other assignments, my original solution was very single-use, so I wanted the new
implementation to be more modular. In particular, I wanted to add and subtract orbiting bodies while maintaining the
propagation style of my prior assignment.
[Solution Description in Progress!]
Takeaways
My biggest takeaway from this assignment was how delicately balanced our solar system is. Of course, the anthropic principle necessitates the relative stability,
but even a simple system with simple rules can be sensitive to initial conditions and to perturbation. Another takeaway from the reimplementation is just
how difficult it is to architect an object oriented structure around a propagation based on in-line arrays.
My original submission for this class took the form of a Latex-style writeup.
Assignment 6: Boundary Value Problems and Relaxation
Goals
This assignment asked me to produce the electrostatic potential across a space with boundary values set on 3 electrodes in the region.
The 2D space needs to be tesselated for a finite difference method to be used, and then successive over-relaxation allows us to approach
a solution of a specified precision.
[Solution Description in Progress!]
Takeaways
Thinking about the symmetry of the problem can reduce the amount of calculation you actually need to perform. One does not need the potential in all space
for a cylindrical setup, just a small slice! Keep an eye on convergence times, and optimize where possible. Plots can be beautiful.
My original submission for this class took the form of a Latex-style writeup.
Assignment 7: Time Dependent Schrödinger Equation
Goals
This assignment calculates a wavefunction following Schrödinger's equation in a 1-dimensional space as it interacts with a couple of potential wells and barriers.
I need to keep track of both the real and imaginary parts of the wavefunction across space, and propagate through time with the Crank-Nicholson approach.
[Solution Description in Progress!]
Takeaways
Quantum particles don't behave like classical ones when interacting with a barrier. This much is obvious from my introductory quantum courses, but it is
nice to see in a full simulation over many time steps. Time-dependent equations are better understood in animation.
My original submission for this class took the form of a Latex-style writeup.
Assignment 8: Least Squares Curve Fitting
Goals
This assignment taught me how to calculate a best-fit line following a more complex linear combination of functions.
[Solution Description in Progress!]
Takeaways
One does not need to rely on Excel's limited fit finding functions for complex data. If there is a model you would like to fit which is a linear sum of terms,
one can use this method to calculate the coefficients on that linear sum.
My original submission for this class took the form of a Latex-style writeup.
Assignment 9: Monte Carlo Calculations
Goals
This assignment focused on using a Monte Carlo method to simulate protein folding in 2 dimensions. The principle of Monte Carlo methods is widely applicable,
and one of my goals is to produce a compelling visualization of this technique applied to 2D "proteins."
[Solution Description in Progress!]
Takeaways
Running this kind of random-computation-heavy calculation takes a really long time. Even running in C on my laptop, some of these simulations took minutes to run.
It is worth printing out progress reports along the way to make sure you aren't wasting time!
My original submission for this class took the form of a Latex-style writeup.
Assignment 10: The Fast Fourier Transform (FFT) and Spectral Methods
Goals
This assignment uses the Fast Fourier Transform as a way to solve the wave equation in 2 dimensions.
Takeaways
The biggest challenge in the C/C++ version of the assignment was just getting the libraries working properly. It is important to make sure you are aware
of the tools out there to tackle the problem at hand. Nice visualizations can be a goal in their own right. Unrealistic starting conditions can still lead
to unrealistic looking results (the sharp edge on a perfectly square starting position still looks strange after many time-steps).
My original submission for this class took the form of a Latex-style writeup.
Diffusion-Limited Aggregation
Goals
For my final project in AEP 4380, I chose to investigate diffusion-limited aggregation. The class ended in the wintertime, so the topic of
snow crystal growth seemed appropriate subject matter, and I was interested in creating something visually interesting. I read some reference documents
before getting started:
Demange, G., Zapolsky, H., Patte, R. et al. A phase field model for snow crystal growth in three dimensions. npj Comput Mater 3, 15 (2017). https://doi.org/10.1038/s41524-017-0015-1
My first thought was about how limiting the 2D grid lattice is in terms of visual appearance of the crystal. I could see extending this concept
to a larger scale just to be able to render shapes a little more clearly, or with crystals drawn as 2D sprites. I think this simulation is
much more compelling as an animation than as static images.
My original submission for this class took the form of a Latex-style writeup.