Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Some questions about vector

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74554] Re: Some questions about vector
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Mon, 26 Mar 2007 02:03:10 -0500 (EST)

On 3/25/07 at 1:26 AM, qzhang81 at gmail.com (Qi Zhang) wrote:

>input:

>Clear[f];
>f[v] = Sum[(i*v[i]), {i, 1, N}]

I am suprised the code above does anything meaningful

The summand in the code is the product of an index variable i,
and a function v of that variable that is no where defined. And
you have defined i to range from 1 to N which apparently Sum
recognizes as a variable despite the fact Mathematica has a
system object N which converts numeric quantities to machine precision.

You should notice that Sum[(i*v[i]), {i, 1, N}] is returned unevaluated.

And finally you define another function f with argument v (which
you are using to be a function on the rhs) to be the computed sum

>D[f[v], v[i]]

This code will evaluate f[v] to be the evaluated sum above.
Since each term of that sum is i*v[i] the derivative of each
term is i. Hence the result is simply the sum of integers from 1
to N which is what you obtained.

>the output is

>\!\(1\/2\ N\ \((1 + N)\)\)

>However what I expect is i

Why? What were you trying to do?

>What should I do in order to get the the answer I expected?

Most likely the answer is to use appropriate Mathematica syntax
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: notebook as TXT
  • Next by Date: Re: Suggestion for direct commands ParametricPlot22 and ParametricPlot33
  • Previous by thread: Re: Some questions about vector
  • Next by thread: Re: Some questions about vector