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
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}}, \:{totalpts ={129}}, \right.
\
\
\displaystyle
\left.\:{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_94606636}}, \: \right.
\
\
\displaystyle
\left.{error ={0.6667607588_1485444979 E - 9}}, \:{totalpts ={1
29}}, \: \right.
\
\
\displaystyle
\left.{success =  \mbox{\rm true} }\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_5826871994_1097}}, \:{totalpts ={1
29}}, \: \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_897932385(4)
Type: Float

works, while

fricas
%e::Float
Cannot convert from type Expression(Integer) to Float for value %e

fails. You have to use

fricas
exp(1)$Float

\label{eq5}2.7182818284_590452354(5)
Type: Float

instead.




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