integrate_functions.html 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Integrate functions</title>
  5. <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../../index.html" title="Chapter&#160;1.&#160;Boost.Numeric.Odeint">
  8. <link rel="up" href="../odeint_in_detail.html" title="odeint in detail">
  9. <link rel="prev" href="generation_functions.html" title="Generation functions">
  10. <link rel="next" href="iterators_and_ranges.html" title="Iterators and Ranges">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../logo.jpg"></td>
  15. <td align="center"><a href="../../../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="generation_functions.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../odeint_in_detail.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="iterators_and_ranges.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h3 class="title">
  27. <a name="boost_numeric_odeint.odeint_in_detail.integrate_functions"></a><a class="link" href="integrate_functions.html" title="Integrate functions">Integrate
  28. functions</a>
  29. </h3></div></div></div>
  30. <p>
  31. Integrate functions perform the time evolution of a given ODE from some starting
  32. time <span class="emphasis"><em>t<sub>0</sub></em></span> to a given end time <span class="emphasis"><em>t<sub>1</sub></em></span>
  33. and starting at state <span class="emphasis"><em>x<sub>0</sub></em></span> by subsequent calls of a given
  34. stepper's <code class="computeroutput"><span class="identifier">do_step</span></code> function.
  35. Additionally, the user can provide an __observer to analyze the state during
  36. time evolution, and a <code class="computeroutput"><a class="link" href="../../boost/numeric/odeint/max_step_checker.html" title="Class max_step_checker">max_step_checker</a></code> to throw an
  37. exception if too many steps are taken between observer calls (i.e. too small
  38. step size). There are five different integrate functions which have different
  39. strategies on when to call the observer function during integration. All
  40. of the integrate functions except <code class="computeroutput"><span class="identifier">integrate_n_steps</span></code>
  41. can be called with any stepper following one of the stepper concepts: <a class="link" href="../concepts/stepper.html" title="Stepper">Stepper</a> , <a class="link" href="../concepts/error_stepper.html" title="Error Stepper">Error
  42. Stepper</a> , <a class="link" href="../concepts/controlled_stepper.html" title="Controlled Stepper">Controlled
  43. Stepper</a> , <a class="link" href="../concepts/dense_output_stepper.html" title="Dense Output Stepper">Dense
  44. Output Stepper</a>. Depending on the abilities of the stepper, the integrate
  45. functions make use of step-size control or dense output.
  46. </p>
  47. <h5>
  48. <a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.h0"></a>
  49. <span class="phrase"><a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.equidistant_observer_calls"></a></span><a class="link" href="integrate_functions.html#boost_numeric_odeint.odeint_in_detail.integrate_functions.equidistant_observer_calls">Equidistant
  50. observer calls</a>
  51. </h5>
  52. <p>
  53. If observer calls at equidistant time intervals <span class="emphasis"><em>dt</em></span> are
  54. needed, the <code class="computeroutput"><span class="identifier">integrate_const</span></code>
  55. or <code class="computeroutput"><span class="identifier">integrate_n_steps</span></code> function
  56. should be used. We start with explaining <code class="computeroutput"><span class="identifier">integrate_const</span></code>:
  57. </p>
  58. <p>
  59. <code class="computeroutput"><span class="identifier">integrate_const</span><span class="special">(</span>
  60. <span class="identifier">stepper</span> <span class="special">,</span>
  61. <span class="identifier">system</span> <span class="special">,</span>
  62. <span class="identifier">x0</span> <span class="special">,</span>
  63. <span class="identifier">t0</span> <span class="special">,</span>
  64. <span class="identifier">t1</span> <span class="special">,</span>
  65. <span class="identifier">dt</span> <span class="special">)</span></code>
  66. </p>
  67. <p>
  68. <code class="computeroutput"><span class="identifier">integrate_const</span><span class="special">(</span>
  69. <span class="identifier">stepper</span> <span class="special">,</span>
  70. <span class="identifier">system</span> <span class="special">,</span>
  71. <span class="identifier">x0</span> <span class="special">,</span>
  72. <span class="identifier">t0</span> <span class="special">,</span>
  73. <span class="identifier">t1</span> <span class="special">,</span>
  74. <span class="identifier">dt</span> <span class="special">,</span>
  75. <span class="identifier">observer</span> <span class="special">)</span></code>
  76. </p>
  77. <p>
  78. <code class="computeroutput"><span class="identifier">integrate_const</span><span class="special">(</span>
  79. <span class="identifier">stepper</span> <span class="special">,</span>
  80. <span class="identifier">system</span> <span class="special">,</span>
  81. <span class="identifier">x0</span> <span class="special">,</span>
  82. <span class="identifier">t0</span> <span class="special">,</span>
  83. <span class="identifier">t1</span> <span class="special">,</span>
  84. <span class="identifier">dt</span> <span class="special">,</span>
  85. <span class="identifier">observer</span> <span class="special">,</span>
  86. <span class="identifier">max_step_checker</span> <span class="special">)</span></code>
  87. </p>
  88. <p>
  89. These integrate the ODE given by <code class="computeroutput"><span class="identifier">system</span></code>
  90. with subsequent steps from <code class="computeroutput"><span class="identifier">stepper</span></code>.
  91. Integration start at <code class="computeroutput"><span class="identifier">t0</span></code> and
  92. <code class="computeroutput"><span class="identifier">x0</span></code> and ends at some <span class="emphasis"><em>t'
  93. = t<sub>0</sub> + n dt</em></span> with <span class="emphasis"><em>n</em></span> such that <span class="emphasis"><em>t<sub>1</sub> -
  94. dt &lt; t' &lt;= t<sub>1</sub></em></span>. <code class="computeroutput"><span class="identifier">x0</span></code>
  95. is changed to the approximative solution <span class="emphasis"><em>x(t')</em></span> at the
  96. end of integration. If provided, the <code class="computeroutput"><span class="identifier">observer</span></code>
  97. is invoked at times <span class="emphasis"><em>t<sub>0</sub></em></span>, <span class="emphasis"><em>t<sub>0</sub> + dt</em></span>,
  98. <span class="emphasis"><em>t<sub>0</sub> + 2dt</em></span>, ... ,<span class="emphasis"><em>t'</em></span>. If provided,
  99. the <code class="computeroutput"><span class="identifier">max_step_checker</span></code> counts
  100. the number of steps between observer calls and throws a <code class="computeroutput"><span class="identifier">no_progress_error</span></code>
  101. this exceeds some limit (default: 500). <code class="computeroutput"><span class="identifier">integrate_const</span></code>
  102. returns the number of steps performed during the integration. Note that if
  103. you are using a simple <a class="link" href="../concepts/stepper.html" title="Stepper">Stepper</a>
  104. or <a class="link" href="../concepts/error_stepper.html" title="Error Stepper">Error Stepper</a>
  105. and want to make exactly <code class="computeroutput"><span class="identifier">n</span></code>
  106. steps you should prefer the <code class="computeroutput"><span class="identifier">integrate_n_steps</span></code>
  107. function below.
  108. </p>
  109. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  110. <li class="listitem">
  111. If <code class="computeroutput"><span class="identifier">stepper</span></code> is a <a class="link" href="../concepts/stepper.html" title="Stepper">Stepper</a> or <a class="link" href="../concepts/error_stepper.html" title="Error Stepper">Error Stepper</a>
  112. then <code class="computeroutput"><span class="identifier">dt</span></code> is also the step
  113. size used for integration and the observer is called just after every
  114. step.
  115. </li>
  116. <li class="listitem">
  117. If <code class="computeroutput"><span class="identifier">stepper</span></code> is a <a class="link" href="../concepts/controlled_stepper.html" title="Controlled Stepper">Controlled
  118. Stepper</a> then <code class="computeroutput"><span class="identifier">dt</span></code>
  119. is the initial step size. The actual step size will change due to error
  120. control during time evolution. However, if an observer is provided the
  121. step size will be adjusted such that the algorithm always calculates
  122. <span class="emphasis"><em>x(t)</em></span> at <span class="emphasis"><em>t = t<sub>0</sub> + n dt</em></span> and calls
  123. the observer at that point. Note that the use of <a class="link" href="../concepts/controlled_stepper.html" title="Controlled Stepper">Controlled
  124. Stepper</a> is reasonable here only if <code class="computeroutput"><span class="identifier">dt</span></code>
  125. is considerably larger than typical step sizes used by the stepper.
  126. </li>
  127. <li class="listitem">
  128. If <code class="computeroutput"><span class="identifier">stepper</span></code> is a <a class="link" href="../concepts/dense_output_stepper.html" title="Dense Output Stepper">Dense Output
  129. Stepper</a> then <code class="computeroutput"><span class="identifier">dt</span></code>
  130. is the initial step size. The actual step size will be adjusted during
  131. integration due to error control. If an observer is provided dense output
  132. is used to calculate <span class="emphasis"><em>x(t)</em></span> at <span class="emphasis"><em>t = t<sub>0</sub> + n
  133. dt</em></span>.
  134. </li>
  135. </ul></div>
  136. <h5>
  137. <a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.h1"></a>
  138. <span class="phrase"><a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.integrate_a_given_number_of_steps"></a></span><a class="link" href="integrate_functions.html#boost_numeric_odeint.odeint_in_detail.integrate_functions.integrate_a_given_number_of_steps">Integrate
  139. a given number of steps</a>
  140. </h5>
  141. <p>
  142. This function is very similar to <code class="computeroutput"><span class="identifier">integrate_const</span></code>
  143. above. The only difference is that it does not take the end time as parameter,
  144. but rather the number of steps. The integration is then performed until the
  145. time <code class="computeroutput"><span class="identifier">t0</span><span class="special">+</span><span class="identifier">n</span><span class="special">*</span><span class="identifier">dt</span></code>.
  146. </p>
  147. <p>
  148. <code class="computeroutput"><span class="identifier">integrate_n_steps</span><span class="special">(</span>
  149. <span class="identifier">stepper</span> <span class="special">,</span>
  150. <span class="identifier">system</span> <span class="special">,</span>
  151. <span class="identifier">x0</span> <span class="special">,</span>
  152. <span class="identifier">t0</span> <span class="special">,</span>
  153. <span class="identifier">dt</span> <span class="special">,</span>
  154. <span class="identifier">n</span> <span class="special">)</span></code>
  155. </p>
  156. <p>
  157. <code class="computeroutput"><span class="identifier">integrate_n_steps</span><span class="special">(</span>
  158. <span class="identifier">stepper</span> <span class="special">,</span>
  159. <span class="identifier">system</span> <span class="special">,</span>
  160. <span class="identifier">x0</span> <span class="special">,</span>
  161. <span class="identifier">t0</span> <span class="special">,</span>
  162. <span class="identifier">dt</span> <span class="special">,</span>
  163. <span class="identifier">n</span> <span class="special">,</span> <span class="identifier">observer</span> <span class="special">)</span></code>
  164. </p>
  165. <p>
  166. <code class="computeroutput"><span class="identifier">integrate_n_steps</span><span class="special">(</span>
  167. <span class="identifier">stepper</span> <span class="special">,</span>
  168. <span class="identifier">system</span> <span class="special">,</span>
  169. <span class="identifier">x0</span> <span class="special">,</span>
  170. <span class="identifier">t0</span> <span class="special">,</span>
  171. <span class="identifier">dt</span> <span class="special">,</span>
  172. <span class="identifier">n</span> <span class="special">,</span> <span class="identifier">observer</span> <span class="special">,</span> <span class="identifier">max_step_checker</span> <span class="special">)</span></code>
  173. </p>
  174. <p>
  175. Integrates the ODE given by <code class="computeroutput"><span class="identifier">system</span></code>
  176. with subsequent steps from <code class="computeroutput"><span class="identifier">stepper</span></code>
  177. starting at <span class="emphasis"><em>x<sub>0</sub></em></span> and <span class="emphasis"><em>t<sub>0</sub></em></span>. If provided,
  178. <code class="computeroutput"><span class="identifier">observer</span></code> is called after
  179. every step and at the beginning with <code class="computeroutput"><span class="identifier">t0</span></code>,
  180. similar as above. Again, providing a <code class="computeroutput"><span class="identifier">max_step_checker</span></code>
  181. will throw a <code class="computeroutput"><span class="identifier">no_progress_error</span></code>
  182. if too many steps are performed between observer calls. The approximate result
  183. for <span class="emphasis"><em>x( t<sub>0</sub> + n dt )</em></span> is stored in <code class="computeroutput"><span class="identifier">x0</span></code>.
  184. This function returns the end time <code class="computeroutput"><span class="identifier">t0</span>
  185. <span class="special">+</span> <span class="identifier">n</span><span class="special">*</span><span class="identifier">dt</span></code>.
  186. </p>
  187. <h5>
  188. <a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.h2"></a>
  189. <span class="phrase"><a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.observer_calls_at_each_step"></a></span><a class="link" href="integrate_functions.html#boost_numeric_odeint.odeint_in_detail.integrate_functions.observer_calls_at_each_step">Observer
  190. calls at each step</a>
  191. </h5>
  192. <p>
  193. If the observer should be called at each time step then the <code class="computeroutput"><span class="identifier">integrate_adaptive</span></code> function should be used.
  194. Note that in the case of <a class="link" href="../concepts/controlled_stepper.html" title="Controlled Stepper">Controlled
  195. Stepper</a> or <a class="link" href="../concepts/dense_output_stepper.html" title="Dense Output Stepper">Dense
  196. Output Stepper</a> this leads to non-equidistant observer calls as the
  197. step size changes.
  198. </p>
  199. <p>
  200. <code class="computeroutput"><span class="identifier">integrate_adaptive</span><span class="special">(</span>
  201. <span class="identifier">stepper</span> <span class="special">,</span>
  202. <span class="identifier">system</span> <span class="special">,</span>
  203. <span class="identifier">x0</span> <span class="special">,</span>
  204. <span class="identifier">t0</span> <span class="special">,</span>
  205. <span class="identifier">t1</span> <span class="special">,</span>
  206. <span class="identifier">dt</span> <span class="special">)</span></code>
  207. </p>
  208. <p>
  209. <code class="computeroutput"><span class="identifier">integrate_adaptive</span><span class="special">(</span>
  210. <span class="identifier">stepper</span> <span class="special">,</span>
  211. <span class="identifier">system</span> <span class="special">,</span>
  212. <span class="identifier">x0</span> <span class="special">,</span>
  213. <span class="identifier">t0</span> <span class="special">,</span>
  214. <span class="identifier">t1</span> <span class="special">,</span>
  215. <span class="identifier">dt</span> <span class="special">,</span>
  216. <span class="identifier">observer</span> <span class="special">)</span></code>
  217. </p>
  218. <p>
  219. Integrates the ODE given by <code class="computeroutput"><span class="identifier">system</span></code>
  220. with subsequent steps from <code class="computeroutput"><span class="identifier">stepper</span></code>.
  221. Integration start at <code class="computeroutput"><span class="identifier">t0</span></code> and
  222. <code class="computeroutput"><span class="identifier">x0</span></code> and ends at <span class="emphasis"><em>t<sub>1</sub></em></span>.
  223. <code class="computeroutput"><span class="identifier">x0</span></code> is changed to the approximative
  224. solution <span class="emphasis"><em>x(t<sub>1</sub>)</em></span> at the end of integration. If provided,
  225. the <code class="computeroutput"><span class="identifier">observer</span></code> is called after
  226. each step (and before the first step at <code class="computeroutput"><span class="identifier">t0</span></code>).
  227. <code class="computeroutput"><span class="identifier">integrate_adaptive</span></code> returns
  228. the number of steps performed during the integration.
  229. </p>
  230. <div class="note"><table border="0" summary="Note">
  231. <tr>
  232. <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
  233. <th align="left">Note</th>
  234. </tr>
  235. <tr><td align="left" valign="top"><p>
  236. <code class="computeroutput"><span class="identifier">integrate_adaptive</span></code> by design
  237. performs an observer call after each time step. Hence there is no need
  238. for a <code class="computeroutput"><a class="link" href="../../boost/numeric/odeint/max_step_checker.html" title="Class max_step_checker">max_step_checker</a></code> as only
  239. exactly one step is ever performed between observer calls.
  240. </p></td></tr>
  241. </table></div>
  242. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  243. <li class="listitem">
  244. If <code class="computeroutput"><span class="identifier">stepper</span></code> is a <a class="link" href="../concepts/stepper.html" title="Stepper">Stepper</a> or <a class="link" href="../concepts/error_stepper.html" title="Error Stepper">Error Stepper</a>
  245. then <code class="computeroutput"><span class="identifier">dt</span></code> is the step size
  246. used for integration and <code class="computeroutput"><span class="identifier">integrate_adaptive</span></code>
  247. behaves like <code class="computeroutput"><span class="identifier">integrate_const</span></code>
  248. except that for the last step the step size is reduced to ensure we end
  249. exactly at <code class="computeroutput"><span class="identifier">t1</span></code>. If provided,
  250. the observer is called at each step.
  251. </li>
  252. <li class="listitem">
  253. If <code class="computeroutput"><span class="identifier">stepper</span></code> is a <a class="link" href="../concepts/controlled_stepper.html" title="Controlled Stepper">Controlled
  254. Stepper</a> then <code class="computeroutput"><span class="identifier">dt</span></code>
  255. is the initial step size. The actual step size is changed according to
  256. error control of the stepper. For the last step, the step size will be
  257. reduced to ensure we end exactly at <code class="computeroutput"><span class="identifier">t1</span></code>.
  258. If provided, the observer is called after each time step (and before
  259. the first step at <code class="computeroutput"><span class="identifier">t0</span></code>).
  260. </li>
  261. <li class="listitem">
  262. If stepper is a <a class="link" href="../concepts/dense_output_stepper.html" title="Dense Output Stepper">Dense
  263. Output Stepper</a> then <code class="computeroutput"><span class="identifier">dt</span></code>
  264. is the initial step size and <code class="computeroutput"><span class="identifier">integrate_adaptive</span></code>
  265. behaves just like for <a class="link" href="../concepts/controlled_stepper.html" title="Controlled Stepper">Controlled
  266. Stepper</a> above. No dense output is used.
  267. </li>
  268. </ul></div>
  269. <h5>
  270. <a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.h3"></a>
  271. <span class="phrase"><a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.observer_calls_at_given_time_points"></a></span><a class="link" href="integrate_functions.html#boost_numeric_odeint.odeint_in_detail.integrate_functions.observer_calls_at_given_time_points">Observer
  272. calls at given time points</a>
  273. </h5>
  274. <p>
  275. If the observer should be called at some user given time points the <code class="computeroutput"><span class="identifier">integrate_times</span></code> function should be used.
  276. The times for observer calls are provided as a sequence of time values. The
  277. sequence is either defined via two iterators pointing to begin and end of
  278. the sequence or in terms of a <a href="http://www.boost.org/doc/libs/release/libs/range/" target="_top">Boost.Range</a>
  279. object.
  280. </p>
  281. <p>
  282. <code class="computeroutput"><span class="identifier">integrate_times</span><span class="special">(</span>
  283. <span class="identifier">stepper</span> <span class="special">,</span>
  284. <span class="identifier">system</span> <span class="special">,</span>
  285. <span class="identifier">x0</span> <span class="special">,</span>
  286. <span class="identifier">times_start</span> <span class="special">,</span>
  287. <span class="identifier">times_end</span> <span class="special">,</span>
  288. <span class="identifier">dt</span> <span class="special">,</span>
  289. <span class="identifier">observer</span> <span class="special">)</span></code>
  290. </p>
  291. <p>
  292. <code class="computeroutput"><span class="identifier">integrate_times</span><span class="special">(</span>
  293. <span class="identifier">stepper</span> <span class="special">,</span>
  294. <span class="identifier">system</span> <span class="special">,</span>
  295. <span class="identifier">x0</span> <span class="special">,</span>
  296. <span class="identifier">time_range</span> <span class="special">,</span>
  297. <span class="identifier">dt</span> <span class="special">,</span>
  298. <span class="identifier">observer</span> <span class="special">)</span></code>
  299. </p>
  300. <p>
  301. Integrates the ODE given by <code class="computeroutput"><span class="identifier">system</span></code>
  302. with subsequent steps from <code class="computeroutput"><span class="identifier">stepper</span></code>.
  303. Integration starts at <code class="computeroutput"><span class="special">*</span><span class="identifier">times_start</span></code>
  304. and ends exactly at <code class="computeroutput"><span class="special">*(</span><span class="identifier">times_end</span><span class="special">-</span><span class="number">1</span><span class="special">)</span></code>.
  305. <code class="computeroutput"><span class="identifier">x0</span></code> contains the approximate
  306. solution at the end point of integration. This function requires an observer
  307. which is invoked at the subsequent times <code class="computeroutput"><span class="special">*</span><span class="identifier">times_start</span><span class="special">++</span></code>
  308. until <code class="computeroutput"><span class="identifier">times_start</span> <span class="special">==</span>
  309. <span class="identifier">times_end</span></code>. If called with a <a href="http://www.boost.org/doc/libs/release/libs/range/" target="_top">Boost.Range</a>
  310. <code class="computeroutput"><span class="identifier">time_range</span></code> the function behaves
  311. the same with <code class="computeroutput"><span class="identifier">times_start</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">begin</span><span class="special">(</span> <span class="identifier">time_range</span>
  312. <span class="special">)</span></code> and <code class="computeroutput"><span class="identifier">times_end</span>
  313. <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">end</span><span class="special">(</span>
  314. <span class="identifier">time_range</span> <span class="special">)</span></code>.
  315. Additionally, a <code class="computeroutput"><a class="link" href="../../boost/numeric/odeint/max_step_checker.html" title="Class max_step_checker">max_step_checker</a></code> can be provided,
  316. e.g.:
  317. </p>
  318. <p>
  319. <code class="computeroutput"><span class="identifier">integrate_times</span><span class="special">(</span>
  320. <span class="identifier">stepper</span> <span class="special">,</span>
  321. <span class="identifier">system</span> <span class="special">,</span>
  322. <span class="identifier">x0</span> <span class="special">,</span>
  323. <span class="identifier">times_start</span> <span class="special">,</span>
  324. <span class="identifier">times_end</span> <span class="special">,</span>
  325. <span class="identifier">dt</span> <span class="special">,</span>
  326. <span class="identifier">observer</span> <span class="special">,</span>
  327. <span class="identifier">max_step_checker</span><span class="special">)</span></code>
  328. </p>
  329. <p>
  330. As above, this will throw a <code class="computeroutput"><span class="identifier">no_progress_error</span></code>
  331. if too many steps are performed between observer calls.
  332. </p>
  333. <p>
  334. <code class="computeroutput"><span class="identifier">integrate_times</span></code> returns the
  335. number of steps performed during the integration.
  336. </p>
  337. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  338. <li class="listitem">
  339. If <code class="computeroutput"><span class="identifier">stepper</span></code> is a <a class="link" href="../concepts/stepper.html" title="Stepper">Stepper</a> or <a class="link" href="../concepts/error_stepper.html" title="Error Stepper">Error Stepper</a>
  340. <code class="computeroutput"><span class="identifier">dt</span></code> is the step size used
  341. for integration. However, whenever a time point from the sequence is
  342. approached the step size <code class="computeroutput"><span class="identifier">dt</span></code>
  343. will be reduced to obtain the state <span class="emphasis"><em>x(t)</em></span> exactly
  344. at the time point.
  345. </li>
  346. <li class="listitem">
  347. If <code class="computeroutput"><span class="identifier">stepper</span></code> is a <a class="link" href="../concepts/controlled_stepper.html" title="Controlled Stepper">Controlled
  348. Stepper</a> then <code class="computeroutput"><span class="identifier">dt</span></code>
  349. is the initial step size. The actual step size is adjusted during integration
  350. according to error control. However, if a time point from the sequence
  351. is approached the step size is reduced to obtain the state <span class="emphasis"><em>x(t)</em></span>
  352. exactly at the time point.
  353. </li>
  354. <li class="listitem">
  355. If <code class="computeroutput"><span class="identifier">stepper</span></code> is a <a class="link" href="../concepts/dense_output_stepper.html" title="Dense Output Stepper">Dense Output
  356. Stepper</a> then <code class="computeroutput"><span class="identifier">dt</span></code>
  357. is the initial step size. The actual step size is adjusted during integration
  358. according to error control. Dense output is used to obtain the states
  359. <span class="emphasis"><em>x(t)</em></span> at the time points from the sequence.
  360. </li>
  361. </ul></div>
  362. <h5>
  363. <a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.h4"></a>
  364. <span class="phrase"><a name="boost_numeric_odeint.odeint_in_detail.integrate_functions.convenience_integrate_function"></a></span><a class="link" href="integrate_functions.html#boost_numeric_odeint.odeint_in_detail.integrate_functions.convenience_integrate_function">Convenience
  365. integrate function</a>
  366. </h5>
  367. <p>
  368. Additionally to the sophisticated integrate function above odeint also provides
  369. a simple <code class="computeroutput"><span class="identifier">integrate</span></code> routine
  370. which uses a dense output stepper based on <code class="computeroutput"><span class="identifier">runge_kutta_dopri5</span></code>
  371. with standard error bounds <span class="emphasis"><em>10<sup>-6</sup></em></span> for the steps.
  372. </p>
  373. <p>
  374. <code class="computeroutput"><span class="identifier">integrate</span><span class="special">(</span>
  375. <span class="identifier">system</span> <span class="special">,</span>
  376. <span class="identifier">x0</span> <span class="special">,</span>
  377. <span class="identifier">t0</span> <span class="special">,</span>
  378. <span class="identifier">t1</span> <span class="special">,</span>
  379. <span class="identifier">dt</span> <span class="special">)</span></code>
  380. </p>
  381. <p>
  382. <code class="computeroutput"><span class="identifier">integrate</span><span class="special">(</span>
  383. <span class="identifier">system</span> <span class="special">,</span>
  384. <span class="identifier">x0</span> <span class="special">,</span>
  385. <span class="identifier">t0</span> <span class="special">,</span>
  386. <span class="identifier">t1</span> <span class="special">,</span>
  387. <span class="identifier">dt</span> <span class="special">,</span>
  388. <span class="identifier">observer</span> <span class="special">)</span></code>
  389. </p>
  390. <p>
  391. This function behaves exactly like <code class="computeroutput"><span class="identifier">integrate_adaptive</span></code>
  392. above but no stepper has to be provided. It also returns the number of steps
  393. performed during the integration.
  394. </p>
  395. </div>
  396. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  397. <td align="left"></td>
  398. <td align="right"><div class="copyright-footer">Copyright &#169; 2009-2015 Karsten Ahnert and Mario Mulansky<p>
  399. Distributed under the Boost Software License, Version 1.0. (See accompanying
  400. file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
  401. </p>
  402. </div></td>
  403. </tr></table>
  404. <hr>
  405. <div class="spirit-nav">
  406. <a accesskey="p" href="generation_functions.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../odeint_in_detail.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="iterators_and_ranges.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
  407. </div>
  408. </body>
  409. </html>