mirror of
https://github.com/boostorg/odeint.git
synced 2025-05-09 23:24:01 +00:00
documentation
This commit is contained in:
parent
97a0d8264b
commit
445c384599
@ -21,7 +21,30 @@
|
||||
functions</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
tba.
|
||||
In the tutorial we have learned how we can use the generation functions
|
||||
<code class="computeroutput"><span class="identifier">make_controlled</span></code> and <code class="computeroutput"><span class="identifier">make_dense_output</span></code> to create controlled
|
||||
and dense output stepper from a simple stepper or an error stepper. The syntax
|
||||
of these two functions is very simple:
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">stepper1</span> <span class="special">=</span> <span class="identifier">make_controlled</span><span class="special">(</span> <span class="number">1.0e-6</span> <span class="special">,</span> <span class="number">1.0e-6</span> <span class="special">,</span> <span class="identifier">stepper_type</span><span class="special">()</span> <span class="special">);</span>
|
||||
<span class="keyword">auto</span> <span class="identifier">stepper2</span> <span class="special">=</span> <span class="identifier">make_dense_output</span><span class="special">(</span> <span class="number">1.0e-6</span> <span class="special">,</span> <span class="number">1.0e-6</span> <span class="special">,</span> <span class="identifier">stepper_type</span><span class="special">()</span> <span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
The first two parameters are the absolute and the relative error tolerances
|
||||
and the third parameter is the stepper. Of course you can also infer the
|
||||
type from the classical <code class="computeroutput"><span class="identifier">result_of</span></code>
|
||||
mechanism:
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">make_controlled</span><span class="special"><</span> <span class="identifier">stepper_type</span> <span class="special">>::</span><span class="identifier">type</span> <span class="identifier">stepper3</span> <span class="special">=</span> <span class="identifier">make_controlled</span><span class="special">(</span> <span class="number">1.0e-6</span> <span class="special">,</span> <span class="number">1.0e-6</span> <span class="special">,</span> <span class="identifier">stepper_type</span><span class="special">()</span> <span class="special">);</span>
|
||||
<span class="identifier">result_of</span><span class="special">::</span><span class="identifier">make_dense_output</span><span class="special"><</span> <span class="identifier">stepper_type</span> <span class="special">>::</span><span class="identifier">type</span> <span class="identifier">stepper4</span> <span class="special">=</span> <span class="identifier">make_dense_output</span><span class="special">(</span> <span class="number">1.0e-6</span> <span class="special">,</span> <span class="number">1.0e-6</span> <span class="special">,</span> <span class="identifier">stepper_type</span><span class="special">()</span> <span class="special">);</span>
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
explain the mechanis and how your own steppers can be used with the generation
|
||||
|
@ -32,17 +32,25 @@
|
||||
One use case for <a href="http://www.boost.org/doc/libs/release/libs/range/index.html" target="_top">Boost.Range</a>
|
||||
in odeint has been shown in <a class="link" href="../tutorial/chaotic_systems_and_lyapunov_exponents.html" title="Chaotic systems and Lyapunov exponents">Chaotic
|
||||
system</a> where the state consists of two parts: one for the original
|
||||
state and one for the perturbations. The ranges are used to initialize (solve)
|
||||
only the system part where the perturbation part is not touched. After that
|
||||
the complete state including also the perturbations is solved. Another use
|
||||
case is a system consisting of coupled units where you want to initialize
|
||||
each unit separately with the ODE of the uncoupled unit. An example is a
|
||||
chain of coupled van-der-Pol-oscillators which are initialized uniformily
|
||||
system and one for the perturbations. The ranges are used to initialize (solve)
|
||||
only the system part where the perturbation part is not touched, that is
|
||||
a range consisting only of the system part is used. After that the complete
|
||||
state including the perturbations is solved.
|
||||
</p>
|
||||
<p>
|
||||
Another use case is a system consisting of coupled units where you want to
|
||||
initialize each unit separately with the ODE of the uncoupled unit. An example
|
||||
is a chain of coupled van-der-Pol-oscillators which are initialized uniformily
|
||||
from the uncoupled van-der-Pol-oscillator. Then you can use <a href="http://www.boost.org/doc/libs/release/libs/range/index.html" target="_top">Boost.Range</a>
|
||||
to solve only one individual oscillator in the chain.
|
||||
</p>
|
||||
<p>
|
||||
An example was given in <a class="link" href="../tutorial/chaotic_systems_and_lyapunov_exponents.html" title="Chaotic systems and Lyapunov exponents">Chaotic
|
||||
In short, you can <a href="http://www.boost.org/doc/libs/release/libs/range/index.html" target="_top">Boost.Range</a>
|
||||
to use one state within two system functions which expect states with different
|
||||
sizes.
|
||||
</p>
|
||||
<p>
|
||||
An example was given in the <a class="link" href="../tutorial/chaotic_systems_and_lyapunov_exponents.html" title="Chaotic systems and Lyapunov exponents">Chaotic
|
||||
system</a> tutorial. Using Boost.Range usually means that your system
|
||||
function needs to adapt to the iterators of Boost.Range. That is, your function
|
||||
is called with a range and you need to get the iterators from that range.
|
||||
|
@ -125,7 +125,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: April 03, 2012 at 11:27:53 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: April 04, 2012 at 06:30:00 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
@ -2,11 +2,13 @@
|
||||
|
||||
Most steppers in odeint also accept the state give as a range. A range is sequence of values modelled by a range concept. See __boost_range for an overview over existing concepts and examples of ranges. This means that the `state_type` of the stepper must not necessarily used to call the `do_step` method.
|
||||
|
||||
One use case for __boost_range in odeint has been shown in __tut_chaotic_system where the state consists of two parts: one for the original state and one for the perturbations. The ranges are used to initialize (solve) only the system part where the perturbation part is not touched, that is a range consisting only of the system part is used. After that the complete state including also the perturbations is solved.
|
||||
One use case for __boost_range in odeint has been shown in __tut_chaotic_system where the state consists of two parts: one for the original system and one for the perturbations. The ranges are used to initialize (solve) only the system part where the perturbation part is not touched, that is a range consisting only of the system part is used. After that the complete state including the perturbations is solved.
|
||||
|
||||
Another use case is a system consisting of coupled units where you want to initialize each unit separately with the ODE of the uncoupled unit. An example is a chain of coupled van-der-Pol-oscillators which are initialized uniformily from the uncoupled van-der-Pol-oscillator. Then you can use __boost_range to solve only one individual oscillator in the chain.
|
||||
|
||||
An example was given in __tut_chaotic_system tutorial. Using Boost.Range usually means that your system function needs to adapt to the iterators of Boost.Range. That is, your function is called with a range and you need to get the iterators from that range. This can easily be done. You have to implement your system as a class or a struct and you have to templatize the `operator()`. Then you can use the `range_iterator`-meta function and `boost::begin` and `boost::end` to obtain the iterators of your range:
|
||||
In short, you can __boost_range to use one state within two system functions which expect states with different sizes.
|
||||
|
||||
An example was given in the __tut_chaotic_system tutorial. Using Boost.Range usually means that your system function needs to adapt to the iterators of Boost.Range. That is, your function is called with a range and you need to get the iterators from that range. This can easily be done. You have to implement your system as a class or a struct and you have to templatize the `operator()`. Then you can use the `range_iterator`-meta function and `boost::begin` and `boost::end` to obtain the iterators of your range:
|
||||
|
||||
``
|
||||
class sys
|
||||
|
@ -1,6 +1,14 @@
|
||||
[section Generation functions]
|
||||
|
||||
tba.
|
||||
[import ../examples/generation_functions.cpp]
|
||||
|
||||
In the tutorial we have learned how we can use the generation functions `make_controlled` and `make_dense_output` to create controlled and dense output stepper from a simple stepper or an error stepper. The syntax of these two functions is very simple:
|
||||
|
||||
[generation_functions_syntax_auto]
|
||||
|
||||
The first two parameters are the absolute and the relative error tolerances and the third parameter is the stepper. In C++03 you can infer the type from the classical `result_of` mechanism:
|
||||
|
||||
[generation_functions_syntax_result_of]
|
||||
|
||||
explain the mechanis and how your own steppers can be used with the generation functions
|
||||
|
||||
|
@ -31,6 +31,7 @@ exe lorenz_point : lorenz_point.cpp ;
|
||||
exe bs_bug : bs_bug.cpp ;
|
||||
exe van_der_pol_stiff : van_der_pol_stiff.cpp ;
|
||||
exe stochastic_euler : stochastic_euler.cpp : : <cxxflags>-std=c++0x ;
|
||||
exe generation_functions : generation_functions.cpp : : <cxxflags>-std=c++0x ;
|
||||
|
||||
# build-project mtl ;
|
||||
# build-project ublas ;
|
||||
|
@ -1,3 +1,17 @@
|
||||
/*
|
||||
libs/numeric/odeint/examples/stochastic_euler.hpp
|
||||
|
||||
Copyright 2009 Karsten Ahnert
|
||||
Copyright 2009 Mario Mulansky
|
||||
|
||||
Stochastic euler stepper example and Ornstein-Uhlenbeck process
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or
|
||||
copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
|
Loading…
x
Reference in New Issue
Block a user