Value function

A value function f_{value}: \mathcal{D} \times \mathbb{R}^d \rightarrow \mathcal{D} \times \mathbb{R}^q is a particular field function that lets invariant the mesh of a field and defined by a function g : \mathbb{R}^d \rightarrow \mathbb{R}^q such that:

\begin{aligned} f_{value}(\underline{t}, \underline{x})=(\underline{t}, g(\underline{x}))\end{aligned}

Let’s note that the input dimension of f_{value} still designs the dimension of \underline{x} : d. Its output dimension is equal to q.

The creation of the ValueFunction object requires the function g and the integer n: the dimension of the vertices of the mesh \mathcal{M}. This data is required for tests on the compatibility of dimension when a composite process is created using the spatial function.

The use case illustrates the creation of a spatial (field) function from the function g: \mathbb{R}^2 \rightarrow \mathbb{R}^2 such as :

\begin{aligned}
  g(\underline{x})=(x_1^2, x_1+x_2)\end{aligned}

[1]:
from __future__ import print_function
import openturns as ot
import math as m
[2]:
# Create a mesh
N = 100
mesh = ot.RegularGrid(0.0, 1.0, N)
[3]:
# Create the function that acts the values of the mesh
g = ot.SymbolicFunction(['x1', 'x2'],  ['x1^2', 'x1+x2'])
[4]:
# Create the field function
f = ot.ValueFunction(g, mesh)
[5]:
# Evaluate f
inF = ot.Normal(2).getSample(N)
outF = f(inF)

# print input/output at first mesh nodes
xy = inF
xy.stack(outF)
xy[:5]
[5]:
X0X1y0y1
00.6082016512187646-1.26617310221665670.3699092485452318-0.6579714509978921
1-0.438265619960413971.20547820082857560.1920767536392860.7672125808681616
2-2.18138523461651430.35004208653029074.758441541802945-1.8313431480862237
3-0.35500704918563971.4372493101409030.12603000497149521.0822422609552633
40.81066798246948370.793156011459770.65718257780114311.6038239939292538