0
$\begingroup$

I have tried to take a series of harmonic numbers using Mathematica and its precision but there has been an issue.

So far when I computed the sums at a whole numbers using a precision of 100 digits I get the actual answer:

1 + Sum[(-1)^n*HarmonicNumber[7`100, -2*(2*n + 1)]/(2*n + 1)!, {n, 0, 1000}]
(* Out: -1.868999598223701053846038076059845120154764132531047620125078549115461178796083  *)

However when I take a fractional value of 1.2 with a precision of 100 I get...

1 + Sum[(-1)^n*HarmonicNumber[1.2`100, -2*(2*n + 1)]/(2*n + 1)!, {n, 0, 1000}]
(* Out: 0``-185.11918423420613 *)

Even if I take the precision up to 10000, I get:

1 + Sum[(-1)^n*HarmonicNumber[1.2`10000, -2*(2*n + 1)]/(2*n + 1)!, {n, 0, 1000}]
(* Out: -4.56046017401129109343772345210743626064228....×10^156*)

Why is this the case? Could be that I have used mathemtica beta online? Is there a way of getting the actual answer without taking the precision to millions of digits?

$\endgroup$
1
$\begingroup$

One thing you can do is to use infinite precision numbers rather than finite. For example:

q = Total[(-1)^Range[1000] Table[HarmonicNumber[n], {n, 1000}]]

gives a very long fraction. Taking N[ ] of this gives 3.39641. Taking N[q,1000] gives it to 1000 digits, etc.

| improve this answer | |
$\endgroup$
  • $\begingroup$ So then how do you get that without substituting any number for n? If I wanted to substitute 3.5 into my equation how would that be possible? $\endgroup$ – Arbuja Sep 19 '15 at 14:29
  • $\begingroup$ @Arbuja - Use Rationalize $\endgroup$ – Bob Hanlon Sep 19 '15 at 15:50
  • $\begingroup$ @bill s I tried your technique but it didn't work. I used...... $\endgroup$ – Arbuja Sep 20 '15 at 12:21
  • $\begingroup$ I used q=Total[(-1)^Range[1000] Table[HarmonicNumber[7,-2*(2*n+1)], {n, 1000}]] and got 0``-9339.452026231627 $\endgroup$ – Arbuja Sep 20 '15 at 12:30
  • $\begingroup$ I'm not sure what is going on. When I do q=Total[(-1)^Range[1000] Table[HarmonicNumber[7,-2*(2*n+1)], {n, 1000}]]//N I get a very large number: 1.208301442749174*10^3382 . $\endgroup$ – bill s Sep 20 '15 at 14:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.