login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

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)

\label{eq3}\begin{array}{@{}l}
\displaystyle
\left[{value ={1.7182905680 \_ 834782946}}, \: \right.
\
\
\displaystyle
\left.{error ={0.0000327734 \<u> 5826871994 \</u> 1097}}, \:{totalpts ={129}}, \: \right.
\
\
\displaystyle
\left.{success =  \mbox{\rm true} }\right] 
(3)
Type: Record(value: Float,error: Float,totalpts: Integer,success: Boolean)

Note that for some reason

fricas
%pi::Float

\label{eq4}3.1415926535 \<u> 897932385(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

\label{eq5}2.7182818284 \<u> 590452354(5)
Type: Float

instead.




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: