       FindMinimum

• To: mathgroup at smc.vnet.net
• Subject: [mg90555] FindMinimum
• From: "pratip chakraborty" <pratip.official at gmail.com>
• Date: Sat, 12 Jul 2008 05:35:34 -0400 (EDT)
• References: <29862167.1215269377863.JavaMail.jakarta@nitrogen.mathforum.org>

```Hi,
I am new in Mathematica and have a problem with "FindMinimum". I want to
minimize a multi variable numerical function it looks like:

MinFun[{a1,a2,...,ak}]

I also have a code for the gradient computation so I want to  use the
gradient option of FindMinimum and supply my gradient function which looks
like:

GradFun[{a1,a2,...,ak}]

Now my problem is in the fact that FindMinimum accepts the cost function and
the supplied gradient if and only if they are of the form:

MinFun[a1,a2,...,ak]
GradFun[a1,a2,...,ak]

But I can not every time write a cost function like:

MinFun[a1_?NumericQ,a2_?NumericQ,...,ak_?NumericQ]
GradFun[a1_?NumericQ,a2_?NumericQ,...,ak_?NumericQ]

because my k can vary among the set of positive integers so I defined my
cost function with modified test for the argument as

MinFun[a_?(VectorQ[#,NumericQ]&)]
GradFun[a_?(VectorQ[#,NumericQ]&)]

But I dont know how to define a function
f[a1_?NumericQ,...,a2000_?NumericQ]:=Block[
{..},
...
]
other than writing so many arguments manualy.
I tried a wraper like
g[{a_}]:=f[a]
But an error occurs saying the shapes dont match.
Hope some one can help me.

Pratip

```

• Prev by Date: Re: running multiple mathkernel's
• Next by Date: Re: Question about diference between Animate and Manipulate
• Previous by thread: Re: Stop iteration iconstructing Table
• Next by thread: Re: FindMinimum