-1
$\begingroup$

How would I go about finding the sum of an alternating series that consist of 1 -1/2 + 1/3 -1/4 + 1/5... to the 8th term using a mathematical formula or is there no formula I can use

$\endgroup$

migrated from mathematica.stackexchange.com Aug 20 '18 at 23:20

This question came from our site for users of Wolfram Mathematica.

  • 2
    $\begingroup$ Is this a question related to the Mathematica programming language or about math? In the second case, this is the wrong forum. $\endgroup$ – Fraccalo Aug 19 '18 at 16:45
1
$\begingroup$

Here is a formula for the nth partial sum:

aharmonic[n_] = Sum[-(-1)^k/k, {k, n}]

(-1)^(1 + n) LerchPhi[-1, 1, 1 + n] + Log[2]

The 8th partial sum:

aharmonic[8]

533/840

Table of the first 10 values:

aharmonic[Range[10]]

{1, 1/2, 5/6, 7/12, 47/60, 37/60, 319/420, 533/840, 1879/2520, 1627/2520}

$\endgroup$
0
$\begingroup$

One method would be to use Table.

Total[Table[If[EvenQ[n], -(1/n), 1/n], {n, 1, 8, 1}]]
$\endgroup$
  • 2
    $\begingroup$ a.k.a. Sum[-(-1)^n/n, {n, 1, 8}]. $\endgroup$ – AccidentalFourierTransform Aug 19 '18 at 17:19
  • $\begingroup$ That's very graceful! $\endgroup$ – Carl Lange Aug 19 '18 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy