Lab 03 - Jay1337/computational_physics GitHub Wiki

Background

  1. A differential equation itself is just described as an equation containing the derivatives of one or more unknown functions (or dependent variables), with respect to one or more independent variables, and an ordinary differential equation is one where the differential equation contains only ordinary derivatives of one or more unknown functions with respect to a single independent variable.
  2. A taylor expansion is a series of expansion of a function about a point and is about taking non-polynomial functions and finding polynomials that approximate them near some input, and it is useful because it makes things easier to compute and integrate.
  3. The general form of the Euler method is y_i = y_i-1 + hf(x_i-1, y_i-1) and it helps us find the next point in curve in small increments. The formula basically is calculating each next step(point) based off previous points and the initial value point. It is useful in solving differential equations because it allows us a simple way to approximate solutions for equations that may not necessarily have an exact solution due to complexity.

In this Lab

For the first part of this lab we applied the Euler method to approximate how the number of Uranium atoms declines as a function of time, and the way this was done was by coding in functions that would return time and nucleus arrays. This was done so that we could have a list of different values for one variable so that when we code in our Euler equation it will be able to use the values in our array. This is how our calculate Euler method came to be as it takes an initial value in our array and keeps going in a loop through the other values in or array from previous point to next point up until it hits our max time. Dt is what we use to keep advancing the system and changing said dt will affect and change our graphs as we can see from the graph for our different dts. Our dt is essential as it determines the type of steps we will be taking from point to point as we can either go in smaller steps or larger steps depending on our dt. From this lab we can see that a larger dt will make it so that steps are further away from each other meaning we are going from point to point in larger increments which could lead to inaccurate data deviating from the true analytical solution. With a small dt our data was the most accurate to the analytic solution due to the fact that with a smaller dt we go from point to point in smaller increments meaning less chance for error and deviation. This shows how important dt is, and without our analytic solution that we calculated in the code this fact would not have been able to be seen so clearly. We can tell how important certain variables are to our approximation with this analytic solution, which is important since an analytic solution is not always known to these complex equations so in order to get our approximations as close to correct as possible it is important to know how each variable affects the equation and in what way. This Euler method wasn't just used here as it was also found to be useful in finding out velocity and time for a complicated force which was a bicycle with air resistance as we modeled during class. In this modeling for cycling with the air resistance and the frag force taken into account we were able to break the complicated equation into component parts which we could use for inputs so that we can end up getting an output that returns velocity and time. The same sort of approach was used in with knowing the fact about dt it was known to use a low value of 0.1 for dt since we know that will make the graph go from point to point in small increments and give us high precision. We know we want to see velocity gradually going up with time so in order to see those details we choose a small value for dt.

image

image image image

https://colab.research.google.com/drive/1_FjhEvPqkaSyib9toRX85vjOt75VmkJ-?usp=sharing