Create a Domain with Internal 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 factory method Domain.identity().

About the factory method identity()#

The factory method Domain.identity() constructs a Domain instance with bounds corresponds to the internal domain (currently \([-1, 1]^m\)), given a spatial dimension m.

Example: Three-dimensional rectangular domain#

Create a three-dimensional rectangular domain that corresponds to:

\[ \Omega = [-1.0, 1.0]^3 \]

Domain instance#

An instance of Domain with bounds identical to the internal domain can be constructed using the factory method:

spatial_dimension = 3
dom = mp.Domain.identity(spatial_dimension)

Spatial dimension#

We can verify that the domain is three dimensional:

print(dom.spatial_dimension)
3

and with the appropriate bounds:

print(dom.bounds)
[[-1.  1.]
 [-1.  1.]
 [-1.  1.]]

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
True

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
True

Note

An identity domain (currently \([-1, 1]^m\)) is by construction a uniform domain.