Re: List of function-heads
- To: mathgroup at smc.vnet.net
- Subject: [mg17105] Re: [mg17068] List of function-heads
- From: "Mark E. Harder" <harderm at ucs.orst.edu>
- Date: Sat, 17 Apr 1999 03:35:04 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Peter;
The following seems to work. The second statement uses SetDelay to
define the list of functions (a transformation from R^2 to R^1) that are
represented by the symbol f, so the functions in f, (a[1][x_],a[2][x_]), do
not overwrite f. Then whenever x is assigned a value, f can be evaluated.
The last statement verifies that the value of x can be changed, but the
definition of the transformation remains {x^2,x-1}. One difference between
and the single-statement function definition is that x is NOT a dummy
variable, i.e. the values given to the transformation must be called "x" in
order to work. O.K?
In[33]:= fl=Table[a[i][x_],{i,2} ]
Out[33]= {a[1][x_],a[2][x_]}
In[36]:= x=2; fl
Out[36]= {4,1}
In[39]:= x=3; fl
Out[39]= {9,2}
mark e. harder
harderm at ucs.orst.edu
-----Original Message-----
From: Peter Breitfeld <phbrf at t-online.de>
To: mathgroup at smc.vnet.net
Subject: [mg17105] [mg17068] List of function-heads
>I want to create a List of function-heads like this:
>{a[1][x_],a[2][x_],...,a[n][x_]}
>(to keep this message short I'll use n=2 in the following) to assign
>these to a list of Functions, e.g
>
>{a[1][x_],a[2][x_]}={x^2,x-1}
>
>I can do that with the following command:
>
>In[1]:=fl=Table[a[i][x_],{i,2}]
>Out[1]={{a[1][x_],a[2][x_]}
>
>But then I can't write:
>
>ll={x^2,x-1}
>
>because now the a[i] are overwritten and not assosiated with the
>elements of the rhs.
>
>Is there a way to get it working? I tried Thread, MapThread and some
>more but didn't find a solution.
>
>TIA
>
>Es gruesst Peter
>--
>=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
> Peter Breitfeld, Saulgau, Germany PGP public key: 08548045
>