File size: 784 Bytes
9af7384 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
"""File containing polynomials supported by Trend interpolation
Class.
"""
def _create_polynomial(order):
if order is None: # custom function by the user
return None
elif order == 0:
def func(X, a):
return a
elif order == 1:
def func(X, a, b, c):
x1, x2 = X
return a + b * x1 + c * x2
elif order == 2:
def func(X, a, b, c, d, e, f):
x1, x2 = X
return (
a
+ b * x1
+ c * x2
+ d * (x1**2)
+ e * (x1**2)
+ f * x1 * x2
)
else:
raise NotImplementedError(
f"{order} order polynomial needs to be defined manually"
)
return func
|