MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Partial evaluation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg21331] Re: Partial evaluation
  • From: William Knox <bknox at snet.net>
  • Date: Fri, 24 Dec 1999 03:42:33 -0500 (EST)
  • References: <8320dg$glm@smc.vnet.net> <83pc1e$nhl$3@dragonfly.wolfram.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Kevin,

Another way would be to abandon using an array, A, of dimensions n_1 x n_2 x
... x n_k.  Use instead a symbolic, functional representation, a, defined on
sequences of integers by
    a[n__Integer]  := Part[A, n] (* where A is the array of data you are asking
about *).

Function to compute new values would work as in this fragment:
 foo[fun_, otherArguements__] :=
         ......
         ......

         foo[1,1] = 2;
           ......

Evaluating foo[a, otherArgs] will change the value returned/stored in a[1,1]

To store the result of various operations back in A, do

 A = Array[ a[i1_, i2_, i3_, ...], {n1,n2, ...}];


Example:

In[1]:= A =Array[( 10#2 +#1)&,{2 ,3}]

Out[1]= {{11,21,31},{12,22,32}}

In[2]:= a[n__Integer]  := Part[A, n]

(* show equivalent *)

In[3]:= Array[a,{2 ,3}]

Out[3]= {{11,21,31},{12,22,32}}

In[4]:= (* modify a *)

In[4]:= a[1,1]= 0; a[2,3]= -a[1,2];

(* matrix of new values of a *)

In[5]:= Array[a,{2 ,3}]

Out[5]= {{0,21,31},{12,22,-21}}

    Regards, Bill Knox


>



  • Prev by Date: Re: Re: serie of random number
  • Next by Date: Re: DiracDelta Function question
  • Previous by thread: Re: Partial evaluation
  • Next by thread: Re: Sending test to COM1 under win98 from Mathematica