Re: Re: Function of several variables

• To: mathgroup at smc.vnet.net
• Subject: [mg72198] Re: [mg72132] Re: Function of several variables
• From: "Chris Chiasson" <chris at chiasson.name>
• Date: Thu, 14 Dec 2006 05:49:15 -0500 (EST)
• References: <eljaik\$7dv\$1@smc.vnet.net> <200612131139.GAA23652@smc.vnet.net>

```What is the point of Sequence in the definition of f?

On 12/13/06, Norbert Marxer <marxer at mec.li> wrote:
> Hi Troy
>
> Try this
>
>      f[p:Sequence[Subscript[_, _]...]] := Module[{}, 1/Total[{p}]]
>
> Then
>
>      f[Subscript[x, 1], Subscript[x, 2], Subscript[x, 3]]
>
> will give you the inverted sum
>
> 1/(Subscript[x, 1] + Subscript[x, 2] +  Subscript[x, 3])
>
> Of course you can apply any functions (inside Module) to your
> subscripted indices.
>
> Best Regards
> Norbert Marxer
> www.mec.li
>
>
> tlhiv schrieb:
>
> > I have created a list of variables that I would like to make a function
> > in terms of by
> >
> > M = 4;
> > X = Table[Subscript[x, i], {i, 1, M}]
> >
> > Now I would like to make a function f that is a function of each of
> > these M variables.  If I were manually create this function without
> > taking advantage of iterators, I would do something like
> >
> > f[Subscript[x,1]_,Subscript[x,2]_,Subscript[x,3]_,Subscript[x,4]_] =
> > 1/(Subscript[x,1]+Subscript[x,2]+Subscript[x,3]+Subscript[x,4])
> >
> > However, my plan is to significantly increase M, and therefore I don't
> > want to have to manually define f in this way.  I would like to define
> > it in terms of the elements of X and use the Sum in the function
> > definition.  In the end I'm going to be solving an optimization problem
> > where I try to find the "optimal" choice for these elements of X.  Can
> > someone offer a method for accomplishing this function definition?
> >
> > Thanks,
> >
> > --
> > Troy Henderson
> > Assistant Professor
> > Department of Mathematical Sciences
> > United States Military Academy
> > http://www.tlhiv.org
>
>

--
http://chris.chiasson.name/

```

• Prev by Date: Re: How to plot field lines ?
• Next by Date: WebMathematica problem
• Previous by thread: Re: Function of several variables
• Next by thread: Re: Function of several variables