       Re: Symbolic summation

• To: mathgroup at smc.vnet.net
• Subject: [mg101627] Re: [mg101561] Symbolic summation
• From: DrMajorBob <btreat1 at austin.rr.com>
• Date: Fri, 10 Jul 2009 23:28:09 -0400 (EDT)
• References: <200907101044.GAA15502@smc.vnet.net>

```I'd use something like

n = 10;
Array[x, n]

{x, x, x, x, x, x, x, x, x, x}

If you prefer subscripts (I don't), you could use

Array[Subscript[x, #] &, n]

{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], \
Subscript[x, 5], Subscript[x, 6], Subscript[x, 7], Subscript[x, 8], \
Subscript[x, 9], Subscript[x, 10]}

or

Table[Subscript[x, i], {i, 1, n}]

{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], \
Subscript[x, 5], Subscript[x, 6], Subscript[x, 7], Subscript[x, 8], \
Subscript[x, 9], Subscript[x, 10]}

If you want a bit of both worlds, you can use "subFunction" as follows:

subFunction[
a_Symbol] := (MakeExpression[SubscriptBox[ToString@a, i_], f_] :=
MakeExpression[RowBox[{ToString@a, "[", i, "]"}]];
MakeBoxes[a[i_], f_] :=
SubscriptBox[MakeBoxes[a, f], MakeBoxes[i, f]])

subFunction[x]
n = 10;
Array[x, n]

{Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], Subscript[x, 4], \
Subscript[x, 5], Subscript[x, 6], Subscript[x, 7], Subscript[x, 8], \
Subscript[x, 9], Subscript[x, 10]}

and then, for instance,

x = 10
Array[x, n]

10

{Subscript[x, 1], Subscript[x, 2], 10, Subscript[x, 4], Subscript[x, \
5], Subscript[x, 6], Subscript[x, 7], Subscript[x, 8], Subscript[x, \
9], Subscript[x, 10]}

or

Clear[x]
x[x_?EvenQ] := "Even"
Array[x, n]

{Subscript[x, 1], "Even", Subscript[x, 3], "Even", Subscript[x, 5], \
"Even", Subscript[x, 7], "Even", Subscript[x, 9], "Even"}

subFunction[x] causes x[k] to display subscripted unless/until it takes on
a value.

Bobby

On Fri, 10 Jul 2009 05:44:41 -0500, Luca <Lucazanottifragonara at alice.it>
wrote:

> Hello all, I have a problem, I've to compute a symbolic summation, which
> takes a very long time if I have to do it by hand. I have to write the
> terms of the Volterra series, related to the associated linear equation
> of a system.
>
> The problem is that I'm not really confident with mathematica, I've
> tried to use symbolic calculations with sums, but I think that in my
> case is not so easy.
>
> The problem is that I want a solution of this form:
>
> x1+x2+x3+x4+x5...
>
> Where the 1, 2, 3 and 4 and 5 are the summation subscripts...
>
> My summation is not infinite, I have to stop it.
>
> If I write something like this:
>
> n = 3;
>
> Sum[kl, {l, 2, n}]
>
> I obtain 2kl, instead I want to obtain k2+k3.
>
> Is it possible with mathematica?
>

--
DrMajorBob at bigfoot.com

```

• Prev by Date: Re: Add syntax highlighting to own command
• Next by Date: Re: Symbolic summation
• Previous by thread: Re: Symbolic summation
• Next by thread: Re: Symbolic summation