AERN-RnToRm-0.3.0: polynomial function enclosures (PFEs) approximating exact real functions

Portabilityportable
Stabilityexperimental
Maintainermik@konecny.aow.cz

Data.Number.ER.RnToRm.UnitDom.Base

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, Fractional ufb, 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

checkSource

Arguments

:: String

indentification of caller location for easier debugging

-> ufb 
-> ufb 

Check internal consistency of the function and report problem if any.

getGranularity :: ufb -> GranularitySource

setMinGranularity :: Granularity -> ufb -> ufbSource

setGranularity :: Granularity -> ufb -> ufbSource

const :: b -> ufbSource

Construct a constant function.

affineSource

Arguments

:: b

value at 0

-> Map varid b

ascent of each base vector

-> ufb 

Construct an affine function.

scale :: b -> ufb -> (ufb, ufb)Source

Multiply a function by a scalar, rounding downwards and upwards.

scaleApprox :: ra -> ufb -> (ufb, ufb)Source

Multiply a function by an approximation of a scalar, rounding downwards and upwards.

scaleApproxDown :: ra -> ufb -> ufbSource

Multiply a function by an approximation of a scalar, rounding downwards.

scaleApproxUp :: ra -> ufb -> ufbSource

Multiply a function by an approximation of a scalar, rounding upwards.

getDegree :: ufb -> IntSource

Get the degree of this particular function.

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

reduceDegree :: Int -> ufb -> (ufb, ufb)Source

Decrease the degree of function approximation, rounding pointwise downwards and upwards.

reduceDegreeDown :: Int -> ufb -> ufbSource

Decrease the degree of function approximation, rounding pointwise downwards.

reduceDegreeUp :: Int -> ufb -> ufbSource

Decrease the degree of function approximation, rounding pointwise upwards.

integrateSource

Arguments

:: varid

variable to integrate by

-> ufb

p(x)

-> (ufb, ufb) 

Approximate the integral of p (with 0 at 0) from below and from above.

integrateDownSource

Arguments

:: varid

variable to integrate by

-> ufb

p(x)

-> ufb 

Approximate the integral of p (with 0 at 0) from below.

integrateUpSource

Arguments

:: varid

variable to integrate by

-> ufb

p(x)

-> ufb 

Approximate the integral of p (with 0 at 0) from above.

volumeAboveZeroSource

Arguments

:: [varid]

axes to include in the measuring domain

-> ufb 
-> (b, b) 

Measure the volume between a function and the zero hyperplane on the domain [-1,1]^n.

upperBound :: EffortIndex -> ufb -> bSource

Find an upper bound of the function over [-1,1]^n.

lowerBound :: EffortIndex -> ufb -> bSource

Find a lower bound of the function over [-1,1]^n.

nonnegSource

Arguments

:: Int

max degree for result

-> ufb

p(x)

-> (ufb, ufb) 

Approximate the function max(0,p(x)) from below and from above.

recipSource

Arguments

:: Int

max degree for result

-> EffortIndex 
-> ufb

p(x)

-> (ufb, ufb) 

Approximate the function 1/p(x) from below and from above.

recipDown :: Int -> EffortIndex -> ufb -> ufbSource

Approximate the function 1/p(x) from below.

recipUp :: Int -> EffortIndex -> ufb -> ufbSource

Approximate the function 1/p(x) from above.

maxSource

Arguments

:: Int

max degree for result

-> ufb

p_1(x)

-> ufb

p_2(x)

-> (ufb, ufb) 

Approximate the function max(p_1(x),p_2(x)) from below and from above.

maxDownSource

Arguments

:: Int

max degree for result

-> ufb

p_1(x)

-> ufb

p_2(x)

-> ufb 

Approximate the function max(p_1(x),p_2(x)) from below.

maxUpSource

Arguments

:: Int

max degree for result

-> ufb

p_1(x)

-> ufb

p_2(x)

-> ufb 

Approximate the function max(p_1(x),p_2(x)) from above.

minSource

Arguments

:: Int

max degree for result

-> ufb

p_1(x)

-> ufb

p_2(x)

-> (ufb, ufb) 

Approximate the function min(p_1(x),p_2(x)) from below and from above.

minDownSource

Arguments

:: Int

