Create a composed functionΒΆ

In this basic example we are going to create a composed function

f\circ g

In [2]:
from __future__ import print_function
import openturns as ot
import math as m
In [3]:
# assume f, g functions
g = ot.SymbolicFunction(['x1', 'x2'],
                        ['x1 + x2','3 * x1 * x2'])
f = ot.SymbolicFunction(['x1', 'x2'], ['2 * x1 - x2'])
In [4]:
# create the composed function
function = ot.ComposedFunction(f, g)
x = [3.0, 4.0]
y = function(x)
print('x=', x, 'y=', y)
x= [3.0, 4.0] y= [-22]