Scientific Computing Midterm
Sean Paradiso1CS 5102Midterm345Introduction6-------------78The python class Attractor has multiple methods to perform a variety of operations. Some of which include the utilization of Euler and Runge-Kutta to increment through a set of given differential equations, plotting of the results from the given set of differential equations, test cases, and more. A few of the useful built-in tools at use here were numpy, pandas, and matplotlib.910Requirements11-------------1213This project required the following:14- Attractor class15- euler method16- rk2 method17-rk4 method18- evolve method19- save method20- plotx, ploty, and plotz methods21- plotxy, plotyz, and plotzx methods22- plot3d method23- test_attractor module2425Detailed Descriptions26----------------------2728The Attractor class takes three initialization parameters and stores them as a numpy array. It also takes an additional three initialization parameters used to compute a time increment to be used later.2930The euler method takes a numpy array and returns the Euler increment for the set of three given differential equations.3132rk2 proceeds very similarly to the euler method, however, returns the second order Runge-Kutta increment.3334rk4 is the same as rk2 with the exception of returning the fourth order Runge-Kutta increment.3536The method evolve takes a numpy array and an integer order to generate a pandas DataFrame.3738A very straight forward method, save simply saves the self.solution variable to a CSV file on disk.3940As to be expected from the names, plotx , ploty, and plotz take advantage of the matplotlib to generate two dimensional plots of the x(t), y(t), and z(t) curves vs. time accordingly.4142The methods plotxy, plotyz, and plotzx plot the logical pairs of the solution curves in two dimension.4344Taking it a step further, the plot3d method generates a three dimensional plot of the x-y-z solution curves4546Our module test_attractor is where the tests are stored to experiment with the class and methods to ensure functionality.4748Finally, the ExploreAttractor notebook loads the entire module and uses it to answer the following:49501. How does the plotted solution depend on your choice of time step size, and your choice of increment? Do you see an improvement in precision from using the higher-order integration methods?512. How does the solution depend upon the initial conditions [x0, y0, z0]? How small a change can you make while still reproducing roughly the same dynamical curves?5253