@@ -2230,20 +2230,16 @@ def findInput(self, val):
2230
2230
lambda x : np .abs (self .getValue (x ) - val ), 0 , ftol = 1e-6 , disp = False
2231
2231
)
2232
2232
2233
- def compose (self , func , lower = None , upper = None , datapoints = 100 ):
2233
+ def compose (self , func ):
2234
2234
"""
2235
- Returns a Function object which is the result of inputing a function into a
2236
- function (i.e. f(g(x))). The domain will become the domain of the input function
2237
- and the range will become the range of the original function.
2235
+ Returns a Function object which is the result of inputing a function into a function
2236
+ (i.e. f(g(x))). The domain will become the domain of the input function and the range
2237
+ will become the range of the original function.
2238
2238
2239
2239
Parameters
2240
2240
----------
2241
2241
func : Function
2242
2242
The function to be inputed into the function.
2243
- lower : float
2244
- Lower limit of the new domain.
2245
- upper : float
2246
- Upper limit of the new domain.
2247
2243
2248
2244
Returns
2249
2245
-------
@@ -2254,45 +2250,8 @@ def compose(self, func, lower=None, upper=None, datapoints=100):
2254
2250
if not isinstance (func , Function ):
2255
2251
raise TypeError ("Input must be a Function object." )
2256
2252
2257
- # Checks to make sure lower bound is given
2258
- # If not it will start at the higher of the two lower bounds
2259
- if lower is None :
2260
- if isinstance (self .source , np .ndarray ):
2261
- lower = self .source [0 , 0 ]
2262
- if isinstance (func .source , np .ndarray ):
2263
- lower = (
2264
- func .source [0 , 0 ]
2265
- if lower is None
2266
- else max (lower , func .source [0 , 0 ])
2267
- )
2268
- if lower is None :
2269
- raise ValueError (
2270
- "If Functions.source is a <class 'function'>, must provide bounds"
2271
- )
2272
-
2273
- # Checks to make sure upper bound is given
2274
- # If not it will end at the lower of the two upper bounds
2275
- if upper is None :
2276
- if isinstance (self .source , np .ndarray ):
2277
- upper = self .source [- 1 , 0 ]
2278
- if isinstance (func .source , np .ndarray ):
2279
- upper = (
2280
- func .source [- 1 , 0 ]
2281
- if upper is None
2282
- else min (upper , func .source [- 1 , 0 ])
2283
- )
2284
- if upper is None :
2285
- raise ValueError (
2286
- "If Functions.source is a <class 'function'>, must provide bounds"
2287
- )
2288
-
2289
- # Create a new Function object
2290
- xData = np .linspace (lower , upper , datapoints )
2291
- yData = np .zeros (datapoints )
2292
- for i in range (datapoints ):
2293
- yData [i ] = self .getValue (func .getValue (xData [i ]))
2294
2253
return Function (
2295
- np . concatenate (([ xData ], [ yData ])). T ,
2254
+ lambda x : self ( func ( x )) ,
2296
2255
inputs = func .__inputs__ ,
2297
2256
outputs = self .__outputs__ ,
2298
2257
interpolation = self .__interpolation__ ,
0 commit comments