The package NumericalQuadrature implements several operations for numerical integration. Here I provide just some examples. Documentation is to be found in the corresponding .spad or .pamphlet file.
fricas
(1) -> romberg(x+->exp(x),0.0,1.0,0.1,0.1,6,10)
\label{eq1}\begin{array}{@{}l} \displaystyle \left[{value ={1.7182818284 \_ 590452354}}, \:{error ={0.0}}, \: \right. \ \ \displaystyle \left.{totalpts ={129}}, \:{success = \mbox{\rm true} }\right]
(1)
Type: Record(value: Float,error: Float,totalpts: Integer,success: Boolean)
fricas
simpson(x+->exp(x),0.0,1.0,0.1,0.1,6,10)
\label{eq2}\begin{array}{@{}l} \displaystyle \left[{value ={1.7182818284 \_ 590539174}}, \: \right. \ \ \displaystyle \left.{error ={2.1478522855 \_ 738173967}}, \:{totalpts ={102 5}}, \: \right. \ \ \displaystyle \left.{success = \mbox{\rm false} }\right]
(2)
Type: Record(value: Float,error: Float,totalpts: Integer,success: Boolean)
fricas
trapezoidal(x+->exp(x),0.0,1.0,0.1,0.1,6,10)
5826871994 \ 1097}}, \:{totalpts ={129}}, \: \right.
\
\
\displaystyle
\left.{success = \mbox{\rm true} }\right]
" title="
\label{eq3}\begin{array}{@{}l}
\displaystyle
\left[{value ={1.7182905680 \_ 834782946}}, \: \right.
\
\
\displaystyle
\left.{error ={0.0000327734 \
5826871994 \ 1097}}, \:{totalpts ={129}}, \: \right.
\
\
\displaystyle
\left.{success = \mbox{\rm true} }\right]
" class="equation" src="images/1268477483842938138-16.0px.png" align="bottom" Style="vertical-align:text-bottom" width="396" height="96"/>
(3)
Type: Record(value: Float,error: Float,totalpts: Integer,success: Boolean)
Note that for some reason
fricas
%pi::Float
897932385" title="
\label{eq4}3.1415926535 \ 897932385" class="equation" src="images/5436651766032476564-16.0px.png" align="bottom" Style="vertical-align:text-bottom" width="174" height="17"/>
(4)
Type: Float
works, while
fricas
%e::Float
Cannot convert the value from type Expression(Integer) to Float .
fails. You have to use
fricas
exp(1)$Float
590452354" title="
\label{eq5}2.7182818284 \ 590452354" class="equation" src="images/4961478700006378835-16.0px.png" align="bottom" Style="vertical-align:text-bottom" width="176" height="17"/>
(5)
Type: Float
instead.