Hi,

Is it possible to create a PythonFunction without the function returning a list?

This does not work:

def func(x):
    f = 0.
    for i in range(2):
        f += np.sin(x[i]) * np.sin((i + 1) * x[i]** 2 / np.pi) ** (2 * 10)

    return -f

f = ot.PythonFunction(2, 1, func)


This works:

def func(x):
    f = 0.
    for i in range(2):
        f += np.sin(x[i]) * np.sin((i + 1) * x[i]** 2 / np.pi) ** (2 * 10)

    return [-f]

f = ot.PythonFunction(2, 1, nunc)

Thanks,

Pamphile ROY
_______________________________________________
OpenTURNS users mailing list
[email protected]
http://openturns.org/mailman/listinfo/users

Reply via email to