Serving the Quantitative Finance Community

 
User avatar
katastrofa
Posts: 7931
Joined: August 16th, 2007, 5:36 am
Location: Event Horizon

Re: Calculate the derivative of exp(A) over A

July 23rd, 2018, 12:25 am

Certainly better than the Taylor series I suggested above :oops: It's (not) funny, but the only time I actually used a Padé approximant was at the exam to the course in algorithmics by a Professor who looked a bit like Stallman, if you recollect the (in-)famous toe jam eating. Then I turned a physicist and my world was truncated at the first order term of the power series expansion. I once ventured an order farther and I still keep receiving inquiries if I've seen any dragons and sea monsters.
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 23rd, 2018, 3:27 pm

Would differentiating a Pade approximation of exp(H) over H_{kl} give a good approximation of d exp(H) / dH_{kl}? I suppose not...
No.
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 23rd, 2018, 10:15 pm

Would differentiating a Pade approximation of exp(H) over H_{kl} give a good approximation of d exp(H) / dH_{kl}? I suppose not...
No.
I thought so...
Take the Pade (0,1) (or was it (1,0) ?) [$]e^x[$] approximate by [$]1+x[$] on [-1,1]

1: Compute maximum error using 101 calculus
2. Compute derivative
3. GOTO 1

Gets worser and worser.
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 24th, 2018, 10:22 am

Thinking out loud (don't know if it will work, but it might). Differentiate 

du./dt = Au in time to get 

d^2u/dt^2 = d(Au)/dt (A = A(t) in general

Then write as an ODE system

dv/dt = Bv  where B is a nested matrix.

Only(?) issue is to compute du/dt at t = 0 (usually by heuristic handwaving) (*)

Boost odeint could test it..

(*) this is the trick used in Keller's box scheme
https://wwwf.imperial.ac.uk/~ajacquie/I ... uffyCN.pdf
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 24th, 2018, 11:00 am

You could try it in the 1d case and know soon enough if it works.
du/dx = u, u(0) = 1.
aka GO/NOGO
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 24th, 2018, 5:16 pm

I'd rather not go down the ODE solving route :)
The reason being?
What about a home-grown solver?
 
User avatar
katastrofa
Posts: 7931
Joined: August 16th, 2007, 5:36 am
Location: Event Horizon

Re: Calculate the derivative of exp(A) over A

July 24th, 2018, 10:51 pm

No.
I thought so...
Take the Pade (0,1) (or was it (1,0) ?) [$]e^x[$] approximate by [$]1+x[$] on [-1,1]

1: Compute maximum error using 101 calculus
2. Compute derivative
3. GOTO 1

Gets worser and worser.
It's not a Padé approximant.

exp x = exp(x/2) / exp(-x/2) for Padé.
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 25th, 2018, 9:13 am

I thought so...
Take the Pade (0,1) (or was it (1,0) ?) [$]e^x[$] approximate by [$]1+x[$] on [-1,1]

1: Compute maximum error using 101 calculus
2. Compute derivative
3. GOTO 1

Gets worser and worser.
It's not a Padé approximant.

exp x = exp(x/2) / exp(-x/2) for Padé.
It is Pade table (1,0)
https://en.wikipedia.org/wiki/Pad%C3%A9_table
Not sure what your above identity is telling me.
 
User avatar
katastrofa
Posts: 7931
Joined: August 16th, 2007, 5:36 am
Location: Event Horizon

Re: Calculate the derivative of exp(A) over A

July 25th, 2018, 10:54 am

There's no such a thing as Padé(.,0). It would kill the whole idea of the approximant. My identity was a hint how to calculate the Padé approximant of exp. Nevermind, I need to go and do something mathematically sound now.
Last edited by katastrofa on July 25th, 2018, 11:09 am, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 25th, 2018, 11:06 am

Read the Wiki link.
The identity is cute but far away from rational approximation (IMO). But I might be wrong.Or you.

Feller was an ebullient man, who would rather be wrong than undecided. 
 
User avatar
katastrofa
Posts: 7931
Joined: August 16th, 2007, 5:36 am
Location: Event Horizon

Re: Calculate the derivative of exp(A) over A

July 25th, 2018, 5:47 pm

We essentially don't agree whether the Taylor series is a Padé approximant. I think the motivation for the latter is to achieve(/extend the radius of) or accelerate the convergence of the first, hence it has the form of a quotient of two Taylor series expansions:
[$]\sum_{i=0}^M a_i x^i / ( 1 + \sum_{j=1}^N a_j x^j )[$]

Thus the Pade approximant of exp x should be derived from exp(x/2) / exp(-x/2) = T(x/2) / T(-x/2).

I think ISayMoo's could use Padé approximant to calculate exp(A), but needs to assure that the norm of A is low (e.g. by applying the Gershgorin - a.k.a. some Belarusian guy who's name I forgot - circle theorem, which we have once intensely discussed in the forum with Lovenatalya).

BTW, why do you use the word "cute" so often when we talk?
Last edited by katastrofa on July 26th, 2018, 12:32 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 25th, 2018, 6:12 pm

This is the first time I ever used that word :) Cute foto.

Thus the Pade approximant of exp x should be derived from exp(x/2) / exp(-x/2) = T(x/2) / T(-x/2).
What's 'T'?
Last edited by Cuchulainn on July 25th, 2018, 6:18 pm, edited 2 times in total.
 
User avatar
katastrofa
Posts: 7931
Joined: August 16th, 2007, 5:36 am
Location: Event Horizon

Re: Calculate the derivative of exp(A) over A

July 25th, 2018, 6:13 pm

It's *relatively* often then.
T is for Taylor expansion.
 
User avatar
Cuchulainn
Topic Author
Posts: 22933
Joined: July 16th, 2004, 7:38 am

Re: Calculate the derivative of exp(A) over A

July 26th, 2018, 11:51 am

Simple question which stumps me: I  have a complex square matrix H. There are some nice methods for calculating exp(H). What about calculating the derivative of exp(H) over elements of H? To be precise: let M = exp(H). I want to calculate dM_{jk} / dH_{mn} numerically, accurately and (relatively) quickly.
What about somefing on the lines of BCH?

https://math.stackexchange.com/question ... -of-matrix

A successful implementation would improve the code (e.g. maintainability and readability) for backpropagation etc.
 
User avatar
katastrofa
Posts: 7931
Joined: August 16th, 2007, 5:36 am
Location: Event Horizon

Re: Calculate the derivative of exp(A) over A

July 26th, 2018, 11:36 pm

Is what you call Higham's method simply a complex step derivative, which has been used by statisticians for sensitivity analysis since complex was added in the C99 standard? Who's Higham?