Create a Domain with Bounds#

import minterpy as mp
import numpy as np

Approximating a function \(f: \Omega \rightarrow \mathbb{R}\) where \(\Omega\) is a custom hyper-rectangular domain in Minterpy involves constructing an (interpolating) polynomial \(Q\) such that:

\[ f(\boldsymbol{x}) \approx Q \circ \mathcal{T} (\boldsymbol{x}), \]

where \(Q: [-1, 1]^m \rightarrow \mathbb{R}\) is the polynomial defined on the internal (reference) domain and \(\mathcal{T}\) is the affine separable transformation from \(\Omega\) to \([-1, 1]^m\). Both the user-defined domain and the internal domain are encapsulated in the Domain class.

An instance of Domain can be constructed via different constructors:

In this guide, you will construct a Domain instance using the default constructor.

About the default constructor#

The default constructor returns an instance of Domain based on a given set of bounds for each spatial dimension. Specifically, it accepts the bounds as a two-dimensional array of shape (m, 2) where m is the number of dimensions. Each row of the array corresponds to the interval of a dimension defined by the lower and upper bounds. The bounds must be finite real numbers with the lower bound strictly smaller than the upper bound.

Example: Two-dimensional rectangular domain#

Create a two-dimensional rectangular domain that corresponds to:

\[ \Omega = [0.0, 5.0] \times [10.0, 15.0] \]

Bounds#

The rectangular domain is defined by two bounds (intervals) one for each dimension. We can specify them in a single two-dimensional array of two rows:

bounds = np.array([
    [0.0, 5.0],
    [10.0, 15.0],
])

Domain instance#

An instance of Domain given an array of bounds can be constructed using the default constructor:

dom = mp.Domain(bounds)

Spatial dimension#

We can verify that the domain is two dimensional:

print(dom.spatial_dimension)
2

and with the appropriate bounds:

print(dom.bounds)
[[ 0.  5.]
 [10. 15.]]

Uniform domain#

A domain is a uniform domain if it has identical bounds across all dimensions (\([a, b]^m\)). This can be verified for the current instance using the following property:

dom.is_uniform
False

Identity domain#

A domain is an identity domain if the user-defined bounds match the internal reference domain (\([-1, 1]^m\)). This can be verified for the current instance using the following property:

dom.is_identity
False