AERN-RnToRm-0.4.9.1: polynomial function enclosures (PFEs) approximating exact real functionsSource codeContentsIndex
Data.Number.ER.RnToRm.UnitDom.Base
Portabilityportable
Stabilityexperimental
Maintainermik@konecny.aow.cz
Description

A class abstracting function arithmetic with directed rounding. It is used to describe a boundary for an approximation to a real function on the interval [-1,1]^n.

To be imported qualified, usually with the synonym UFB.

Documentation
class (ERRealBase b, ERIntApprox ra, Ord ufb, DomainBox boxb varid b, DomainIntBox boxra varid ra) => ERUnitFnBase boxb boxra varid b ra ufb | ufb -> boxb boxra varid b ra whereSource
Methods
initialiseBaseArithmetic :: ufb -> IO ()Source
This should be evaluated before using any of the following operations.
raEndpointsSource
:: ufbthis parameter is not used except for type checking
-> ra
-> (b, b)
Convert from the associated interval type to the base type. (The types are determined by the given example function.)
raFromEndpointsSource
:: ufbthis parameter is not used except for type checking
-> (b, b)
-> ra
Convert from the base type to the associated interval type. (The types are determined by the given example function.)
compareApprox :: ufb -> ufb -> OrderingSource
A linear ordering on basic functions, which can be syntactic and rather arbitrary.
showDiGrCmpSource
:: Intnumber of decimal digits to show
-> Boolwhether to show granularity
-> Boolwhether to show internal structure
-> ufb
-> String
isValid :: ufb -> BoolSource
Check internal consistency of the basic function, typically absence of NaN.
checkSource
:: Stringindentification of caller location for easier debugging
-> ufb
-> ufb
Check internal consistency of the basic function and report problem if any.
getGranularity :: ufb -> GranularitySource
Get the granularity of the coefficients inside this basic function.
setMinGranularity :: Granularity -> ufb -> ufbSource
setGranularity :: Granularity -> ufb -> ufbSource
getDegree :: ufb -> IntSource

Get the degree of this basic function.

If the function is a polynomial, this function should return its degree.

reduceDegreeUp :: Int -> ufb -> ufbSource
Decrease the degree of a basic function, rounding pointwise upwards.
getSize :: ufb -> IntSource

Get the term size of this basic function.

If the function is a polynomial, this function should return the number of terms in the polynomial.

reduceSizeUp :: Int -> ufb -> ufbSource
Decrease the size of this basic function, rounding pointwise upwards.
getVariables :: ufb -> [varid]Source
Get a list of all variables featured in this basic function.
const :: b -> ufbSource
Construct a constant basic function.
constEncl :: (b, b) -> (ufb, ufb)Source
Construct a constant basic enclosure (negated lower bound, upper bound).
affineSource
:: bvalue at 0
-> Map varid bascent of each base vector
-> ufb
Construct an affine basic function.
upperBound :: EffortIndex -> ufb -> bSource
Find an upper bound of a basic function over [-1,1]^n.
maxUpSource
:: Intmax degree for result
-> Intmax approx size for result
-> ufb
f1
-> ufb
f2
-> ufb
Approximate the function max(f1,f2) from above.
minUpSource
:: Intmax degree for result
-> Intmax approx size for result
-> ufb
f1
-> ufb
f2
-> ufb
Approximate the function min(f1,f2) from above.
neg :: ufb -> ufbSource
Pointwise exact negation of a basic function
scaleUp :: b -> ufb -> ufbSource
Multiply a basic function by a scalar, rounding upwards.
scaleApproxUpSource
:: Intmaximum polynomial degree
-> Intmaximum term count
-> ra
-> ufb
-> ufb
Multiply a basic function by an approximation of a scalar, rounding upwards.
(+^) :: ufb -> ufb -> ufbSource
Pointwise upwards rounded addition
(-^) :: ufb -> ufb -> ufbSource
Pointwise upwards rounded subtraction
(*^) :: ufb -> ufb -> ufbSource
Pointwise upwards rounded multiplication
multiplyEnclSource
:: Intmaximum polynomial degree
-> Intmaximum term count
-> (ufb, ufb)
-> (ufb, ufb)
-> (ufb, ufb)

Enclosure multiplication

IMPORTANT: enclosure = (negated lower bound, upper bound)

recipUp :: Int -> Int -> EffortIndex -> ufb -> ufbSource
Approximate the function 1/f from above, assuming f does not hit zero in the unit domain.
recipEnclSource
:: Intmax degree for result
-> Intmax approx size for result
-> EffortIndex
-> (ufb, ufb)enclosure of f
-> (ufb, ufb)

Approximate the reciprocal of an enclosure, assuming f does not hit zero in the unit domain.

IMPORTANT: enclosure = (negated lower bound, upper bound)

