SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

February 4th, 2015, 5:28 am

QuoteYes, we have different attitudes for that, here I would prefer to havea good initial instead of a generic approach or naming methods. And soavoiding probably expansive methods.Well, it is (can be??) usually a requirement to have a non-linear solver that works for all combinations of input parameters. It's a mathematical problem in the main and this is why homotopy etc. are used in many application areas.Concerning efficiency, fixed point method 4 can be extended by Aitken to get 2nd order convergence comparable to that of NR, e.g. M = 0.1, eps = 0.8 converges in 4 iterations. Or bracketing with NR is also not bad.NR is very fast when it does converge but I prefer bracketing the solution first as it is easier IMO than finding a seed. It's a choice, I suppose.A follow-on is a two-dimensional NR method and then how do I choose seeds? e.g. let's say fitting the ir yield and vol.. Which is the most robust of the above 10 methods?
Last edited by Cuchulainn on February 3rd, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

February 4th, 2015, 7:21 am

I ran this code for M = 0.1, eps = 0.7 and 0.8. Results are now correct. 5 iterations needed.Multiple calls to pow() has performance impact. And sin(x) and cos(x) must be called at each iteration.
Last edited by Cuchulainn on February 3rd, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

February 4th, 2015, 4:54 pm

Solution #11: Use a steepest descent/Brent minimizer with limited bit precision (e.g. 11 bits) to find the seed for x_0 and use it for NR. This also works for test cases.This approach has potential for multi-dimensional problems.
 
User avatar
AVt
Posts: 1074
Joined: December 29th, 2001, 8:23 pm

exp(5) = [$]e^5[$]

February 4th, 2015, 8:25 pm

It is easy to clean up the code, sorry for being lazy: there is 1 pow to get the cube root, the other are integers (i.e. a polynomial) and calling the very function now and then is not a bad idea.Anyway: a nice listing of methods.
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

February 5th, 2015, 7:08 am

Yes, thanks for the interaction. I think it is possible to learn a lot from specific examples _and_ runnable code.//I once went through a similar process in production and we eventually wound up with solution #3 . Now the process is in long-term //memory, so I can choose from many methods depending on the requirements. Sometimes you forget stuff you already know.A follow-on is which methods are suitable for Implied Volatility
Last edited by Cuchulainn on February 4th, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

February 5th, 2015, 8:06 pm

QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnYes, thanks for the interaction. I think it is possible to learn a lot from specific examples _and_ runnable code.//I once went through a similar process in production and we eventually wound up with solution #3 . Now the process is in long-term //memory, so I can choose from many methods depending on the requirements. Sometimes you forget stuff you already know.A follow-on is which methods are suitable for Implied Volatilitybracketing! and for european options use both the call+put to get a simultanious implied vol and implied forward. For american options things are much more complicated because of early exercise.But are people still using B&S and static vol surfaces?Looks like it. @tt is the originator of that thread.
Last edited by Cuchulainn on February 4th, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

February 9th, 2015, 9:32 am

AVt,A follow-on case is for two unknowns x and yf(x,y) = 0, g(x,y) = 0with seeds x_0 and y_0 (or a box containing a solution).A simplified BDT fitting example is A = B / (1 + x exp(C y) D)E = F / (1 + x exp(C y) D)where A,B,C,D,E,F are given constants. Find x and y. It is nicer if the function is unimodal.What's the 'best' method for this? A good starting value is good to have..
Last edited by Cuchulainn on February 8th, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
AVt
Posts: 1074
Joined: December 29th, 2001, 8:23 pm

exp(5) = [$]e^5[$]

February 9th, 2015, 5:36 pm

I would combine C into y, D into x and divide by the numerators, thus forshort B=1=F and C=1, D=1 with new A, E, x, y. Then one has A = E,i.e. only 1 equation. For simplicity you can write 1/A = 1 + x*exp(y) ora = x*exp(y). That curve can be discussed like +-1 = x*Y, 0 < Y=exp(y). PS: for such a new thread might be better (though I may not participate).
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

May 1st, 2015, 3:33 pm

BTW, in the Tian binomial modelexp(x)^2 != exp(x^2).
Last edited by Cuchulainn on April 30th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

October 7th, 2015, 10:49 am

QuoteOriginally posted by: PenielHow to compute [$]e^5[$] with two decimal places?A follow-on [$]exp(-exp(-x)), x = 0, 1, 2, ...[$] And the whole thread can start all over again. How would you tackle it with pen and paper?
Last edited by Cuchulainn on October 6th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

October 7th, 2015, 5:49 pm

QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnQuoteOriginally posted by: PenielHow to compute [$]e^5[$] with two decimal places?A follow-on [$]exp(-exp(-x)), x = 0, 1, 2, ...[$] And the whole thread can start all over again. How would you tackle it with pen and paper?I would walk to the applied math department basement across the street with a free pizza.The pure math department would only acknowledge that is it can be done without giving any answers.That's cheating. :D The applied would do an asymptotic expansionThe pure would use Lie groupsA statistician says it is the cdf of the Gumbal distribution ..But we need an algorithm to compute the number.
Last edited by Cuchulainn on October 6th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
katastrofa
Posts: 9335
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

exp(5) = [$]e^5[$]

November 5th, 2015, 9:03 pm

Computing the Taylor series expansion of a function with a given precision requires truncating the series at such a term that the reminder is smaller than the precision.Since [$]e^5 = \sum_k 5^k / k![$], computing [$]e^5[$] up to the second decimal place requires truncating the series at such n that the reminder [$]\sum_{k} 5^{n+k} / (n+k)! \le 0.01[$].We expand it: [$]\sum_{k} 5^{n+k}/(n+k)! = 5^n/n! [1 + 5/(n+1)+ 5^2/[(n+1)(n+2)] + ... ] <= 5^n/n! [1 + 5/n + (5/n)^2 + ... ] = \frac{5^n}{n!} (1 - (5/n)^{k`})/(1 - 5/n) <= \frac{5^n}{n!} \frac{n}{(n-5)}[$] for [$]n > 5[$] and [$]k` \rightarrow \infty[$]Hence we need the smallest n for which 5^n/n! * n/(n-5) <= 0.01, which is n = 17.Vide Rolle's theorem.
Last edited by katastrofa on November 4th, 2015, 11:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 62410
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

exp(5) = [$]e^5[$]

November 6th, 2015, 1:30 pm

QuoteHence we need the smallest n for which 5^n/n! * n/(n-5) <= 0.01, which is n = 17.How is this computed?QuoteVide Rolle's theorem. OK. What is the context?
Last edited by Cuchulainn on November 5th, 2015, 11:00 pm, edited 1 time in total.
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On