Re: List of local Variables in Module
- To: mathgroup at smc.vnet.net
- Subject: [mg16222] Re: [mg16180] List of local Variables in Module
- From: Carl Woll <carlw at fermi.phys.washington.edu>
- Date: Fri, 5 Mar 1999 00:40:51 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Peter, You can solve the error message about Join not being a list by wrapping Evaluate around your argument list. However, you then run across the problem that a[1], for example, is not a valid symbol. A possibility is to have just a in your local variable list, as in ... Module[{a,z,expr}, ... It's unclear to me what you want your function to do. Why do you want to have a[i] as local variables? What kind of output are you looking to obtain from your function? Carl Woll Dept of Physics U of Washington On Tue, 2 Mar 1999, Peter Breitfeld wrote: > > I want to implement a function like this: > > myFunction[f_,x_,n_Integer]:= > Module[Join[Array[a,n+1,0],{z,expr}], > <<<< some code to construct a polynomial in x of degree n with > coefficients a[0]...a[n] >>>>> > ] > > Now Mathematica complains Join[...] is not a list. > But if I type > > In= Join[Array[a,2,0],{z,expr}]//FullForm > Out=List[a[0],a[1],z,expr] > > It _is_ a List. > > Changing n+1 to a number e.g 20 doesn't change Mathematicas behavior. > > All what helped, was > Module{u=Array[a,n+1,0],z,expr}, ..... > > but now the a[i] are global. > > Is there a way to get what I want? > > > -- > > es gruesst > Peter > -- > =--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--= > Peter Breitfeld, Saulgau, Germany (PGP public key: 08548045) >