evalUp :: boxb -> ufb -> bSource
Evaluate a basic function at a point rounding upwards using a basic number for both the point and the result.
evalApprox :: boxra -> ufb -> raSource
Safely evaluate a basic function at a point using a real number approximation for both the point and the result.
partialEvalApproxUp :: boxra -> ufb -> ufbSource
Partially evaluate a basic function at a lower-dimensional point given using a real number approximation. Approximate the resulting function from above.
composeUpSource
:: Intmax degree for result
-> Intmax approx size for result
-> ufbfunction f
-> varidvariable v to substitute in f
-> ufbfunction f_v to substitute for v that maps [-1,1] into [-1,1]
-> ufbpointwise upper bound of f[v |-> f_v]
Compose two basic functions, rounding downwards and upwards, assuming f_v ranges within the domain [-1,1].
composeEnclSource
:: Intmax degree for result
-> Intmax approx size for result
-> ufbfunction f
-> varidvariable v to substitute in f
-> (ufb, ufb)enclosure of a function f_v to substitute for v that maps [-1,1] into [-1,1]
-> (ufb, ufb)enclosure of f[v |-> f_v]
Compose two basic functions, rounding downwards and upwards, assuming f_v ranges within the domain [-1,1].
composeManyUpSource
:: Intmax degree for result
-> Intmax approx size for result
-> ufbfunction f
-> Map varid ufbvariables to substitute and for each variable v, function f_v to substitute for v that maps [-1,1] into [-1,1]
-> ufbpointwise upper bound of f[v |-> f_v]
Substitute several variables in a basic function with other basic functions, rounding downwards and upwards, assuming each f_v ranges within the domain [-1,1].
composeManyEnclsSource
:: Intmax degree for result
-> Intmax approx size for result
-> ufbfunction f
-> Map varid (ufb, ufb)variables to substitute and for each variable v, enclosure of a function f_v to substitute for v that maps [-1,1] into [-1,1]
-> (ufb, ufb)enclosure of f[v |-> f_v]
Substitute several variables in a basic function with other basic functions, rounding downwards and upwards, assuming each f_v ranges within the domain [-1,1].
sqrtEnclSource
:: Intmax degree for result
-> Intmax approx size for result
-> EffortIndexhow hard to try when approximating exp as a polynomial
-> (ufb, ufb)
f
-> (ufb, ufb)
Approximate sqrt(f) for enclosures.
expEnclSource
:: Intmax degree for result
-> Intmax approx size for result
-> EffortIndexhow hard to try when approximating exp as a polynomial
-> (ufb, ufb)
f
-> (ufb, ufb)
Approximate exp(f) for enclosures.
logEnclSource
:: Intmax degree for result
-> Intmax approx size for result
-> EffortIndexhow hard to try when approximating log as a polynomial
-> (ufb, ufb)
f
-> (ufb, ufb)
Approximate log(f) for enclosures.
sinEnclSource
:: Intmax degree for result
-> Intmax approx size for result
-> EffortIndexhow hard to try when approximating sin as a polynomial
-> (ufb, ufb)
f
-> (ufb, ufb)
Approximate sin(f) for enclosures, assuming the range of f is within [-pi2,pi2].
cosEnclSource
:: Intmax degree for result
-> Intmax approx size for result
-> EffortIndexhow hard to try when approximating cos as a polynomial
-> (ufb, ufb)
f
-> (ufb, ufb)
Approximate cos(f) for enclosures, assuming the range of f is within [-pi2,pi2].
atanEnclSource
:: Intmax degree for result
-> Intmax approx size for result
-> EffortIndexhow hard to try when approximating cos as a polynomial
-> (ufb, ufb)
f
-> (ufb, ufb)
Approximate atan(f) for enclosures.
integrateSource
:: varidvariable to integrate by
-> ufb
f
-> (ufb, ufb)
Approximate the primitive function of f from below and from above.
volumeAboveZeroUpSource
:: [varid]dimensions to include in the measuring domain; have to include all those present in f
-> ufb
f
-> b
Measure the volume between a function and the zero hyperplane on the domain [-1,1]^n.
show/hide Instances
(ERRealBase rb, RealFrac rb, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxras varid rb ([] (ERInterval rb)), DomainBoxMappable boxra boxras varid (ERInterval rb) ([] (ERInterval rb)), DomainIntBox boxra varid (ERInterval rb)) => ERUnitFnBase boxb boxra varid rb (ERInterval rb) (ERChebPoly box rb)
(ERRealBase rb, RealFrac rb, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxras varid rb ([] (ERInterval rb)), DomainBoxMappable boxra boxras varid (ERInterval rb) ([] (ERInterval rb)), DomainIntBox boxra varid (ERInterval rb)) => ERUnitFnBase boxb boxra varid rb (ERInterval rb) (ERChebPoly box rb)
Produced by Haddock version 2.4.2