@@ -1716,8 +1716,9 @@ def __add__(self, other):
17161716 outputs = self .__outputs__ [0 ] + " + " + other .__outputs__ [0 ]
17171717 outputs = "(" + outputs + ")"
17181718 interpolation = self .__interpolation__
1719+ extrapolation = self .__extrapolation__
17191720 # Create new Function object
1720- return Function (source , inputs , outputs , interpolation )
1721+ return Function (source , inputs , outputs , interpolation , extrapolation )
17211722 else :
17221723 return Function (lambda x : (self .get_value (x ) + other (x )))
17231724 # If other is Float except...
@@ -1734,8 +1735,11 @@ def __add__(self, other):
17341735 outputs = self .__outputs__ [0 ] + " + " + str (other )
17351736 outputs = "(" + outputs + ")"
17361737 interpolation = self .__interpolation__
1738+ extrapolation = self .__extrapolation__
17371739 # Create new Function object
1738- return Function (source , inputs , outputs , interpolation )
1740+ return Function (
1741+ source , inputs , outputs , interpolation , extrapolation
1742+ )
17391743 else :
17401744 return Function (lambda x : (self .get_value (x ) + other ))
17411745 # Or if it is just a callable
@@ -1842,8 +1846,9 @@ def __mul__(self, other):
18421846 outputs = self .__outputs__ [0 ] + "*" + other .__outputs__ [0 ]
18431847 outputs = "(" + outputs + ")"
18441848 interpolation = self .__interpolation__
1849+ extrapolation = self .__extrapolation__
18451850 # Create new Function object
1846- return Function (source , inputs , outputs , interpolation )
1851+ return Function (source , inputs , outputs , interpolation , extrapolation )
18471852 else :
18481853 return Function (lambda x : (self .get_value (x ) * other (x )))
18491854 # If other is Float except...
@@ -1860,8 +1865,11 @@ def __mul__(self, other):
18601865 outputs = self .__outputs__ [0 ] + "*" + str (other )
18611866 outputs = "(" + outputs + ")"
18621867 interpolation = self .__interpolation__
1868+ extrapolation = self .__extrapolation__
18631869 # Create new Function object
1864- return Function (source , inputs , outputs , interpolation )
1870+ return Function (
1871+ source , inputs , outputs , interpolation , extrapolation
1872+ )
18651873 else :
18661874 return Function (lambda x : (self .get_value (x ) * other ))
18671875 # Or if it is just a callable
@@ -1927,8 +1935,9 @@ def __truediv__(self, other):
19271935 outputs = self .__outputs__ [0 ] + "/" + other .__outputs__ [0 ]
19281936 outputs = "(" + outputs + ")"
19291937 interpolation = self .__interpolation__
1938+ extrapolation = self .__extrapolation__
19301939 # Create new Function object
1931- return Function (source , inputs , outputs , interpolation )
1940+ return Function (source , inputs , outputs , interpolation , extrapolation )
19321941 else :
19331942 return Function (lambda x : (self .get_value_opt (x ) / other (x )))
19341943 # If other is Float except...
@@ -1945,8 +1954,11 @@ def __truediv__(self, other):
19451954 outputs = self .__outputs__ [0 ] + "/" + str (other )
19461955 outputs = "(" + outputs + ")"
19471956 interpolation = self .__interpolation__
1957+ extrapolation = self .__extrapolation__
19481958 # Create new Function object
1949- return Function (source , inputs , outputs , interpolation )
1959+ return Function (
1960+ source , inputs , outputs , interpolation , extrapolation
1961+ )
19501962 else :
19511963 return Function (lambda x : (self .get_value_opt (x ) / other ))
19521964 # Or if it is just a callable
@@ -1980,8 +1992,9 @@ def __rtruediv__(self, other):
19801992 outputs = str (other ) + "/" + self .__outputs__ [0 ]
19811993 outputs = "(" + outputs + ")"
19821994 interpolation = self .__interpolation__
1995+ extrapolation = self .__extrapolation__
19831996 # Create new Function object
1984- return Function (source , inputs , outputs , interpolation )
1997+ return Function (source , inputs , outputs , interpolation , extrapolation )
19851998 else :
19861999 return Function (lambda x : (other / self .get_value_opt (x )))
19872000 # Or if it is just a callable
@@ -2029,8 +2042,9 @@ def __pow__(self, other):
20292042 outputs = self .__outputs__ [0 ] + "**" + other .__outputs__ [0 ]
20302043 outputs = "(" + outputs + ")"
20312044 interpolation = self .__interpolation__
2045+ extrapolation = self .__extrapolation__
20322046 # Create new Function object
2033- return Function (source , inputs , outputs , interpolation )
2047+ return Function (source , inputs , outputs , interpolation , extrapolation )
20342048 else :
20352049 return Function (lambda x : (self .get_value_opt (x ) ** other (x )))
20362050 # If other is Float except...
@@ -2047,8 +2061,11 @@ def __pow__(self, other):
20472061 outputs = self .__outputs__ [0 ] + "**" + str (other )
20482062 outputs = "(" + outputs + ")"
20492063 interpolation = self .__interpolation__
2064+ extrapolation = self .__extrapolation__
20502065 # Create new Function object
2051- return Function (source , inputs , outputs , interpolation )
2066+ return Function (
2067+ source , inputs , outputs , interpolation , extrapolation
2068+ )
20522069 else :
20532070 return Function (lambda x : (self .get_value (x ) ** other ))
20542071 # Or if it is just a callable
@@ -2082,8 +2099,9 @@ def __rpow__(self, other):
20822099 outputs = str (other ) + "**" + self .__outputs__ [0 ]
20832100 outputs = "(" + outputs + ")"
20842101 interpolation = self .__interpolation__
2102+ extrapolation = self .__extrapolation__
20852103 # Create new Function object
2086- return Function (source , inputs , outputs , interpolation )
2104+ return Function (source , inputs , outputs , interpolation , extrapolation )
20872105 else :
20882106 return Function (lambda x : (other ** self .get_value (x )))
20892107 # Or if it is just a callable
@@ -2323,7 +2341,9 @@ def derivative_function(self):
23232341 outputs = f"d({ self .__outputs__ [0 ]} )/d({ inputs [0 ]} )"
23242342
23252343 # Create new Function object
2326- return Function (source , inputs , outputs , self .__interpolation__ )
2344+ return Function (
2345+ source , inputs , outputs , self .__interpolation__ , self .__extrapolation__
2346+ )
23272347
23282348 def integral_function (self , lower = None , upper = None , datapoints = 100 ):
23292349 """Returns a Function object representing the integral of the Function
@@ -2491,6 +2511,7 @@ def inverse_function(self, approx_func=None, tol=1e-4):
24912511 inputs = self .__outputs__ ,
24922512 outputs = self .__inputs__ ,
24932513 interpolation = self .__interpolation__ ,
2514+ extrapolation = self .__extrapolation__ ,
24942515 )
24952516
24962517 def find_input (self , val , start , tol = 1e-4 ):
0 commit comments