Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Mathematica 8 does not like Sum[1/k,{k,n,10}]

62 views
Skip to first unread message

valvola

unread,
May 12, 2013, 3:28:39 AM5/12/13
to
Apparently, Mathematica 8 does not like the simple expression:

Clear[k,n]; Sum[1/k,{k,n,8}]

The result is two errors:
Power::infy: "Infinite expression 1/0 encountered."

and a large expression
DifferenceRoot[
Function[{\[FormalY], \[FormalN]}, {\[FormalN] \
\[FormalY][\[FormalN]] + .... etc.etc.

By the way, the similar Sum[1/k, {k, 8, n}] works fine.

????
g.

Bob Hanlon

unread,
May 13, 2013, 3:48:08 AM5/13/13
to

Without giving n a specific value in your definition, Mathematica has no
way of knowing that you intend n to be an integer in the range [1, 8].


$Version


"8.0 for Mac OS X x86 (64-bit) (October 5, 2011)"


f1[n_Integer?(0 < # < 9 &)] :=
Sum[1/k, {k, n, 8}]


f2[n_Integer?(0 < # < 9 &)] :=
Sum[1/k, {k, 8, n, -1}]


Table[f1[n] == f2[n] == Sum[1/k, {k, n, 8}], {n, 0, 9}] // Quiet


{f1[0] == f2[0] ==
ComplexInfinity, True, True, True, True, True, True, True, True,
f1[9] == f2[9] == 0}



Bob Hanlon

Murray Eisenberg

unread,
May 13, 2013, 3:48:19 AM5/13/13
to
Perhaps you want:

Sum[1/k, {k, n, 8, -1}]

On May 12, 2013, at 3:29 AM, valvola <g.r...@iit.cnr.it> wrote:

> Apparently, Mathematica 8 does not like the simple expression:
>
> Clear[k,n]; Sum[1/k,{k,n,8}]
>
> The result is two errors:
> Power::infy: "Infinite expression 1/0 encountered."
>
> and a large expression
> DifferenceRoot[
> Function[{\[FormalY], \[FormalN]}, {\[FormalN] \
> \[FormalY][\[FormalN]] + .... etc.etc.
>
> By the way, the similar Sum[1/k, {k, 8, n}] works fine.
>
> ????
> g.

---
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2838 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305






Bob Hanlon

unread,
May 14, 2013, 3:15:10 AM5/14/13
to

Alternatively,


$Version


"8.0 for Mac OS X x86 (64-bit) (October 5, 2011)"


Clear[f]


f[n_Integer?(0 < # < 9 &)] = Sum[1/k, {k, 8}] - Sum[1/k, {k, n - 1}]


761/280 - HarmonicNumber[-1 + n]


Table[f[n] == Sum[1/k, {k, n, 8}], {n, 0, 9}] // Quiet


{f[0] == ComplexInfinity, True, True, True, True, True, True, True, True,
f[9] == 0}



Bob Hanlon


On Mon, May 13, 2013 at 3:48 AM, Bob Hanlon <hanlo...@gmail.com> wrote:

>
> Without giving n a specific value in your definition, Mathematica has no
> way of knowing that you intend n to be an integer in the range [1, 8].
>
>
> $Version
>
>
> "8.0 for Mac OS X x86 (64-bit) (October 5, 2011)"
>
>
> f1[n_Integer?(0 < # < 9 &)] :=
> Sum[1/k, {k, n, 8}]
>
>
> f2[n_Integer?(0 < # < 9 &)] :=
> Sum[1/k, {k, 8, n, -1}]
>
>
> Table[f1[n] == f2[n] == Sum[1/k, {k, n, 8}], {n, 0, 9}] // Quiet
>
>
> {f1[0] == f2[0] ==
> ComplexInfinity, True, True, True, True, True, True, True, True,
> f1[9] == f2[9] == 0}
>
>
>
> Bob Hanlon
>
>
>
>
0 new messages