SERVING THE QUANTITATIVE FINANCE COMMUNITY

Cuchulainn
Posts: 63251
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = $e^5$

QuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: bluetrinThis property:http://en.wikipedia.org/wiki/Associativ ... ssociative? Is it useful?Not for computers (it doesn't hold for floats, doubles, etc.)Yes.Floats form a groupoid but not a semigroup (== associative groupoid). And groupoid inverses are not necessarily unique...Mathematically, you can say that groupoids have very little structure.// BTW is a + b = b + a true for floats?
Last edited by Cuchulainn on May 2nd, 2013, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl

Posts: 23951
Joined: September 20th, 2002, 8:30 pm

exp(5) = $e^5$

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: bluetrinThis property:http://en.wikipedia.org/wiki/Associativ ... ssociative? Is it useful?Not for computers (it doesn't hold for floats, doubles, etc.)Yes.Floats form a groupoid but not a semigroup (== associative groupoid). And groupoid inverses are not necessarily unique...Mathematically, you can say that groupoids have very little structure.// BTW is a + b = b + a true for floats? I would have said that addition is commutative for floats (and doubles) until you raised the issue of guard digits. I don't know the architecture of modern CPU ALUs and registers well enough to know what happens if one does math to a number that's the result of prior math operation rather than pulled from memory. I'd assume that the two entry points into the ALU are symmetrical, but if there's a short-cut that can take the output of the ALU and make in the input for the next calculation, then it may make a difference and break commutativity.

Cuchulainn
Posts: 63251
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = $e^5$

QuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: bluetrinThis property:http://en.wikipedia.org/wiki/Associativ ... ssociative? Is it useful?Not for computers (it doesn't hold for floats, doubles, etc.)Yes.Floats form a groupoid but not a semigroup (== associative groupoid). And groupoid inverses are not necessarily unique...Mathematically, you can say that groupoids have very little structure.// BTW is a + b = b + a true for floats? I would have said that addition is commutative for floats (and doubles) until you raised the issue of guard digits. I don't know the architecture of modern CPU ALUs and registers well enough to know what happens if one does math to a number that's the result of prior math operation rather than pulled from memory. I'd assume that the two entry points into the ALU are symmetrical, but if there's a short-cut that can take the output of the ALU and make in the input for the next calculation, then it may make a difference and break commutativity.I suppose commutativity will have the same issues as associativity, especilly if the compiler is producing intermediate results. Then it will not be an Abelian groupoid, which is kind of worrying.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl

Posts: 23951
Joined: September 20th, 2002, 8:30 pm

exp(5) = $e^5$

QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: bluetrinThis property:http://en.wikipedia.org/wiki/Associativ ... ssociative? Is it useful?Not for computers (it doesn't hold for floats, doubles, etc.)Yes.Floats form a groupoid but not a semigroup (== associative groupoid). And groupoid inverses are not necessarily unique...Mathematically, you can say that groupoids have very little structure.// BTW is a + b = b + a true for floats? I would have said that addition is commutative for floats (and doubles) until you raised the issue of guard digits. I don't know the architecture of modern CPU ALUs and registers well enough to know what happens if one does math to a number that's the result of prior math operation rather than pulled from memory. I'd assume that the two entry points into the ALU are symmetrical, but if there's a short-cut that can take the output of the ALU and make in the input for the next calculation, then it may make a difference and break commutativity.I suppose commutativity will have the same issues as associativity, especilly if the compiler is producing intermediate results. Then it will not be an Abelian groupoid, which is kind of worrying.Associativity and commutativity have different kinds of issues because violations occur in different layers. Associativity cannot be true for any finite-digit floating point representation on any hardware implementation. In contrast, commutativity can always be true on any finite-digit floating point representation but might possibly fail in some hardware implementations.

Cuchulainn
Posts: 63251
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = $e^5$

WHO CHANGED THE TITLE?????????????????????????????????
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl

DevonFangs
Posts: 3004
Joined: November 9th, 2009, 1:49 pm

exp(5) = $e^5$

QuoteOriginally posted by: CuchulainnWHO CHANGED THE TITLE?????????????????????????????????Admin showing off with their new amazing latex support?$\mathrm{e}^{\mathrm{i}\pi}=-1$

Peniel
Topic Author
Posts: 59
Joined: April 8th, 2006, 9:46 am

exp(5) = $e^5$

Funny, I haven't done anything and it looks like the title is "locked".Sorry Cuchulainn, I can't do much for you.

rmax
Posts: 6080
Joined: December 8th, 2005, 9:31 am

exp(5) = $e^5$

Just looking at the nomograms again. I have seen them used in aeronautics where you need to compute something complex: e.g. show speed, altitude and turn radius for different parameters, or length of take off for different temperature altitudes and loads. Thinking about it, isn't a butcher's plot a nomogram as well.They are still awesome .

