@ShixingWang
2016-04-02T21:38:30.000000Z
字数 11908
阅读 1549
First written with Jupyter.
The differential equation codes can be found here and the subplot codes here.
Although it has been the ultimate goal for scientists to find the analytical solution of the nature, some complicated sysyems still hinder people from this dream in which circumstances numerical methods are necessary. Ordinary differential equations are good practice for us to get familiar with the numerical methods, for we can compare our result with the known analytical solution. In this problem, we consider a system in which The errors for ingoring high rank differentiation may sometimes make such methods invalid, so various initial conditions and parameters are discussed to examine the sensitivity of the parameters and the rubustness of the method.
The categories of equations are based on the type of known quantities and the calculation on the unknown quantities. The equations are called algebraic equtions or transcedent equations if the unknown quantities are numbers. An equation is called a function equation if the unknown quantity is a function. It is called a differential equation if there are derivative or differential in an equation, among which the ones containing functions with only one variables are called the ordinary differential equations.
And as is proven, the theorem about the existence and uniqueness of the solution says for a differential equation
with the boundary condition , the solution exists and is unique if in the region
As we know, any real or complex function that can be differentiated to infinite orders at point can be represented as an infinite sum of about the differentials like
What we have and will be doing in this exercise has little to do with first principles of physics. Rather, they are just methematical modelling problems. As a result, it is necessary to discuss the sensitivity and robustness, two of the essential concepts in mathematical modelling.
To set up a model describing a phenomenon, parameters play an important role in the final results of the model. These parameters are obtained from measurements, observations, and sometimes even by guess. So the inaccuracy of the data must be taken into consideration. Usually, for a certain extent of change of a parameter, the variable will change correspondingly. For the parameter and the variable ,
A mathematical model is called robust if the result is still correct even if the model is not absolutely accurate. Sensitivity is a kind of index to evaluate the robustness of the model based on the data. Other assumptions will also be examined to ensure the robustness.
In most questions after Chapter 1 of our textbook, we have been informed of the models to use and only have to realize the model through Python and cast the parameters into the program. So the sensitivity and robustness of our parameters become important.
It is convenient to draw plots with Python, since there have been the powerful packages numpy
and matplotlib
.
numpy
is a package that can deal with the discrete calculations that will be used in the ploting. Not only can it create number lists with the function arrange
and linspace
, it also contains the general math functions like the triangluar function sin
cos
.[5]
matplotlib
is the package that deal with the representation of plots. [6] Through the internal functions we can easily And other information about this package and the rebellish of pots can be found here.
Consider again a decay problem with two types of nuclei A and B, but now suppose that nuclei of typw A decay into type B, while nuclei of type B decay into type A. Strictly speaking, this is not a "decay" process, since it is possible for the type B nuclei to turn back into type A. A better analogy would be a resonance in which a system can tunnel or move back and forth between two states A and B which have equal energies. The corresponding rate equations are
where for simplicity we have assumed that the two types of decay are characterized by the same time constant . Solve the system of equations for the numbers of nuclei, as functions of time. Consider different initial confitions, such as etc, and take . Show that your numerical results are consistent with the idea that the system reaches a steady state in which are constant. In such a steady state, the time derivatives should vanish.
Apparently the decay constants of A and B are important parameters. Here we have assumed that the two parameters equal. However, they do not necessarily have to be, so we declear $\tau_A$
and $\tau_B$
as separate parameters and initialize them with the same quantity.
Another parameter is the time interval for the Euler fold line to approximate the "true" solution of the equations. Apparently the smaller this parameter dt
is, the closer our numerical solution will approach the true solution, but the slower the program will be. For convenience we set and will examine the effect of it value in the Discussion
section.
And as an intuition, the system will become stable after certain amount of time. So we need a parameter timescale
to control the time we want the system to develop.
As for the variables, the solutions are the function and . So we need two lists to store the value of and and a time list which has the same length of and . The initial conditions are initialized as the first element of the lists.
The algorithm of the problem is straightforward. We set up a cycle in which the new and value is obtained from the value of and before the time interval plus the product of the time interval and the derivative of and versus time.
Since the function and has been stored into the lists, we can plot them with the help of package matplotlib
The curve cannot be seen because it is below the x-axis. And it should be the mirror refelction of (the proof is shown below).
According to the eigenvector mathod we can solve such ordinary differential equations fairly easily. For the equations with the boundary conditions
Our numerical solution show a exponential feature and the derivative about time vanish as time approaches infinity. And the
This means the tendency of and depends on which of the two quantities and is greater. If the former is greater, then decreases and increases, and vice versa. And remind that at every time So this process can also be treated as an exchange of states for a certain matter.
To draw several figures in the same picture we need the function subplot
, and the settings of the ticks and limits of x-axis and y-axis are slightly different with plot
function.
According to the analytical solution, the number of A and B at the final state
Here we choose the same decay constant () and fix , to get the effect of different
According to the Reference [4], the sensitivity of A and B about and
This means the sensitivities can never be over 1, and are independent with the initial number.
Here we fix and use various and
As is introduced in the Background
section, the validity of Euler method depends on the Euler fold line as the approximation of the true solution curve. Specifically, it depends on the fact that the iterating interval is ralatively small comparing to the system of interest. But how big can this interval be? We tried several length of interval and the resluts are shown below.
All the codes and report are written by myself.
I must give my appreciation to FC Bayern Munchen club for their exciting victory in Allianz Arena against Juventus. They gave me an excellent weekend so that I can finish this exercise joyfully! Really looking forward to their highlight performance in Milan!
[1] Differential Equation Group of Northeast University. Ordinary Differential Equation, Second Edition. Higher Education Press, April 2005.
[2] Qi, Minyou et al. Advanced Mathematics. Wuhan University Press, August 2008.
[3] Wikipedia contributors. "Taylor series." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia, 20 Mar. 2016. Web. 22 Mar. 2016.
[4] Meerschaert, Mark M. Mathematical Modelling,Fourth Edition. China Machine Press, Janurary 1, 2015.
[5] "lectery", a Baidu user. Maypoltlib Guidebook.
http://wenku.baidu.com/link?url=haYK7EyFYYblwual6X1lAihWbvIFvYWx2MvEclbgARNn76kNJO9kU0Fb6R40YPuA71iHk60fD7HX_9PCaDTTuulVSRLcQwopIngL6uZjNpW
[6] Nicolas P. Rougier. Matplotlib Tutorial. http://www.labri.fr/perso/nrougier/teaching/matplotlib/