Files
pylib/docs/build/html/numerical.html
Daniel Weschke b566c643db add mathematical functions module
update docs and clean up code
2019-10-27 15:02:44 +01:00

589 lines
32 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>numerical package &#8212; pylib 2019.5.19 documentation</title>
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="numerical-package">
<h1>numerical package<a class="headerlink" href="#numerical-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-numerical.fit">
<span id="numerical-fit-module"></span><h2>numerical.fit module<a class="headerlink" href="#module-numerical.fit" title="Permalink to this headline"></a></h2>
<p>Function and approximation.</p>
<dl class="field-list simple">
<dt class="field-odd">Date</dt>
<dd class="field-odd"><p>2019-10-15</p>
</dd>
</dl>
<span class="target" id="module-fit"></span><dl class="function">
<dt id="numerical.fit.gauss">
<code class="sig-name descname">gauss</code><span class="sig-paren">(</span><em class="sig-param">x</em>, <em class="sig-param">*p</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/fit.html#gauss"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.fit.gauss" title="Permalink to this definition"></a></dt>
<dd><p>Gauss distribution function.</p>
<div class="math notranslate nohighlight">
\[f(x)=ae^{-(x-b)^{2}/(2c^{2})}\]</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) positions where the gauss function will be calculated</p></li>
<li><p><strong>p</strong> (<em>list</em>) <p>gauss parameters [a, b, c, d]:</p>
<ul>
<li><p>a amplitude (<span class="math notranslate nohighlight">\(\int y \,\mathrm{d}x=1 \Leftrightarrow a=1/(c\sqrt{2\pi})\)</span> )</p></li>
<li><p>b expected value <span class="math notranslate nohighlight">\(\mu\)</span> (position of maximum, default = 0)</p></li>
<li><p>c standard deviation <span class="math notranslate nohighlight">\(\sigma\)</span> (variance <span class="math notranslate nohighlight">\(\sigma^2=c^2\)</span>)</p></li>
<li><p>d vertical offset (default = 0)</p></li>
</ul>
</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>gauss values at given positions x</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>numpy.ndarray</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="numerical.fit.gauss_fit">
<code class="sig-name descname">gauss_fit</code><span class="sig-paren">(</span><em class="sig-param">x</em>, <em class="sig-param">y</em>, <em class="sig-param">e=None</em>, <em class="sig-param">x_fit=None</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/fit.html#gauss_fit"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.fit.gauss_fit" title="Permalink to this definition"></a></dt>
<dd><p>Fit Gauss distribution function to data.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) positions</p></li>
<li><p><strong>y</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) values</p></li>
<li><p><strong>e</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) error values (default = None)</p></li>
<li><p><strong>x_fit</strong> (<em>int</em><em> or </em><em>float</em><em> or </em><em>list</em><em> or </em><em>numpy.ndarray</em>) positions of fitted function (default = None, if None then x
is used)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) verbose information (default = False)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><ul class="simple">
<li><p>numpy.ndarray fitted values (y_fit)</p></li>
<li><p>numpy.ndarray parameters of gauss distribution function (popt:
amplitude a, expected value <span class="math notranslate nohighlight">\(\mu\)</span>, standard deviation
<span class="math notranslate nohighlight">\(\sigma\)</span>, vertical offset d)</p></li>
<li><p>numpy.float64 full width at half maximum (FWHM)</p></li>
</ul>
</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>tuple</p>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<p><a class="reference internal" href="#numerical.fit.gauss" title="numerical.fit.gauss"><code class="xref py py-meth docutils literal notranslate"><span class="pre">gauss()</span></code></a></p>
</div>
</dd></dl>
</div>
<div class="section" id="module-numerical.integration">
<span id="numerical-integration-module"></span><h2>numerical.integration module<a class="headerlink" href="#module-numerical.integration" title="Permalink to this headline"></a></h2>
<p>Numerical integration, numerical quadrature.</p>
<p>de: numerische Integration, numerische Quadratur.</p>
<dl class="field-list simple">
<dt class="field-odd">Date</dt>
<dd class="field-odd"><p>2015-10-15</p>
</dd>
</dl>
<span class="target" id="module-integration"></span><dl class="function">
<dt id="numerical.integration.trapez">
<code class="sig-name descname">trapez</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">a=0</em>, <em class="sig-param">b=1</em>, <em class="sig-param">N=10</em>, <em class="sig-param">x=None</em>, <em class="sig-param">verbose=False</em>, <em class="sig-param">save_values=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/integration.html#trapez"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.integration.trapez" title="Permalink to this definition"></a></dt>
<dd><p>Integration of <span class="math notranslate nohighlight">\(f(x)\)</span> using the trapezoidal rule
(Simpsons rule, Keplers rule).</p>
<p>de: Trapezregel, Simpsonregel (Thomas Simpson), Keplersche
Fassregel (Johannes Kepler)</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>f</strong> (<em>function</em><em> or </em><em>list</em>) function to integrate.</p></li>
<li><p><strong>a</strong> (<em>float</em>) lower limit of integration (default = 0).</p></li>
<li><p><strong>b</strong> (<em>float</em>) upper limit of integration (default = 1).</p></li>
<li><p><strong>N</strong> (<em>int</em>) specify the number of subintervals.</p></li>
<li><p><strong>x</strong> (<em>list</em>) variable of integration, necessary if f is a list
(default = None).</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) print information (default = False)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>the definite integral as approximated by trapezoidal
rule.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>float</p>
</dd>
</dl>
<p>The trapezoidal rule approximates the integral by the area of a
trapezoid with base h=b-a and sides equal to the values of the
integrand at the two end points.</p>
<div class="math notranslate nohighlight">
\[f_n(x) = f(a)+\frac{f(b)-f(a)}{b-a}(x-a)\]</div>
<div class="math notranslate nohighlight">
\[\begin{split}I &amp;= \int\limits_a^b f(x) \,\mathrm{d}x \\
I &amp;\approx \int\limits_a^b f_n(x) \,\mathrm{d}x \\
&amp;= \int\limits_a^b
\left( f(a)+\frac{f(b)-f(a)}{b-a}(x-a) \right)
\mathrm{d}x \\
&amp;= \left.\left( f(a)-a\frac{f(b)-f(a)}{b-a} \right)
x \right\vert_a^b +
\left. \frac{f(b)-f(a)}{b-a} \frac{x^2}{2}
\right\vert_a^b \\
&amp;= \frac{b-a}{2}\left[f(a)+f(b)\right]\end{split}\]</div>
<p>The composite trapezium rule. If the interval is divided into n
segments (not necessarily equal)</p>
<div class="math notranslate nohighlight">
\[a = x_0 \leq x_1 \leq x_2 \leq \ldots \leq x_n = b\]</div>
<div class="math notranslate nohighlight">
\[\begin{split}I &amp;\approx \sum\limits_{i=0}^{n-1} \frac{1}{2} (x_{i+1}-x_i)
\left[f(x_{i+1})+f(x_i)\right] \\\end{split}\]</div>
<p>Special Case (Equaliy spaced base points)</p>
<div class="math notranslate nohighlight">
\[x_{i+1}-x_i = h \quad \forall i\]</div>
<div class="math notranslate nohighlight">
\[I \approx h \left\{ \frac{1}{2} \left[f(x_0)+f(x_n)\right] +
\sum\limits_{i=1}^{n-1} f(x_i) \right\}\]</div>
<p class="rubric">Example</p>
<div class="math notranslate nohighlight">
\[\begin{split}I &amp;= \int\limits_a^b f(x) \,\mathrm{d}x \\
f(x) &amp;= x^2 \\
a &amp;= 0 \\
b &amp;= 1\end{split}\]</div>
<p>analytical solution</p>
<div class="math notranslate nohighlight">
\[I = \int\limits_{0}^{1} x^2 \,\mathrm{d}x
= \left. \frac{1}{3} x^3 \right\vert_0^1
= \frac{1}{3}\]</div>
<p>numerical solution</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="k">lambda</span><span class="p">(</span><span class="n">x</span><span class="p">):</span> <span class="n">x</span><span class="o">**</span><span class="mi">2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">trapez</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="go">0.5</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">trapez</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
<span class="go">0.3350000000000001</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">trapez</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="go">0.33335000000000004</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="module-numerical.ode">
<span id="numerical-ode-module"></span><h2>numerical.ode module<a class="headerlink" href="#module-numerical.ode" title="Permalink to this headline"></a></h2>
<p>Numerical solver of ordinary differential equations.</p>
<p>Solves the initial value problem for systems of first order
ordinary differential equations.</p>
<dl class="field-list simple">
<dt class="field-odd">Date</dt>
<dd class="field-odd"><p>2015-09-21</p>
</dd>
</dl>
<span class="target" id="module-ode"></span><dl class="function">
<dt id="numerical.ode.e1">
<code class="sig-name descname">e1</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">x0</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode.html#e1"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode.e1" title="Permalink to this definition"></a></dt>
<dd><p>Explicit first-order method /
(standard, or forward) Euler method /
Runge-Kutta 1st order method.</p>
<p>de:
Eulersche Polygonzugverfahren / explizite Euler-Verfahren /
Euler-Cauchy-Verfahren / Euler-vorwärts-Verfahren</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>f</strong> (<em>function</em>) the function to solve</p></li>
<li><p><strong>x0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> parameters of the function (thickness, diameter,
…)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) print information (default = False)</p></li>
</ul>
</dd>
</dl>
<p>Approximate the solution of the initial value problem</p>
<div class="math notranslate nohighlight">
\[\begin{split}\dot{x} &amp;= f(t,x) \\
x(t_0) &amp;= x_0\end{split}\]</div>
<p>Choose a value h for the size of every step and set</p>
<div class="math notranslate nohighlight">
\[t_i = t_0 + i h ~,\quad i=1,2,\ldots,n\]</div>
<p>The derivative of the solution is approximated as the forward
difference equation</p>
<div class="math notranslate nohighlight">
\[\dot{x}_i = f(t_i, x_i) = \frac{x_{i+1} - x_i}{t_{i+1}-t_i}\]</div>
<p>Therefore one step <span class="math notranslate nohighlight">\(h\)</span> of the Euler method from
<span class="math notranslate nohighlight">\(t_i\)</span> to <span class="math notranslate nohighlight">\(t_{i+1}\)</span> is</p>
<div class="math notranslate nohighlight">
\[\begin{split}x_{i+1} &amp;= x_i + (t_{i+1}-t_i) f(t_i, x_i) \\
x_{i+1} &amp;= x_i + h f(t_i, x_i) \\\end{split}\]</div>
<p>Example 1:</p>
<div class="math notranslate nohighlight">
\[\begin{split}m\ddot{u} + d\dot{u} + ku = f(t) \\
\ddot{u} = m^{-1}(f(t) - d\dot{u} - ku) \\\end{split}\]</div>
<p>with</p>
<div class="math notranslate nohighlight">
\[\begin{split}x_1 &amp;= u &amp;\quad \dot{x}_1 = \dot{u} = x_2 \\
x_2 &amp;= \dot{u} &amp;\quad \dot{x}_2 = \ddot{u} \\\end{split}\]</div>
<p>becomes</p>
<div class="math notranslate nohighlight">
\[\begin{split}\dot{x}_1 &amp;= x_2 \\
\dot{x}_2 &amp;= m^{-1}(f(t) - d x_2 - k x_1) \\\end{split}\]</div>
<p>or</p>
<div class="math notranslate nohighlight">
\[\begin{split}\dot{x} &amp;= f(t,x) \\
\begin{bmatrix} \dot{x}_1 \\ \dot{x}_2 \end{bmatrix} &amp;=
\begin{bmatrix} x_2 \\ m^{-1}(f(t) - d x_2 - k x_1)
\end{bmatrix} \\
&amp;=
\begin{bmatrix} 0 \\ m^{-1} f(t) \end{bmatrix} +
\begin{bmatrix} 0 &amp; 1 \\ -m^{-1} k &amp; -m^{-1} d \end{bmatrix}
\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}\end{split}\]</div>
<p>Example 2:</p>
<div class="math notranslate nohighlight">
\[\begin{split}m(u)\ddot{u} + d(u,\dot{u})\dot{u} + k(u)u = f(t) \\
\ddot{u} = m^{-1}(u)(f(t) - d(u,\dot{u})\dot{u} - k(u)u) \\\end{split}\]</div>
<p>with</p>
<div class="math notranslate nohighlight">
\[\begin{split}x_1 &amp;= u &amp;\quad \dot{x}_1 = \dot{u} = x_2 \\
x_2 &amp;= \dot{u} &amp;\quad \dot{x}_2 = \ddot{u} \\\end{split}\]</div>
<p>becomes</p>
<div class="math notranslate nohighlight">
\[\begin{split}\dot{x}_1 &amp;= x_2 \\
\dot{x}_2 &amp;=
m^{-1}(x_1)(f(t) - d(x_1,x_2) x_2 - k(x_1) x_1) \\\end{split}\]</div>
<p>or</p>
<div class="math notranslate nohighlight">
\[\begin{split}\dot{x} &amp;= f(t,x) \\
\begin{bmatrix} \dot{x}_1 \\ \dot{x}_2 \end{bmatrix} &amp;=
\begin{bmatrix}
x_2 \\ m^{-1}(x_1)(f(t) - d(x_1,x_2) x_2 - k(x_1) x_1)
\end{bmatrix} \\
&amp;=
\begin{bmatrix} 0 \\ m^{-1}(x_1) f(t) \end{bmatrix} +
\begin{bmatrix}
0 &amp; 1 \\ -m^{-1}(x_1) k(x_1) &amp; -m^{-1} d(x_1,x_2)
\end{bmatrix}
\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}\end{split}\]</div>
<p>The Euler method is a first-order method, which means that the
local error (error per step) is proportional to the square of
the step size, and the global error (error at a given time) is
proportional to the step size.</p>
</dd></dl>
<dl class="function">
<dt id="numerical.ode.e2">
<code class="sig-name descname">e2</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">x0</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode.html#e2"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode.e2" title="Permalink to this definition"></a></dt>
<dd><p>Explicit second-order method / Runge-Kutta 2nd order method.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>f</strong> (<em>function</em>) the function to solve</p></li>
<li><p><strong>x0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> parameters of the function (thickness, diameter,
…)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) print information (default = False)</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="numerical.ode.e4">
<code class="sig-name descname">e4</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">x0</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode.html#e4"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode.e4" title="Permalink to this definition"></a></dt>
<dd><p>Explicit fourth-order method / Runge-Kutta 4th order method.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>f</strong> (<em>function</em>) the function to solve</p></li>
<li><p><strong>x0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> parameters of the function (thickness, diameter,
…)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) print information (default = False)</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="numerical.ode.fpi">
<code class="sig-name descname">fpi</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">xi</em>, <em class="sig-param">ti</em>, <em class="sig-param">ti1</em>, <em class="sig-param">*p</em>, <em class="sig-param">max_iterations=1000</em>, <em class="sig-param">tol=1e-09</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode.html#fpi"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode.fpi" title="Permalink to this definition"></a></dt>
<dd><p>Fixed-point iteration.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>f</strong> (<em>function</em>) the function to iterate <span class="math notranslate nohighlight">\(f = \dot{x}(x,t)\)</span></p></li>
<li><p><strong>xi</strong> (<em>list</em>) initial condition <span class="math notranslate nohighlight">\(x_i\)</span></p></li>
<li><p><strong>ti</strong> (<em>float</em>) time <span class="math notranslate nohighlight">\(t_i\)</span></p></li>
<li><p><strong>ti1</strong> (<em>float</em>) time <span class="math notranslate nohighlight">\(t_{i+1}\)</span></p></li>
<li><p><strong>*p</strong> parameters of the function (thickness, diameter,
…)</p></li>
<li><p><strong>max_iterations</strong> (<em>int</em>) maximum number of iterations</p></li>
<li><p><strong>tol</strong> (<em>float</em>) tolerance against residuum <span class="math notranslate nohighlight">\(\varepsilon\)</span>
(default = 1e-9)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) print information (default = False)</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><span class="math notranslate nohighlight">\(x_{i}\)</span></p>
</dd>
</dl>
<div class="math notranslate nohighlight">
\[x_{i,j=0} = x_{i}\]</div>
<div class="math notranslate nohighlight">
\[x_{i,j+1} = x_i + \dot{x}(x_{i,j}, t_{i+1})\cdot(t_{i+1}-t_i)\]</div>
<div class="math notranslate nohighlight">
\[\text{residuum} = \frac{\lVert x_{i,j+1}-x_{i,j}\rVert}
{\lVert x_{i,j+1} \rVert} &lt; \varepsilon\]</div>
<div class="math notranslate nohighlight">
\[x_{i} = x_{i,j=\text{end}}\]</div>
</dd></dl>
<dl class="function">
<dt id="numerical.ode.i1">
<code class="sig-name descname">i1</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">x0</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em>, <em class="sig-param">max_iterations=1000</em>, <em class="sig-param">tol=1e-09</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode.html#i1"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode.i1" title="Permalink to this definition"></a></dt>
<dd><p>Implicite first-order method / backward Euler method.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>f</strong> (<em>function</em>) the function to solve</p></li>
<li><p><strong>x0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> parameters of the function (thickness, diameter,
…)</p></li>
<li><p><strong>max_iterations</strong> (<em>int</em>) maximum number of iterations</p></li>
<li><p><strong>tol</strong> (<em>float</em>) tolerance against residuum (default = 1e-9)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) print information (default = False)</p></li>
</ul>
</dd>
</dl>
<p>The backward Euler method has order one and is A-stable.</p>
</dd></dl>
<dl class="function">
<dt id="numerical.ode.newmark_newtonraphson">
<code class="sig-name descname">newmark_newtonraphson</code><span class="sig-paren">(</span><em class="sig-param">f</em>, <em class="sig-param">x0</em>, <em class="sig-param">xp0</em>, <em class="sig-param">xpp0</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em>, <em class="sig-param">gamma=0.5</em>, <em class="sig-param">beta=0.25</em>, <em class="sig-param">max_iterations=1000</em>, <em class="sig-param">tol=1e-09</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode.html#newmark_newtonraphson"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode.newmark_newtonraphson" title="Permalink to this definition"></a></dt>
<dd><p>Newmark method.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>f</strong> (<em>function</em>) the function to solve</p></li>
<li><p><strong>x0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>xp0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>xpp0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> parameters of the function (thickness, diameter,
…)</p></li>
<li><p><strong>gamma</strong> (<em>float</em>) newmark parameter for velocity (default = 0.5)</p></li>
<li><p><strong>beta</strong> (<em>float</em>) newmark parameter for displacement (default = 0.25)</p></li>
<li><p><strong>max_iterations</strong> (<em>int</em>) maximum number of iterations</p></li>
<li><p><strong>tol</strong> (<em>float</em>) tolerance against residuum (default = 1e-9)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) print information (default = False)</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="numerical.ode.newmark_newtonraphson_rdk">
<code class="sig-name descname">newmark_newtonraphson_rdk</code><span class="sig-paren">(</span><em class="sig-param">fnm</em>, <em class="sig-param">x0</em>, <em class="sig-param">xp0</em>, <em class="sig-param">xpp0</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em>, <em class="sig-param">gamma=0.5</em>, <em class="sig-param">beta=0.25</em>, <em class="sig-param">max_iterations=1000</em>, <em class="sig-param">tol=1e-09</em>, <em class="sig-param">verbose=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode.html#newmark_newtonraphson_rdk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode.newmark_newtonraphson_rdk" title="Permalink to this definition"></a></dt>
<dd><p>Newmark method.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>f</strong> (<em>function</em>) the function to solve</p></li>
<li><p><strong>x0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>xp0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>xpp0</strong> (<em>list</em>) initial condition</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> parameters of the function (thickness, diameter,
…)</p></li>
<li><p><strong>gamma</strong> (<em>float</em>) newmark parameter for velocity (default = 0.5)</p></li>
<li><p><strong>beta</strong> (<em>float</em>) newmark parameter for displacement (default = 0.25)</p></li>
<li><p><strong>max_iterations</strong> (<em>int</em>) maximum number of iterations</p></li>
<li><p><strong>tol</strong> (<em>float</em>) tolerance against residuum (default = 1e-9)</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) print information (default = False)</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-numerical.ode_model">
<span id="numerical-ode-model-module"></span><h2>numerical.ode_model module<a class="headerlink" href="#module-numerical.ode_model" title="Permalink to this headline"></a></h2>
<p>Mathmatical models governed by ordinary differential equations.</p>
<p>Describes initial value problems as systems of first order ordinary differential
equations.</p>
<dl class="field-list simple">
<dt class="field-odd">Date</dt>
<dd class="field-odd"><p>2019-05-25</p>
</dd>
</dl>
<span class="target" id="module-ode_model"></span><dl class="function">
<dt id="numerical.ode_model.disk">
<code class="sig-name descname">disk</code><span class="sig-paren">(</span><em class="sig-param">x</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode_model.html#disk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode_model.disk" title="Permalink to this definition"></a></dt>
<dd><p>Rotation of an eccentric disk.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>x</strong> (<em>list</em>) values of the function</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> <p>parameters of the function</p>
<ul>
<li><p>diameter</p></li>
<li><p>eccentricity</p></li>
<li><p>torque</p></li>
</ul>
</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="numerical.ode_model.disk_nm">
<code class="sig-name descname">disk_nm</code><span class="sig-paren">(</span><em class="sig-param">xn</em>, <em class="sig-param">xpn</em>, <em class="sig-param">xppn</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode_model.html#disk_nm"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode_model.disk_nm" title="Permalink to this definition"></a></dt>
<dd><p>Rotation of an eccentric disk.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>xn</strong> (<em>list</em>) values of the function</p></li>
<li><p><strong>xpn</strong> (<em>list</em>) first derivative values of the function</p></li>
<li><p><strong>xppn</strong> (<em>list</em>) second derivative values of the function</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> <p>parameters of the function</p>
<ul>
<li><p>diameter</p></li>
<li><p>eccentricity</p></li>
<li><p>torque</p></li>
</ul>
</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="numerical.ode_model.disk_nmmdk">
<code class="sig-name descname">disk_nmmdk</code><span class="sig-paren">(</span><em class="sig-param">xn</em>, <em class="sig-param">xpn</em>, <em class="sig-param">xppn</em>, <em class="sig-param">t</em>, <em class="sig-param">*p</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/numerical/ode_model.html#disk_nmmdk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#numerical.ode_model.disk_nmmdk" title="Permalink to this definition"></a></dt>
<dd><p>Rotation of an eccentric disk.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>xn</strong> (<em>list</em>) values of the function</p></li>
<li><p><strong>xpn</strong> (<em>list</em>) derivative values of the function</p></li>
<li><p><strong>xppn</strong> (<em>list</em>) second derivative values of the function</p></li>
<li><p><strong>t</strong> (<em>list</em>) time</p></li>
<li><p><strong>*p</strong> <p>parameters of the function</p>
<ul>
<li><p>diameter</p></li>
<li><p>eccentricity</p></li>
<li><p>torque</p></li>
</ul>
</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</div>
<div class="section" id="module-numerical">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-numerical" title="Permalink to this headline"></a></h2>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">pylib</a></h1>
<h3>Navigation</h3>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2019, Daniel Weschke.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.2.0</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/numerical.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>