Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: maximum of a series

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114183] Re: maximum of a series
  • From: olfa <olfa.mraihi at yahoo.fr>
  • Date: Fri, 26 Nov 2010 05:29:22 -0500 (EST)
  • References: <iclfdp$lag$1@smc.vnet.net>

On 25 nov, 11:56, Bill Rowe <readn... at sbcglobal.net> wrote:
> On 11/24/10 at 7:00 AM, olfa.mra... at yahoo.fr (olfa) wrote:
>
>
>
>
>
> >On 20 nov, 12:10, Bill Rowe <readn... at sbcglobal.net> wrote:
> >>On 11/19/10 at 5:08 AM, olfa.mra... at yahoo.fr (olfa) wrote:
> >>>how can I represent for example themaximumof the summations
> >>>:sum[a[k],{k,i,j}] where j varies from i to n?
> >>I will take your "represent" as "determine". That is I take your
> >>question to be how to find themaximumof the partial sums that are
> >>(in principle) formed when evaluating
> >>Sum[a[k],{k,i,j}]
> >>If I have this correct, I suggest
> >>Max@Accumulate@Table[a[k], {k,i,j}]
> >>Evaluation of Sum only returns the final sum not any of the
> >>intermediate sums (which Mathematica may not actually compute).
> >>I've used Table to create each of the a[k] terms and Accumulate to
> >>compute the partial sums.
> >what I need exactly is to solve this system for m using reduce,
> >Max[m, s + Max[Table[Sum[a[index2], {index2, i, index1}], {index1,
> >i, N}]]] ==
> >Max[m, t + Max[Table[Sum[a[index2], {index2, j, index1}], {index1,
> >j, N}]]]
> >but I have the error: iterator in Table does not have appropriate
> >bounds
>
> You cannot use N as themaximumvalue for Table. N has built in
> meaning and cannot be used as a symbol taking a numeric value.
> Try replacing N with a lower case n and see if this fixes the
> problem. You would be well advised to never use an uppercase
> letters as a variable name. Even better, don't have any
> variable/symbol/function you create start with an uppercase
> letter. This will ensure conflicts with built in objects cannot
> occur since the names of all built-in objects start with an
> uppercase letter.
>
> Additionally, your code is inefficient. It repeatedly computes
> partial sums. With valid values for index1 and the upper limit
> n, your code
>
> Table[Sum[a[index2], {index2, i, index1}], {index1, i, n}]
>
> can be replaced with
>
> Accumulate@Table[a[index2], {index2, i, n}]
>
> or even better if a is a function with the attribute listable
>
> Accumulate[a[Range[i,n]]
>
> Here, I make the assumption a[n] is what Mathematica interprets
> it to be, i.e., the function a evaluated at n.- Masquer le texte des mess=
ages pr=E9c=E9dents -
>
> - Afficher le texte des messages pr=E9c=E9dents -

It doesn't work I still have the error iterator in Table does not have
appropriate
bounds
. I need i and n symbolically (without knowing their values)
is there a solution for that?
Thanks


  • Prev by Date: Re: disappointing CUDA speed
  • Next by Date: Re: Finding a function that makes it possible to
  • Previous by thread: Re: maximum of a series
  • Next by thread: Re: maximum of a series