Cuchulainn
Posts: 63251
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = $e^5$

QuoteOriginally posted by: PenielFunny, I haven't done anything and it looks like the title is "locked".Sorry Cuchulainn, I can't do much for you.No problem. It's not a pretty title, anymore. It changes its form when clicked on etc. And I thought we all agreed that thread titles were const?
Last edited by Cuchulainn on May 25th, 2013, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl

Cuchulainn
Posts: 63251
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = $e^5$

A related problem is to compute a sum of exponentials (like IRR) as intake a = 0.179235then Sum (exp(a * j)) over j = 0, ... 100.Which is best (if at all)?1. Straightforward call to exp(a * j) for each j2. Define a recurrence relation based on exp(x+y) = exp(x) * exp(y)3. Or in some cases, e.g. Padé approximant.Does it matter which one to use (e.g. in terms of nasty round off)?
Last edited by Cuchulainn on May 26th, 2013, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl

Posts: 23951
Joined: September 20th, 2002, 8:30 pm

exp(5) = $e^5$

QuoteOriginally posted by: CuchulainnA related problem is to compute a sum of exponentials (like IRR) as intake a = 0.179235then Sum (exp(a * j)) over j = 0, ... 100.Which is best (if at all)?1. Straightforward call to exp(a * j) for each j2. Define a recurrence relation based on exp(x+y) = exp(x) * exp(y)3. Or in some cases, e.g. Padé approximant.Does it matter which one to use (e.g. in terms of nasty round off)?Tricky!Given that exp(a) will have a round-off error (&#8710 with some sign, option #2 will amplify that error to be O(∆ * N^2) so that's really bad.Padé approximant is an approximation, so that seems less than ideal although maybe one might use an approximant (with error bounds) to either check the answer or to select the right algorithm in the space of a and N.I think we might be left with #1 as the less error-prone, if expensive, way to do this.Of course, a really clever person would invent some analog to Kahan summation for this problem.

Cuchulainn
Posts: 63251
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = $e^5$

QuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnA related problem is to compute a sum of exponentials (like IRR) as intake a = 0.179235then Sum (exp(a * j)) over j = 0, ... 100.Which is best (if at all)?1. Straightforward call to exp(a * j) for each j2. Define a recurrence relation based on exp(x+y) = exp(x) * exp(y)3. Or in some cases, e.g. Padé approximant.Does it matter which one to use (e.g. in terms of nasty round off)?Tricky!Given that exp(a) will have a round-off error (&#8710 with some sign, option #2 will amplify that error to be O(∆ * N^2) so that's really bad.Padé approximant is an approximation, so that seems less than ideal although maybe one might use an approximant (with error bounds) to either check the answer or to select the right algorithm in the space of a and N.I think we might be left with #1 as the less error-prone, if expensive, way to do this.Of course, a really clever person would invent some analog to Kahan summation for this problem.A sanity check: if I call 1) in different places will I get exactly the same answers each time? Or can some statistical nondeterminism occur? If yes, then better to precompute a lookup table? (think of NR to compute f and df/dx). // And a nasty one is if the implementation of exp() and/or pow() has changed between versions V_n and V_(n+1) of the compiler. I hope not......
Last edited by Cuchulainn on May 26th, 2013, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl

Posts: 23951
Joined: September 20th, 2002, 8:30 pm

exp(5) = $e^5$

exp() should be stateless and deterministic so exp(x) == exp(x) for all invocations within a given runtime environment. But, exp(x) could differ between compilers, libraries, and chips.If a/ln(2) is a rational number, especially if it is one with a low denominator WRT N, then you won't have statistical nondeterminism because you'll be cycling through the same values of the significand. That's not likely to be a problem in most financial domains because a*N isn't very large.

Cuchulainn
Posts: 63251
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = $e^5$

QuoteOriginally posted by: ExSanQuoteOriginally posted by: CuchulainnHere's another way and you only have to remember that exp(0) = 11. Compute e == exp(1) using the fact that the exponential satisfies du/dx = u, u(0) = 1. Solve using Euler's method U(n+1) = (1+h)*U(n). Compute e ~ U(N) = (1+h)^N. Thanks to Cuchulainn for the hints ! Numerical Ordinary Differential EquationsFrom the Downloadable File extract program ExSan_EULER_ODE_EXP to your desktop and execute. (see updated post)What about ODE solver based on Runge Kutta54 Cash Karp stepper (5th order)
Last edited by Cuchulainn on July 11th, 2013, 10:00 pm, edited 1 time in total.
Chips chips chips Du du du du du Ci bum ci bum bum Du du du du du Ci bum ci bum bum Du du du du du
http://www.datasimfinancial.com
http://www.datasim.nl