[353] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
| 2 | <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
---|
| 3 | <title>mixpp: Numerical Integration</title> |
---|
| 4 | <link href="tabs.css" rel="stylesheet" type="text/css"> |
---|
| 5 | <link href="doxygen.css" rel="stylesheet" type="text/css"> |
---|
| 6 | </head><body> |
---|
| 7 | <!-- Generated by Doxygen 1.5.8 --> |
---|
| 8 | <script type="text/javascript"> |
---|
| 9 | <!-- |
---|
| 10 | function changeDisplayState (e){ |
---|
| 11 | var num=this.id.replace(/[^[0-9]/g,''); |
---|
| 12 | var button=this.firstChild; |
---|
| 13 | var sectionDiv=document.getElementById('dynsection'+num); |
---|
| 14 | if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){ |
---|
| 15 | sectionDiv.style.display='block'; |
---|
| 16 | button.src='open.gif'; |
---|
| 17 | }else{ |
---|
| 18 | sectionDiv.style.display='none'; |
---|
| 19 | button.src='closed.gif'; |
---|
| 20 | } |
---|
| 21 | } |
---|
| 22 | function initDynSections(){ |
---|
| 23 | var divs=document.getElementsByTagName('div'); |
---|
| 24 | var sectionCounter=1; |
---|
| 25 | for(var i=0;i<divs.length-1;i++){ |
---|
| 26 | if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){ |
---|
| 27 | var header=divs[i]; |
---|
| 28 | var section=divs[i+1]; |
---|
| 29 | var button=header.firstChild; |
---|
| 30 | if (button!='IMG'){ |
---|
| 31 | divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild); |
---|
| 32 | button=document.createElement('img'); |
---|
| 33 | divs[i].insertBefore(button,divs[i].firstChild); |
---|
| 34 | } |
---|
| 35 | header.style.cursor='pointer'; |
---|
| 36 | header.onclick=changeDisplayState; |
---|
| 37 | header.id='dynheader'+sectionCounter; |
---|
| 38 | button.src='closed.gif'; |
---|
| 39 | section.id='dynsection'+sectionCounter; |
---|
| 40 | section.style.display='none'; |
---|
| 41 | section.style.marginLeft='14px'; |
---|
| 42 | sectionCounter++; |
---|
| 43 | } |
---|
| 44 | } |
---|
| 45 | } |
---|
| 46 | window.onload = initDynSections; |
---|
| 47 | --> |
---|
| 48 | </script> |
---|
| 49 | <div class="navigation" id="top"> |
---|
| 50 | <div class="tabs"> |
---|
| 51 | <ul> |
---|
| 52 | <li><a href="main.html"><span>Main Page</span></a></li> |
---|
| 53 | <li><a href="pages.html"><span>Related Pages</span></a></li> |
---|
| 54 | <li><a href="modules.html"><span>Modules</span></a></li> |
---|
| 55 | <li><a href="annotated.html"><span>Classes</span></a></li> |
---|
| 56 | <li><a href="files.html"><span>Files</span></a></li> |
---|
| 57 | </ul> |
---|
| 58 | </div> |
---|
| 59 | </div> |
---|
| 60 | <div class="contents"> |
---|
| 61 | <h1>Numerical Integration<br> |
---|
| 62 | <small> |
---|
| 63 | [<a class="el" href="group__math.html">Auxiliary math functions</a>]</small> |
---|
| 64 | </h1>Numerical integration routines. |
---|
| 65 | <a href="#_details">More...</a> |
---|
| 66 | <p> |
---|
| 67 | <table border="0" cellpadding="0" cellspacing="0"> |
---|
| 68 | <tr><td></td></tr> |
---|
| 69 | <tr><td colspan="2"><br><h2>Functions</h2></td></tr> |
---|
| 70 | <tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__integration.html#g680b7d0ff7b4fe8bad1a5524a54b2f33">itpp::quad</a> (double(*f)(double), double a, double b, double tol)</td></tr> |
---|
| 71 | |
---|
| 72 | <tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="group__integration.html#gccd3a6ad5542f171411339b37b4a0fae">itpp::quadl</a> (double(*f)(double), double a, double b, double tol)</td></tr> |
---|
| 73 | |
---|
| 74 | </table> |
---|
| 75 | <hr><a name="_details"></a><h2>Detailed Description</h2> |
---|
| 76 | Numerical integration routines. <hr><h2>Function Documentation</h2> |
---|
| 77 | <a class="anchor" name="g680b7d0ff7b4fe8bad1a5524a54b2f33"></a><!-- doxytag: member="itpp::quad" ref="g680b7d0ff7b4fe8bad1a5524a54b2f33" args="(double(*f)(double), double a, double b, double tol)" --> |
---|
| 78 | <div class="memitem"> |
---|
| 79 | <div class="memproto"> |
---|
| 80 | <table class="memname"> |
---|
| 81 | <tr> |
---|
| 82 | <td class="memname">double itpp::quad </td> |
---|
| 83 | <td>(</td> |
---|
| 84 | <td class="paramtype">double(*)(double) </td> |
---|
| 85 | <td class="paramname"> <em>f</em>, </td> |
---|
| 86 | </tr> |
---|
| 87 | <tr> |
---|
| 88 | <td class="paramkey"></td> |
---|
| 89 | <td></td> |
---|
| 90 | <td class="paramtype">double </td> |
---|
| 91 | <td class="paramname"> <em>a</em>, </td> |
---|
| 92 | </tr> |
---|
| 93 | <tr> |
---|
| 94 | <td class="paramkey"></td> |
---|
| 95 | <td></td> |
---|
| 96 | <td class="paramtype">double </td> |
---|
| 97 | <td class="paramname"> <em>b</em>, </td> |
---|
| 98 | </tr> |
---|
| 99 | <tr> |
---|
| 100 | <td class="paramkey"></td> |
---|
| 101 | <td></td> |
---|
| 102 | <td class="paramtype">double </td> |
---|
| 103 | <td class="paramname"> <em>tol</em> = <code>std::numeric_limits< double >::epsilon()</code></td><td> </td> |
---|
| 104 | </tr> |
---|
| 105 | <tr> |
---|
| 106 | <td></td> |
---|
| 107 | <td>)</td> |
---|
| 108 | <td></td><td></td><td></td> |
---|
| 109 | </tr> |
---|
| 110 | </table> |
---|
| 111 | </div> |
---|
| 112 | <div class="memdoc"> |
---|
| 113 | |
---|
| 114 | <p> |
---|
| 115 | 1-dimensional numerical Simpson quadrature integration<p> |
---|
| 116 | Calculate the 1-dimensional integral <p class="formulaDsp"> |
---|
| 117 | <img class="formulaDsp" alt="\[ \int_a^b f(x) dx \]" src="form_183.png"> |
---|
| 118 | <p> |
---|
| 119 | <p> |
---|
| 120 | Uses an adaptive Simpson quadrature method. See [Gander] for more details. The integrand is specified as a function <div class="fragment"><pre class="fragment"> <span class="keywordtype">double</span> |
---|
| 121 | f(<span class="keywordtype">double</span>) |
---|
| 122 | </pre></div>.<p> |
---|
| 123 | Example: <div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "<a class="code" href="itbase_8h.html" title="Include file for the IT++ base module.">itpp/itbase.h</a>"</span> |
---|
| 124 | |
---|
| 125 | <span class="keywordtype">double</span> f(<span class="keyword">const</span> <span class="keywordtype">double</span> x) |
---|
| 126 | { |
---|
| 127 | <span class="keywordflow">return</span> x*<a class="code" href="group__logexpfunc.html#g60e39caa21db1b5f9f6006cf7508fbcb" title="The natural logarithm of the elements.">log</a>(x); |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | <span class="keywordtype">int</span> main() |
---|
| 131 | { |
---|
| 132 | <span class="keywordtype">double</span> res = <a class="code" href="group__integration.html#g680b7d0ff7b4fe8bad1a5524a54b2f33">quad</a>( f, 1.5, 3.5); |
---|
| 133 | cout << <span class="stringliteral">"res = "</span> << res << endl; |
---|
| 134 | |
---|
| 135 | <span class="keywordflow">return</span> 0; |
---|
| 136 | } |
---|
| 137 | </pre></div><p> |
---|
| 138 | References:<p> |
---|
| 139 | [Gander] Gander, W. and W. Gautschi, "Adaptive Quadrature - Revisited", BIT, Vol. 40, 2000, pp. 84-101. This document is also available at <a href="http://www.inf.ethz.ch/personal/gander.">http://www.inf.ethz.ch/personal/gander.</a> |
---|
| 140 | <p>References <a class="el" href="matfunc_8h-source.html#l00077">itpp::sum()</a>.</p> |
---|
| 141 | |
---|
| 142 | </div> |
---|
| 143 | </div><p> |
---|
| 144 | <a class="anchor" name="gccd3a6ad5542f171411339b37b4a0fae"></a><!-- doxytag: member="itpp::quadl" ref="gccd3a6ad5542f171411339b37b4a0fae" args="(double(*f)(double), double a, double b, double tol)" --> |
---|
| 145 | <div class="memitem"> |
---|
| 146 | <div class="memproto"> |
---|
| 147 | <table class="memname"> |
---|
| 148 | <tr> |
---|
| 149 | <td class="memname">double itpp::quadl </td> |
---|
| 150 | <td>(</td> |
---|
| 151 | <td class="paramtype">double(*)(double) </td> |
---|
| 152 | <td class="paramname"> <em>f</em>, </td> |
---|
| 153 | </tr> |
---|
| 154 | <tr> |
---|
| 155 | <td class="paramkey"></td> |
---|
| 156 | <td></td> |
---|
| 157 | <td class="paramtype">double </td> |
---|
| 158 | <td class="paramname"> <em>a</em>, </td> |
---|
| 159 | </tr> |
---|
| 160 | <tr> |
---|
| 161 | <td class="paramkey"></td> |
---|
| 162 | <td></td> |
---|
| 163 | <td class="paramtype">double </td> |
---|
| 164 | <td class="paramname"> <em>b</em>, </td> |
---|
| 165 | </tr> |
---|
| 166 | <tr> |
---|
| 167 | <td class="paramkey"></td> |
---|
| 168 | <td></td> |
---|
| 169 | <td class="paramtype">double </td> |
---|
| 170 | <td class="paramname"> <em>tol</em> = <code>std::numeric_limits< double >::epsilon()</code></td><td> </td> |
---|
| 171 | </tr> |
---|
| 172 | <tr> |
---|
| 173 | <td></td> |
---|
| 174 | <td>)</td> |
---|
| 175 | <td></td><td></td><td></td> |
---|
| 176 | </tr> |
---|
| 177 | </table> |
---|
| 178 | </div> |
---|
| 179 | <div class="memdoc"> |
---|
| 180 | |
---|
| 181 | <p> |
---|
| 182 | 1-dimensional numerical adaptive Lobatto quadrature integration<p> |
---|
| 183 | Calculate the 1-dimensional integral <p class="formulaDsp"> |
---|
| 184 | <img class="formulaDsp" alt="\[ \int_a^b f(x) dx \]" src="form_183.png"> |
---|
| 185 | <p> |
---|
| 186 | <p> |
---|
| 187 | Uses an adaptive Lobatto quadrature method. See [Gander] for more details. The integrand is specified as a function <div class="fragment"><pre class="fragment"> <span class="keywordtype">double</span> |
---|
| 188 | f(<span class="keywordtype">double</span>) |
---|
| 189 | </pre></div>.<p> |
---|
| 190 | Example: <div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "<a class="code" href="itbase_8h.html" title="Include file for the IT++ base module.">itpp/itbase.h</a>"</span> |
---|
| 191 | |
---|
| 192 | <span class="keywordtype">double</span> f(<span class="keyword">const</span> <span class="keywordtype">double</span> x) |
---|
| 193 | { |
---|
| 194 | <span class="keywordflow">return</span> x*<a class="code" href="group__logexpfunc.html#g60e39caa21db1b5f9f6006cf7508fbcb" title="The natural logarithm of the elements.">log</a>(x); |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | <span class="keywordtype">int</span> main() |
---|
| 198 | { |
---|
| 199 | <span class="keywordtype">double</span> res = <a class="code" href="group__integration.html#gccd3a6ad5542f171411339b37b4a0fae">quadl</a>( f, 1.5, 3.5); |
---|
| 200 | cout << <span class="stringliteral">"res = "</span> << res << endl; |
---|
| 201 | |
---|
| 202 | <span class="keywordflow">return</span> 0; |
---|
| 203 | } |
---|
| 204 | </pre></div><p> |
---|
| 205 | References:<p> |
---|
| 206 | [Gander] Gander, W. and W. Gautschi, "Adaptive Quadrature - Revisited", BIT, Vol. 40, 2000, pp. 84-101. This document is also available at <a href="http://">http://</a> www.inf.ethz.ch/personal/gander. |
---|
| 207 | <p>References <a class="el" href="fix__functions_8cpp-source.html#l00076">itpp::abs()</a>, <a class="el" href="elem__math_8h-source.html#l00089">itpp::sign()</a>, and <a class="el" href="elem__math_8h-source.html#l00126">itpp::sqrt()</a>.</p> |
---|
| 208 | |
---|
| 209 | </div> |
---|
| 210 | </div><p> |
---|
| 211 | </div> |
---|
| 212 | <hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:14 2009 for mixpp by |
---|
| 213 | <a href="http://www.doxygen.org/index.html"> |
---|
| 214 | <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
---|
| 215 | </body> |
---|
| 216 | </html> |
---|