Re: Followup quastion: Problem with parallel evaluation of integrals depending on a parameter
- To: mathgroup at smc.vnet.net
- Subject: [mg99926] Re: Followup quastion: Problem with parallel evaluation of integrals depending on a parameter
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 19 May 2009 06:47:20 -0400 (EDT)
On 5/18/09 at 2:31 AM, alan.barhorst at ttu.edu (Alan Barhorst) wrote: >Hello, I am also having problems passing InterpolatingFunction >objects into a function with a module >I am trying (where X[s_]=InterpolatingFunction[...][s] >func[Z_]:=Module[{xx=Z,Y},Y[S_]:=xx[S];....] >Then I try >func[X[S]] >If I try to use Y[.1] in the module, it returns unevaluated. If I >do Y[S]/.S->.1 it returns a number. So somehow I am missing how to >assign the parameter S to the interpolation inside the module. Any >help is appreciated. Perhaps you should post a more complete example. It is very unclear as to what you are trying to do here. If all you are attempting to do is be able to use the interpolating function inside your module, why create the local variables xx and Y and set them to Z, the argument passed to your function? You could simply use Z[.1] where you were trying to use Y[.1]. For example, In[1]:= f = Interpolation[{1, 2, 3, 5, 8, 5}]; In[2]:= test[x_] := Module[{dummy}, Table[x[n], {n, 1, 2, .2}]] In[3]:= test[f] Out[3]= {1.,1.248,1.464,1.656,1.832,2.}