<!--
Automatically generated HTML file from DocOnce source
(https://github.com/hplgit/doconce/)
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="description" content="App.E: Programming of differential equations">

<title>App.E: Programming of differential equations</title>


<link href="https://raw.githubusercontent.com/hplgit/doconce/master/bundled/html_styles/style_solarized_box/css/solarized_light_code.css" rel="stylesheet" type="text/css" title="light"/>
<script src="https://rawgit.com/hplgit/doconce/master/bundled/html_styles/style_solarized_box/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

<link href="http://thomasf.github.io/solarized-css/solarized-light.min.css" rel="stylesheet">
<style type="text/css">
h1 {color: #b58900;}  /* yellow */
/* h1 {color: #cb4b16;}  orange */
/* h1 {color: #d33682;}  magenta, the original choice of thomasf */
.alert-text-small   { font-size: 80%;  }
.alert-text-large   { font-size: 130%; }
.alert-text-normal  { font-size: 90%;  }
.alert {
  padding:8px 35px 8px 14px; margin-bottom:18px;
  text-shadow:0 1px 0 rgba(255,255,255,0.5);
  border:1px solid #93a1a1;
  border-radius: 4px;
  -webkit-border-radius: 4px;
  -moz-border-radius: 4px;
  color: #555;
  background-color: #eee8d5;
  background-position: 10px 5px;
  background-repeat: no-repeat;
  background-size: 38px;
  padding-left: 55px;
  width: 75%;
 }
.alert-block {padding-top:14px; padding-bottom:14px}
.alert-block > p, .alert-block > ul {margin-bottom:1em}
.alert li {margin-top: 1em}
.alert-block p+p {margin-top:5px}
.alert-notice { background-image: url(https://raw.github.com/hplgit/doconce/master/bundled/html_images/small_yellow_notice.png); }
.alert-summary  { background-image:url(https://raw.github.com/hplgit/doconce/master/bundled/html_images/small_yellow_summary.png); }
.alert-warning { background-image: url(https://raw.github.com/hplgit/doconce/master/bundled/html_images/small_yellow_warning.png); }
.alert-question {background-image:url(https://raw.github.com/hplgit/doconce/master/bundled/html_images/small_yellow_question.png); }

div { text-align: justify; text-justify: inter-word; }
</style>


</head>

<!-- tocinfo
{'highest level': 1,
 'sections': [(u' How to solve any ordinary scalar differential equation ',
               1,
               None,
               '___sec0'),
              (u' Examples on scalar differential equations (ODEs) ',
               2,
               None,
               '___sec1'),
              (u" We shall write an ODE in a generic form: $u'=f(u,t)$ ",
               2,
               None,
               '___sec2'),
              (u' What is the $f(u,t)$? ', 2, None, '___sec3'),
              (u' Such abstract $f$ functions are widely used in mathematics ',
               2,
               None,
               '___sec4'),
              (u' We use finite difference approximations to derivatives to turn an ODE into a difference equation ',
               2,
               None,
               '___sec5'),
              (u" The Forward Euler (or Euler's) method ",
               2,
               None,
               '___sec6'),
              (u' Illustration of the forward finite difference ',
               2,
               None,
               '___sec7'),
              (u" Let's apply the method! ", 2, None, '___sec8'),
              (u' An ODE needs an initial condition: $u(0)=U_0$ ',
               2,
               None,
               '___sec9'),
              (u' We continue solution by hand ', 2, None, '___sec10'),
              (u' How accurate is our numerical method? ',
               2,
               None,
               '___sec11'),
              (u" What about the general case $u'=f(u,t)$? ",
               2,
               None,
               '___sec12'),
              (u" We start with a specialized program for $u'=u$, $u(0)=U_0$ ",
               2,
               None,
               '___sec13'),
              (u" We start with a specialized program for $u'=u$, $u(0)=U_0$ ",
               2,
               None,
               '___sec14'),
              (u' The solution if we plot $u$ against $t$ ',
               2,
               None,
               '___sec15'),
              (u" The algorithm for the general ODE $u'=f(u,t)$ ",
               2,
               None,
               '___sec16'),
              (u" Implementation of the general algorithm for $u'=f(u,t)$ ",
               2,
               None,
               '___sec17'),
              (u' Example on using the function ', 2, None, '___sec18'),
              (u' Now you can solve any ODE! ', 2, None, '___sec19'),
              (u' Let us make a class instead of a function for solving ODEs ',
               2,
               None,
               '___sec20'),
              (u' The code for a class for solving ODEs (part 1) ',
               2,
               None,
               '___sec21'),
              (u' The code for a class for solving ODEs (part 2) ',
               2,
               None,
               '___sec22'),
              (u' Alternative class code for solving ODEs (part 1) ',
               2,
               None,
               '___sec23'),
              (u' Alternative class code for solving ODEs (part 2) ',
               2,
               None,
               '___sec24'),
              (u' Verifying the class implementation; mathematics ',
               2,
               None,
               '___sec25'),
              (u' Verifying the class implementation; implementation ',
               2,
               None,
               '___sec26'),
              (u' Using a class to hold the right-hand side $f(u,t)$ ',
               2,
               None,
               '___sec27'),
              (u' Figure of the solution ', 2, None, '___sec28'),
              (u' Numerical methods for ordinary differential equations ',
               2,
               None,
               '___sec29'),
              (u' A superclass for ODE methods ', 2, None, '___sec30'),
              (u' The superclass code ', 2, None, '___sec31'),
              (u' Implementation of the Forward Euler method ',
               2,
               None,
               '___sec32'),
              (u' The implementation of a Runge-Kutta method ',
               2,
               None,
               '___sec33'),
              (u' The user should be able to check intermediate solutions and terminate the time stepping ',
               2,
               None,
               '___sec34'),
              (u' Systems of differential equations (vector ODE) ',
               1,
               None,
               '___sec35'),
              (u' Example on a system of ODEs (vector ODE) ',
               2,
               None,
               '___sec36'),
              (u' The ODE system that is the final project in the course ',
               2,
               None,
               '___sec37'),
              (u' Another example on a system of ODEs (vector ODE) ',
               2,
               None,
               '___sec38'),
              (u' Making a flexible toolbox for solving ODEs ',
               2,
               None,
               '___sec39'),
              (u' Vector notation for systems of ODEs: unknowns and equations ',
               2,
               None,
               '___sec40'),
              (u' Vector notation for systems of ODEs: vectors ',
               2,
               None,
               '___sec41'),
              (u' How to make class ODESolver work for systems of ODEs ',
               2,
               None,
               '___sec42'),
              (u' The adjusted superclass code (part 1) ',
               2,
               None,
               '___sec43'),
              (u' The superclass code (part 2) ', 2, None, '___sec44'),
              (u' Example on how to use the general class hierarchy ',
               2,
               None,
               '___sec45'),
              (u' Alternative implementation of the $f$ function via a class ',
               2,
               None,
               '___sec46'),
              (u' Throwing a ball; ODE model ', 2, None, '___sec47'),
              (u' Throwing a ball; code ', 2, None, '___sec48'),
              (u' Throwing a ball; results ', 2, None, '___sec49'),
              (u' Logistic growth model; ODE and code overview ',
               2,
               None,
               '___sec50'),
              (u' Logistic growth model; class Problem ($f$) ',
               2,
               None,
               '___sec51'),
              (u' Logistic growth model; class Solver ', 2, None, '___sec52'),
              (u' Logistic growth model; results ', 2, None, '___sec53')]}
end of tocinfo -->

<body>



<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  TeX: {
     equationNumbers: {  autoNumber: "none"  },
     extensions: ["AMSmath.js", "AMSsymbols.js", "autobold.js", "color.js"]
  }
});
</script>
<script type="text/javascript"
 src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>



    
<a name="part0016"></a>
<!-- !split -->

<h2>The solution if we plot \( u \) against \( t \)  <a name="___sec15"></a></h2>

<p>
\( \Delta t = 0.4 \) and \( \Delta t=0.2 \):
<br />
<br />

<p>
<center><p><img src="fig-ode2/FE_n_10_20.png" align="bottom" width=600></p></center>

<p>
<p>
<!-- begin bottom navigation -->
<table style="width: 100%"><tr><td>
<div style="text-align: left;"><a href="._ode2-solarized015.html">&laquo; Previous</a></div>
</td><td>
<div style="text-align: right;"><a href="._ode2-solarized017.html">Next &raquo;</a></div>
</td></tr></table>
<!-- end bottom navigation -->
</p>

<!-- ------------------- end of main content --------------- -->


</body>
</html>
    