max degree for result

-> ufb

p_1(x)

-> ufb

p_2(x)

-> ufb 

Approximate the function min(p_1(x),p_2(x)) from below.

minUpSource

Arguments

:: Int

max degree for result

-> ufb

p_1(x)

-> ufb

p_2(x)

-> ufb 

Approximate the function min(p_1(x),p_2(x)) from above.

sqrtSource

Arguments

:: Int

max degree for result

-> EffortIndex

how hard to try when approximating exp as a polynomial

-> ufb

p(x)

-> (ufb, ufb) 

Approximate sqrt(p(x)) from below and from above.

expSource

Arguments

:: Int

max degree for result

-> EffortIndex

how hard to try when approximating exp as a polynomial

-> ufb

p(x)

-> (ufb, ufb) 

Approximate exp(p(x)) from below and from above.

logSource

Arguments

:: Int

max degree for result

-> EffortIndex

how hard to try when approximating log as a polynomial

-> ufb

p(x)

-> (ufb, ufb) 

Approximate log(p(x)) from below and from above.

sinSource

Arguments

:: Int

max degree for result

-> EffortIndex

how hard to try when approximating sin as a polynomial

-> ufb

p(x)

-> (ufb, ufb) 

Approximate sin(p(x)) from below and from above.

cosSource

Arguments

:: Int

max degree for result

-> EffortIndex

how hard to try when approximating cos as a polynomial

-> ufb

p(x)

-> (ufb, ufb) 

Approximate cos(p(x)) from below and from above.

eval :: boxb -> ufb -> (b, b)Source

Evaluate at a point, rounding upwards and downwards.

evalDown :: boxb -> ufb -> bSource

Evaluate at a point, rounding downwards.

evalUp :: boxb -> ufb -> bSource

Evaluate at a point, rounding downwards.

evalApprox :: boxra -> ufb -> raSource

Safely evaluate at a point using a real number approximation for both the point and the result.

partialEvalApprox :: boxra -> ufb -> (ufb, ufb)Source

Partially evaluate at a lower-dimensional point given using a real number approximation. Approximate the resulting function from below and from above.

partialEvalApproxDown :: boxra -> ufb -> ufbSource

Partially evaluate at a lower-dimensional point given using a real number approximation. Approximate the resulting function from below.

partialEvalApproxUp :: boxra -> ufb -> ufbSource

Partially evaluate at a lower-dimensional point given using a real number approximation. Approximate the resulting function from above.

composeSource

Arguments

:: Int

max degree for result

-> ufb

function f

-> Map varid ufb

variables to substitute and for each variable v, function f_v to substitute for v that maps [-1,1] into [-1,1]

-> (ufb, ufb)

upper and lower bounds of f[v |-> f_v]

Compose two functions, rounding upwards and downwards provided each f_v ranges within the domain [-1,1].

composeDownSource

Arguments

:: Int

max degree for result

-> ufb

function f1

-> Map varid ufb

variables to substitute and for each variable v, function f_v to substitute for v that maps [-1,1] into [-1,1]

-> ufb

a lower bound of f1.f2

Compose two functions, rounding downwards provided each f_v ranges within the domain [-1,1].

composeUpSource

Arguments

:: Int

max degree for result

-> ufb

function f1

-> Map varid ufb

variables to substitute and for each variable v, function f_v to substitute for v that maps [-1,1] into [-1,1]

-> ufb

an upper bound of f1.f2

Compose two functions, rounding upwards provided each f_v ranges within the domain [-1,1].

raEndpointsSource

Arguments

:: ufb

this parameter is not used except for type checking

-> ra 
-> (b, b) 

Convert from the interval type to the base type. (The types are determined by the given example function.)

raFromEndpointsSource

Arguments

:: ufb

this parameter is not used except for type checking

-> (b, b) 
-> ra 

Convert from the base type to the interval type. (The types are determined by the given example function.)

Instances

(ERRealBase rb, RealFrac rb, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxbb varid rb [(rb, rb)], DomainBoxMappable boxra boxras varid (ERInterval rb) [ERInterval rb], DomainIntBox boxra varid (ERInterval rb)) => ERUnitFnBase boxb boxra varid rb (ERInterval rb) (ERChebPoly box rb)