# InterpolatingFunction appears to be "Listable"?

**URL:** <https://community.wolfram.com/t/interpolatingfunction-appears-to-be-listable/10581>\
**Category:** Questions\
**Tags:** mathematica\
**Created:** [May 24, 2017, 1:23pm UTC](https://community.wolfram.com/t/interpolatingfunction-appears-to-be-listable/10581 "2017-05-24T13:23:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![henrikschachner](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/henrikschachner/32/32119_2.png) [@henrikschachner](https://community.wolfram.com/u/henrikschachner)\
**Post date:** [May 24, 2017, 1:23pm UTC](https://community.wolfram.com/t/interpolatingfunction-appears-to-be-listable/10581/1 "2017-05-24T13:23:45Z")

</div>

Dear all,

consider an `InterpolatingFunction` depending on more than on variable:

```
ClearAll["Global`*"]
data = RandomReal[{-1, 1}, {10, 10}];
func = ListInterpolation[data, {{0, 1}, {0, 1}}];

```

A regular function call would then be:

```
func[x, y]
(* Out: InterpolatingFunction[{{0.`,1.`},{0.`,1.`}},"<>"][x,y] *)

```

But if I try a `List` as argument (I definitely expected no further evaluation!), I get:

```
func[{x, y}]
(* Out: {InterpolatingFunction[{{0.`,1.`},{0.`,1.`}},"<>"][x], InterpolatingFunction[{{0.`,1.`},{0.`,1.`}},"<>"][y]} *)

```

so, `InterpolatingFunction` seems to have the attribute `Listable`, which one does not find when calling

```
Attributes[InterpolatingFunction]
(* Out: {Protected,ReadProtected} *)

```

Can anybody give me a hint on where I am missing the point? (On a somewhat larger piece of code it took me quite a while tracking that effect down …)

Best regards – Henrik

---

<div class="post-metadata">

**Author:** ![sghuisman](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sghuisman/32/27850_2.png) [@sghuisman](https://community.wolfram.com/u/sghuisman)\
**Post date:** [May 24, 2017, 2:49pm UTC](https://community.wolfram.com/t/interpolatingfunction-appears-to-be-listable/10581/2 "2017-05-24T14:49:13Z")

</div>

If a function does _not_ have an **attribute** listable, it does _not_ mean that it does _not_ accept lists of input (yes those are three negations in a single sentence). But if a function does have it, like e.g. Sin, you can see that the input is transformed into separate calls:

```
Trace[Sin[{1., 2., 3.}]]
{Sin[{1.,2.,3.}],{Sin[1.],Sin[2.],Sin[3.]},{Sin[1.],0.841471},{Sin[2.],0.909297},{Sin[3.],0.14112},{0.841471,0.909297,0.14112}}

```

that ‘splitting’ is courtesy of the listable attribute If you, however, have some _special_ numbers, you see that Sin will not apply the listable attribute:

```
a = {1.0, 2.0, 3.0};
a = Developer`ToPackedArray[a];
Trace[Sin[a]]
{{a,{1.,2.,3.}},Sin[{1.,2.,3.}],{0.841471,0.909297,0.14112}}

```

it will do them 'all at once’ My guess would be that InterpolatingFunction does exactly the same

EDIT:  
To further improve my point, if you remove the Listable attribute from Sin it will still accept lists (it is, though, not a guarantee that all listable functions have this behavior of course):

```
Unprotect[Sin]
SetAttributes[Sin,Listable]
Attributes[Sin]
Trace[Sin[{1.,2.,3.}]]
ClearAttributes[Sin,Listable]
Attributes[Sin]
Trace[Sin[{1.,2.,3.}]]

```

---

<div class="post-metadata">

**Author:** ![henrikschachner](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/henrikschachner/32/32119_2.png) [@henrikschachner](https://community.wolfram.com/u/henrikschachner)\
**Post date:** [May 24, 2017, 8:37pm UTC](https://community.wolfram.com/t/interpolatingfunction-appears-to-be-listable/10581/3 "2017-05-24T20:37:25Z")

</div>

Dear Sander,

thank you for your interesting answer! So the bottom line seems to be: Never use `List` as an argument unless you know for sure how it is going to be evaluated! - OK!

BTW: Your example above

```
Unprotect[Sin];
ClearAttributes[Sin,Listable]
Sin[{1.,2.,3.}]

```

does _not_ evaluate in MM v9, so this behavior is quite “new”.

Best regards – Henrik
