Just to clarify: when I did this test, I think I misunderstood the question: I thought they expected 148.41** .But I don't think it's sensible (nor very clever) to ask for a such accuracy, I think the idea was just to show that you can come up quickly with a rough approximation of e^5.I believe the expected answer was 14*.** (or 15*.** depending how you round it), so actually it was probably "digits" as I originally wrote it and not "decimal places".In that case, I showed that 2.70<e<2.73 and it implies that 145<e<153 (and no, exp(1) wasn't given).As far as I'm concerned, I'm finished with this problem.Thanks to everyone for having spent more than 5mins on this one

Last edited by Peniel on September 24th, 2010, 10:00 pm, edited 1 time in total.

That was with a well-known American bank in London.No, I didn't get the job, so I'm still looking...

- eugenek2010
**Posts:**34**Joined:**

You can get e^5~148 with sub-1% accuracy without pen and paper if you remember that ln(2)~0.693. Try it.

Last edited by eugenek2010 on September 22nd, 2010, 10:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**61154**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: eugenek2010You can get e^5~148 with sub-1% accuracy without pen and paper if you remember that ln(2)~0.693. Try it.I think I am missing the association between exp(5) and log(2)

http://www.datasimfinancial.com

http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself

Jean Piaget

http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself

Jean Piaget

Thanks for the tip, eugenek2010If I understand it correctly, we can start with the approximation ln(2) ~ 0.7, and we multiply it by 7, so ln(2^7) ~ 4.9. 4.9 is pretty close to 5, so we are almost there. Now to improve the accuracy, we say ln(2) ~ 0.693 = 0.7 - 0.007; if we multiply by 7 we get 4.9 - 0.049, which is about 4.85. Now we know with 2 decimal places that ln(128) ~ 4.85 = 5-0.15 From here we get that exp(5) ~ exp(0.15) *128I guess that's the way to do the range reduction that somebody mentioned in this thread. Since 0.15 is quite small, we get a very good approximation of exp(0.15) using Taylor: 1 + 0.15 + 0.15^2/2 + ... = 1.15 + 0.01125 + ... ~ 1.16. The only thing left to do is to multiply 128 with 1.16. Now both 128 and 16 are powers of 2, their product is 2^11 which some people remember by hart to be 2048. We add 20.48 to 128 and we get 148.48, which is darn close to the exact value of 148.41. Best,V.

This is a variant of the first answer in the thread (though at least 1 pen and some paper is needed). If done & coded with some care it is a highly accurateway on binary systems, both w.r.t. absolute and relative errors (and that reduction can be found already in old papers of Brent), especially in IEEE754.

e=2.7 Ibsen Ibsen. (Ibsen was born in 1828, e = 2.718281828...)

- Cuchulainn
**Posts:**61154**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: outrunCuchulainn is currently trying to do it with Padé approximations But first, I think I need the desired tolerance.

http://www.datasimfinancial.com

http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself

Jean Piaget

http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself

Jean Piaget

- Cuchulainn
**Posts:**61154**Joined:****Location:**Amsterdam-
**Contact:**

QuoteZero tolerance! I now calculate exp(5) only knowing R(1,1)(z) = (1+z/2)/(1-z/2) and the fact that 5 = N * fraction, exp(5) = (exp(fraction))^N. The part inside the brackets I use R(1,1).In general the accuracy of R(1,1)(z) is O(z^3).N;fraction; value10; 1/2; 165.38220; 1/4; 152.36625; 1/5; 150.92350; 1/10; 149.034..500; 1/100; EXACT These 19th century Pade guys were good quants.

Last edited by Cuchulainn on October 18th, 2010, 10:00 pm, edited 1 time in total.

http://www.datasimfinancial.com

http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself

Jean Piaget

http://www.datasim.nl

Every Time We Teach a Child Something, We Keep Him from Inventing It Himself

Jean Piaget

a curious approximation of e^5 to 10 digits: e^5 ~ 150 - (87^3 + 12^5) / 83^3.(btw, the original paper was devoted mostly to pi - just read the title. somehow e has never attracted as much attention as pi in popular mathematics, which seems quite "unfair". there are people memorizing pi to 60,000 digits but no one seems to be interested doing so for e)also mathematica has an implementation of approximating any number (e.g., transcendental numbers) by a "simple" algebraic number one specifies. the underlying algorithm seems to be LLL algorithm

Last edited by wileysw on October 30th, 2010, 10:00 pm, edited 1 time in total.

GZIP: On