SERVING THE QUANTITATIVE FINANCE COMMUNITY

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

### Numerical accuracy and performance ?

Do these reservations also hold for this expansion?

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

### Numerical accuracy and performance ?

QuoteOriginally posted by: CuchulainnDo these reservations also hold for this expansion?ABSOLUTELY! There's no guarantee that the numerical result of this computation lies inside the [0,1] interval. The result of that series could readily be <-0.5 or >0.5, making the result negative or >1.

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

### Numerical accuracy and performance ?

William Shaw uses a DE for the quantile w(p): For which ODE solvers. And better than Taylor + asymptotic examples. QuoteQuantile functions may also be characterized as solutions of non-linear ordinary and partial differential equations. The ordinary differential equations for the cases of the normal, Student, beta and gamma distributions have been given and solved.
Last edited by Cuchulainn on December 11th, 2015, 11:00 pm, edited 1 time in total.

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

### Numerical accuracy and performance ?

QuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnDo these reservations also hold for this expansion?ABSOLUTELY! There's no guarantee that the numerical result of this computation lies inside the [0,1] interval. The result of that series could readily be <-0.5 or >0.5, making the result negative or >1.I hate asymptotic expansions for this reason. Same goes for Taylor.
Last edited by Cuchulainn on December 11th, 2015, 11:00 pm, edited 1 time in total.

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

### Numerical accuracy and performance ?

QuoteOriginally posted by: CuchulainnWilliam Shaw uses a DE for the quantile w(p): For which ODE solvers. And better than Taylor + asymptotic examples. QuoteQuantile functions may also be characterized as solutions of non-linear ordinary and partial differential equations. The ordinary differential equations for the cases of the normal, Student, beta and gamma distributions have been given and solved.In have done some experiments comparing this ODE solution (in Boost odeint) with 1) fixed point 2) Newton Raphson 3) Boost Math 4) Boost odeint (Bulirsch). Up to p = 0.999999 the result are consistent. (4.75342)When p = 1 we get1) 5.6122) 8.363) seems to crash4) 5.20764Cray values at p = 1. Most tables only go to p = 0.9999.
Last edited by Cuchulainn on December 12th, 2015, 11:00 pm, edited 1 time in total.

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

### Numerical accuracy and performance ?

QuoteOriginally posted by: outrunBoost math with probsbly not crash but handle it depending on the default error policy you used? Afaik they invested a lot of time in getting full machine precision, not something you can easily beat.I realize that they did a lot. I checked it against the other 3 solutions. One size does not fit all. See it as a stress test. But Boost is restricted to univariate problems. And it gives a run time error when p = 1. Is it a bug or a feature..??
Last edited by Cuchulainn on December 12th, 2015, 11:00 pm, edited 1 time in total.

Polter
Posts: 2526
Joined: April 29th, 2008, 4:55 pm

### Numerical accuracy and performance ?

QuoteQuoteSo, we need two functions to do the same thing? Is it a workaround? The basic problem is the weakness in the numerical method used (?) And we even haven't discussed n-variate cdf....They are the same thing conceptually, but not identical numerically. They reflect the simple fact that x != (1-(1-x)) for about half of all floating point numbers.There's more:http://en.cppreference.com/w/cpp/numeri ... og1pWhat's also interesting is trigonometric functions like sin and cos:http://www.gamedev.net/topic/636986-fas ... nctions/An interesting operation in this context is sincos -- in x87 instruction set there's an instruction for this -- http://www.felixcloutier.com/x86/FSINCOS.html -- but it's not exposed in the standard C or C++.It takes some work to make a modern vector unit equivalent (say, AVX2). Here's a glibc patch:http://sourceware.org/ml/libc-alpha/201 ... htmlHere's the AVX2 implementation (cf. the "ALGORITHM DESCRIPTION" comment):http://code.woboq.org/userspace/glibc/s ... .S;hb=HEAD

ioualalen
Topic Author
Posts: 8
Joined: October 19th, 2015, 10:02 am

### Numerical accuracy and performance ?

Hi everyone, sorry about my absence this weekend.QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: CuchulainnDo these reservations also hold for this expansion?ABSOLUTELY! There's no guarantee that the numerical result of this computation lies inside the [0,1] interval. The result of that series could readily be <-0.5 or >0.5, making the result negative or >1.I hate asymptotic expansions for this reason. Same goes for Taylor.So this is a very interesting problem, where even different solutions may not be enough to solve it as Cuchulainn find it.I am going to study this function and post here the results (I hope today if my schedule does not blow up too quickly) QuoteIn have done some experiments comparing this ODE solution (in Boost odeint) with 1) fixed point 2) Newton Raphson 3) Boost Math 4) Boost odeint (Bulirsch). Up to p = 0.999999 the result are consistent. (4.75342)Could you share with me some of the code you use Cuchulainn? So that I could analyse how the accuracy evolves on them, and how I can improve it.QuoteI realize that they did a lot. I checked it against the other 3 solutions. One size does not fit all. See it as a stress test. But Boost is restricted to univariate problems.And it gives a run time error when p = 1. Is it a bug or a feature..??Concerning Boost that is interesting I am going to benchmark this again our approach to see if we can do something about that.Generaly speaking thanks again everyone for all of these very interesting discussions, I was not sure that this topic would raise that much interest, that's a nice surprise for me! I am still struggling to do some real benchmarks on most of the things you talk about since I am no quant, but slowly I am starting to understand it.
Last edited by ioualalen on December 13th, 2015, 11:00 pm, edited 1 time in total.

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

### Numerical accuracy and performance ?

Nope, it's an overflow error when p = 1.I recall
Last edited by Cuchulainn on December 13th, 2015, 11:00 pm, edited 1 time in total.

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

### Numerical accuracy and performance ?

Does that make it a bug? The 3 other methods give answers. QuoteI would expect that a "Domain Error" "gets thrown" if you leave error handing set to the default configuration?Depends on the contract. Does it support p = 1 yes or no?
Last edited by Cuchulainn on December 13th, 2015, 11:00 pm, edited 1 time in total.