Author |
Message |
zero-impact
|
Posted: Thu Nov 26, 2009 4:35 pm Post subject: Another Math Question |
|
|
Hey guys, I need math help again.
I need an easy way to calculate Harmonic Numbers and after some research I found the above equation.
where γ is the Euler?Mascheroni constant and εk approaches 0 as k goes to infinity.
It work well for large values (such as 2000) if I ignore the εk. But for small ones it is a bit off (which is why the εk is there I assume). My problem is I'm not sure what value to set for εk for any k.
This is personal interest stuff so don't worry that you are doing my homework or anything. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
A.J
|
Posted: Thu Nov 26, 2009 7:11 pm Post subject: RE:Another Math Question |
|
|
Well, all that is saying is that the limit (ln(n) - H(n) + Euler?Mascheroni] = 0, where H(n) is the nth harmonic number.
In other words, the two sides are never equal, although they get closer as n tends to infinity.
And no integral or sum (finite or infinite) can be considered a closed form for the harmonic numbers. |
|
|
|
|
|
Brightguy
|
Posted: Thu Nov 26, 2009 8:14 pm Post subject: Re: Another Math Question |
|
|
The Wikipedia page gives the expansion:
H_n = ln(n) + γ + 1/(2n) - 1/(12n^2) + 1/(120n^4)
This over-estimates H_n by no more than 1/(252n^6) (via The Art of Computer Programming). |
|
|
|
|
|
A.J
|
Posted: Thu Nov 26, 2009 8:27 pm Post subject: RE:Another Math Question |
|
|
The 'ek' is just the amount it is off by the actual value (an epsilon). Once again, all these are merely estimates. There is no closed function for the harmonic numbers. |
|
|
|
|
|
zero-impact
|
Posted: Thu Nov 26, 2009 8:58 pm Post subject: RE:Another Math Question |
|
|
Thanks, that makes perfect sense For my purposes it makes almost no difference after n becomes bigger than 5 anyways. |
|
|
|
|
|
A.J
|
Posted: Thu Nov 26, 2009 9:30 pm Post subject: RE:Another Math Question |
|
|
Oh, then manually compute the values... |
|
|
|
|
|
zero-impact
|
Posted: Thu Nov 26, 2009 10:14 pm Post subject: RE:Another Math Question |
|
|
No, what I'm using it for is really only useful at larger values. I really don't feel like summing 1/1+1/2+1/3+...+1/998+1/999+1/1000
|
|
|
|
|
|
bbi5291
|
Posted: Fri Nov 27, 2009 12:05 am Post subject: Re: Another Math Question |
|
|
That's what computers are for. You know how to code; now apply it. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
A.J
|
Posted: Fri Nov 27, 2009 12:19 pm Post subject: RE:Another Math Question |
|
|
long double sum = 0;
for (int i = 1; i < 1001; i++)
sum += (long double)1/i; |
|
|
|
|
|
zero-impact
|
Posted: Sat Nov 28, 2009 10:49 pm Post subject: RE:Another Math Question |
|
|
yes, of course I do. But that's not the point. Thanks for the help anyways guys! |
|
|
|
|
|
qmanjr5
|
Posted: Tue Dec 01, 2009 8:21 pm Post subject: RE:Another Math Question |
|
|
D:
e=mcsquared? |
|
|
|
|
|
A.J
|
Posted: Wed Dec 02, 2009 1:57 pm Post subject: RE:Another Math Question |
|
|
er...qmankr5, just trying to get your # of posts up, I am assuming. |
|
|
|
|
|
|