change data, mathematics, function, geometry and geometry_plot_pylab. add data_step, data_step_std and helper. add an example and more documentation.

inside the data module rename read to read_columns add add new read function to read the whole file as string. add print_list function to print one element per line. add unique_list and unique_list_hashable to reduce the list into a unique list with same order. add find_last, str_between, str_to_list functions.

inside the mathematics module for vector add normalized creating a new object (normalize will change the object), isclose and iscloseto, change ang to round internal number. for matrix improve slicing and add transposed creating a new object (transpose will change object).

inside the function module add b_spline_basis, b_spline_curve_with_knots and b_spline_knots functions. add sample_hal_open and sample_half_open_seq. add circle and ellipse.

inside the geometry module change CS init from using lists to Directions and add new constructor CS.init_xzy using lists. rename Wireframe to Polyline. add classes B_spline_curve_with_knots, Ellipse, ArcCircle, ArcEllipse, ArcBSplineCurveWithKnots. add function sample_half_open to create a list of Points.

inside the geometry_plot_pylab module change the help text.

add step_and data data_step_std module to read a step file to list and draw the content.

add helper module with context manager and decorator timeit to meassure the time for a section or function.

add example for b_spline function.
This commit is contained in:
2020-01-08 21:59:53 +01:00
parent 4b42d7b508
commit 4fc4903dc2
56 changed files with 8756 additions and 947 deletions

View File

@@ -44,7 +44,12 @@ ordinary differential equations.</p>
<dd class="field-odd"><p>2015-09-21</p>
</dd>
</dl>
<span class="target" id="module-ode"></span><dl class="function">
<span class="target" id="module-ode"></span><p>Approximate the solution <span class="math notranslate nohighlight">\(x(t)\)</span> of the initial value problem</p>
<div class="math notranslate nohighlight">
\[\begin{split}\frac{\mathrm{d}x}{\mathrm{d}t} = \dot{x} &amp;= f(t,x) \\
x(t_0) &amp;= x_0 \\
t &amp;\in [t_0, t_n]\end{split}\]</div>
<dl class="function">
<dt id="pylib.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/pylib/numerical/ode.html#e1"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.numerical.ode.e1" title="Permalink to this definition"></a></dt>
<dd><p>Explicit first-order method /
@@ -65,13 +70,14 @@ Euler-Cauchy-Verfahren / Euler-vorwärts-Verfahren</p>
</ul>
</dd>
</dl>
<p>Approximate the solution of the initial value problem</p>
<p>Approximate the solution <span class="math notranslate nohighlight">\(x(t)\)</span> 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>
x(t_0) &amp;= x_0 \\
t &amp;\in [t_0, t_n]\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>
\[t_{i+1} = t_0 + i h = t_i + h ~,\quad i=0,1,2,\ldots,n-1\]</div>
<p>The derivative of the solution is approximated as the forward
difference equation</p>
<div class="math notranslate nohighlight">
@@ -169,6 +175,30 @@ proportional to the step size.</p>
</ul>
</dd>
</dl>
<p>Problem</p>
<blockquote>
<div><div class="math notranslate nohighlight">
\[\begin{split}\dot{y} &amp;= f(t, y) \\
y(t_0) &amp;= y_0 \\
t &amp;\in [t_0, t_n]\end{split}\]</div>
</div></blockquote>
<p>Increment <span class="math notranslate nohighlight">\(\delta t = t_{i+1}-t_i ~,~~ i=0,1,2,\ldots,n-1\)</span></p>
<blockquote>
<div><div class="math notranslate nohighlight">
\[\begin{split}y_{n+1} &amp;= y_{i} + \tfrac{1}{6}(
\delta y_{i,1} + 2\delta y_{i,2} + 2\delta y_{i,3} +
\delta y_{i,4}) \\
&amp; \qquad \text{with} \\
\delta y_{i,1} &amp;= \delta t \cdot y'(t_{i}, ~ y_{i}) \\
\delta y_{i,2} &amp;= \delta t \cdot
y'(t_{i}+\tfrac{1}{2}\delta t, ~
y_{i}+\tfrac{1}{2}\delta y_{i,1}) \\
\delta y_{i,3} &amp;= \delta t \cdot
y'(t_{i}+\tfrac{1}{2}\delta t, ~
y_{i}+\tfrac{1}{2}\delta y_{i,2}) \\
\delta y_{i,4} &amp;= \delta t \cdot
y'(t_{i}+\delta t, ~ y_{i}+\delta y_{i,3})\end{split}\]</div>
</div></blockquote>
</dd></dl>
<dl class="function">
@@ -251,9 +281,10 @@ proportional to the step size.</p>
</dd></dl>
<dl class="function">
<dt id="pylib.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/pylib/numerical/ode.html#newmark_newtonraphson_rdk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.numerical.ode.newmark_newtonraphson_rdk" title="Permalink to this definition"></a></dt>
<dt id="pylib.numerical.ode.newmark_newtonraphson_mdk">
<code class="sig-name descname">newmark_newtonraphson_mdk</code><span class="sig-paren">(</span><em class="sig-param">fmdk</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/pylib/numerical/ode.html#newmark_newtonraphson_mdk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylib.numerical.ode.newmark_newtonraphson_mdk" title="Permalink to this definition"></a></dt>
<dd><p>Newmark method.</p>
<p>Using m mass, d damping and k stiffness formulation.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">