Preface
This tutorial was made solely for the purpose of education and it was designed for students taking Applied Math 0340. It is primarily for students who have some experience using Mathematica. If you have never used Mathematica before and would like to learn more of the basics for this computer algebra system, it is strongly recommended looking at the APMA 0330 tutorial. As a friendly reminder, don't forget to clear variables in use and/or the kernel. The Mathematica commands in this tutorial are all written in bold black font, while Mathematica output is in regular fonts.
Finally, you can copy and paste all commands into your Mathematica notebook, change the parameters, and run them because the tutorial is under the terms of the GNU General Public License (GPL). You, as the user, are free to use the scripts for your needs to learn the Mathematica program, and have the right to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015; http://www.crcpress.com/product/isbn/9781439851043
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the first course APMA0330
Return to the main page for the second course APMA0340
Return to Part IV of the course APMA0340
Introduction to Linear Algebra
Glossary
Euler Methods
A common example of a physics problem that requires the solution of a differential equation is the motion of a particle acted on by a force. For simplicity, we first discuss one-dimensional motion so that only a single vector component of position, velocity, and acceleration are needed. These variables are related using the language of differential calculus
Why do we need the concept of acceleration in kinematics? The answer can be found only aposteriori. Thanks to Newton, we know that the net force acting on a particle determines its acceleration. Newton’s second law of motion tells us that
The two ﬁrst-order equations can be combined to obtain the familiar second- order diﬀerential equation for the position:
Because many types of systems can be modeled by the above system of differential equations such, it is important to know how to solve such equations. In general, analytical solutions of differential equations, that is, solutions in terms of well-known functions, do not exist. We are therefore motivated to find numerical solutions of differential equations. However, analytical solutions are very important and often exist in special or limiting cases. We often use them to test our numerical solutions.
The power of mathematics when applied to physics comes in part from the fact that frequently seemingly unrelated problems can have the same mathematical formulation. Hence, if we can solve one problem, we can solve other problems that might appear to be unrelated.
We start demonstrating the Euler methods to Newton’s equations of motion. We write Newton’s second as a system of coupled first-order differential equations and apply the Euler algorithm to each variable. The variables of interest are
In this section, we extend Euler methods to systems of differential equations. It is a custom to denote by t the independent variable that we associate with time. Then denoting the derivatives by dots, we illustrate the concepts by considering the initial value problem
A numerical solution to the given system over the interval \( a \le t \le b \) is found by considering the differentials
Euler method for systems of differential equations
Module[{t, Y, h = (b - a)/Steps//N, i},
t[0] = a; Y[0] = Y0;
Do[
t[i] = a + i h;
Y[i] = Y[i - 1] + h F[t[i - 1], Y[i - 1]],
{i, 1, n}
];
Table[{t[i], Y[i]}, {i, 0, n}]
]
Using for simplicity the initial point to be the origin. we present another way to implement the Euler rule:
TimeMax = 3.5;
maxN = TimeMax/h;
plotmax = 5;
plotmin = -5;
fx[x_, y_] = y + x
Out[8]= x+y
fy[x_, y_] = -2 x + 3 y
Out[9]= -2 x + 3 y
xxo = -1.5;
yyo = -0.5;
xx[0] := xxo
yy[0] := yyo
xx[n_] := xx[n] = xx[n - 1] + h*fx[xx[n - 1], yy[n - 1]]
yy[n_] := yy[n] = yy[n - 1] + h*fy[xx[n - 1], yy[n - 1]]
MatrixForm[Table[{h*n, xx[n], yy[n]}, {n, 0, maxN}]]
We can make several different types of plots. Here we plot on the phase plane using dots and then using line segments
ListPlot[Table[{xx[n], yy[n]}, {n, 0, maxN}],
PlotStyle -> {PointSize[Large], Red}]
ListLinePlot[Table[{xx[n], yy[n]}, {n, 0, maxN}],
PlotStyle -> {Thick, Green}]
Here we create the associated streamplot
StreamPlot[{fx[x, y], fy[x, y]}, {x, plotmin, plotmax}, {y, plotmin,
plotmax}]
We plot x-component versus t
PlotStyle -> {Thick, Blue}]
We plot y-component versus t
PlotStyle -> {Thick, Green}]
Finally, we mash them all together
We know from the previous section that Euler's rule is not recommended for practical usage. Recalling the backward Euler method, we arrive at the Euler--Cromer algorithm:
Example: Consider the initial https://www.researchgate.net/publication/237621801_Motion_in_One_Dimension ■
Example: Consider the initial ■
Stanley, R.W., Numerical metods in mechnaics, American Journal of Physics, 1984, Vol. 52, pp. 499--507.
- William R. Bennett, Scientiﬁc and Engineering Problem-Solving with the Computer, Prentice Hall (1976)
- Byron L. Coulter and Carl G. Adler, “Can a body pass a body falling through the air?,” American Journal of Physics, 47, 841 (1979).
- A. P. French, Newtonian Mechanics, W. W. Norton & Company (1971). Chapter 7 has an excellent discussion of air resistance and a detailed analysis of motion in the presence of drag resistance
- Ian R. Gatland, “Numerical integration of Newton’s equations including velocity-dependent forces,” American Journal of Physics, 62, 259 (1994). The author discusses the Euler-Richardson algorithm
- Margaret Greenwood, Charles Hanna, and John Milton, “Air resistance acting on a sphere: numerical analysis, strobe photographs, and videotapes,” The Physics Teacher, 1986, Vol. 24, 153 (1986); https://doi.org/10.1119/1.2341969. More experimental data and theoretical analysis are given for the fall of ping-pong and styrofoam balls. Also see Mark Peastrel, Rosemary Lynch, and Angelo Armenti, “Terminal velocity of ashuttlecock in vertical fall,” American Journal of Physics, 48, 511 (1980).
- K. S. Krane, “The falling raindrop: variations on a theme of Newton,” Am. J. Phys. 49, 113 (1981). The author discusses the problem of mass accretion by a drop falling through a cloud of droplets
- Mehta, R.D., “Aerodynamics of sports balls,” Annual Review of Fluid Mechanics, 1985, Vol. 17, pp. 151--189. https://doi.org/10.1146/annurev.fl.17.010185.001055
- Neville de Mestre, The Mathematics of Projectiles in Sport, Cambridge University Press (1990). The emphasis of this text is on solving many problems in projectile motion, for example, baseball, basketball, and golf, in the context of mathematical modeling. Many references to the relevant literature are given.
- Forman S. Acton, Numerical Methods that work, Harper & Row (1970); corrected edition, Mathematical Association of America (1990). A somewhat advanced, but clearly written text in the 1960s; it is more about the 1950s world of computation; it makes only brief mention of the QR algorithm for eigenvalues and does not cover the singular value decomposition or variable step size ODE solvers. Moreover, the author has an aversion to library routines and to rigorous error bounds.
Return to Mathematica page
Return to the main page (APMA0340)
Return to the Part 1 Matrix Algebra
Return to the Part 2 Linear Systems of Ordinary Differential Equations
Return to the Part 3 Non-linear Systems of Ordinary Differential Equations
Return to the Part 4 Numerical Methods
Return to the Part 5 Fourier Series
Return to the Part 6 Partial Differential Equations
Return to the Part 7 Special Functions