NMaximize an element of a Table

Hi,

Can you tell me what is wrong with it ?

Clear
Ntest[m_?NumericQ] :=
Table[NIntegrate[m*i, {x, 0, 1}], {i, 1, 10}];

AbsoluteTiming[NMaximize[{Ntest[[2]], 500 <= m <= 1500}, {m}]]

I have the following error :

Part::partw: Part 2 of Ntest does not exist. >>
Part::partw: Part 2 of Ntest does not exist. >>
Part::partw: Part 2 of Ntest does not exist. >>
General::stop: Further output of Part::partw will be suppressed during this calculation. >>

I guess the problem comes from ?NumericQ, but I must put it (or the Integrand is non numerical fot NMaximize)

Thank you,
Mich

It looks as though you don’t have an argument for Ntest inside NMaximize. However, copying Mathematica code into a text window can corrupt the code.
I suggest you repost your code in a “spikey” window.

Function arguments are wrapped in one pair of square brackets.
List indices are wrapped in two pairs of square brackets.

You called the function Ntest with two pairs,

AbsoluteTiming[NMaximize[{Ntest[[2]], 500 <= m <= 1500}, {m}]]