SERVING THE QUANTITATIVE FINANCE COMMUNITY

• 1
• 2

Cuchulainn
Topic Author
Posts: 61185
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Differentiating the integral

something like

$\frac{\partial^{2}L}{\partial h^{2}}\left.\right|_{k,\rho} +h\frac{\partial L}{\partial h}\left.\right|_{k,\rho} =-\frac{\rho}{2\pi\sqrt{1-\rho^{2}}}\exp(-\frac{h^{2}}{2}) \exp(-\frac{(k-\rho h)^2}{2(1-\rho^2)})$
The question is to solve this differential equation as an initial value problem or boundary value problem on a truncated interval (-A, A) with zero Dirichlet boundary conditions. In the latter case I am not getting conclusive answers at the moment.
The DE has a turning point at $h=0$ and special cases are $\rho = {0,1}$.

Could be this approach leads to an ill-defined problem?
http://www.datasimfinancial.com
http://www.datasim.nl

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

ppauper
Posts: 70239
Joined: November 15th, 2001, 1:29 pm

### Re: Differentiating the integral

you (cuch) are the expert on numerics here
Maybe truncating the domain is the issue (I don't know) in which case people a lot smarter than me do things like
I) using asymptotics to estimate the nehavior  at +/- infinity and using that as the boundary condition in the truncated domain (I've read hydrodynamic stability papers in fluid mechanics where that is done)
or
ii) map the infinite domain onto a finite domain. A guy I worked with many years ago used to do that combined with relaxation methods using chebyshev polynomials

Cuchulainn
Topic Author
Posts: 61185
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Differentiating the integral

something like

$\frac{\partial^{2}L}{\partial h^{2}}\left.\right|_{k,\rho} +h\frac{\partial L}{\partial h}\left.\right|_{k,\rho} =-\frac{\rho}{2\pi\sqrt{1-\rho^{2}}}\exp(-\frac{h^{2}}{2}) \exp(-\frac{(k-\rho h)^2}{2(1-\rho^2)})$
Does this make it easier?

$\exp(\frac{h^{2}}{2})(\frac{\partial^{2}L}{\partial h^{2}}\left.\right|_{k,\rho} +h\frac{\partial L}{\partial h}\left.\right|_{k,\rho}) =-\frac{\rho}{2\pi\sqrt{1-\rho^{2}}} \exp(-\frac{(k-\rho h)^2}{2(1-\rho^2)})$

and LHS can be condensed to something like (a L_h)_h.

I'm not very far, but zero boundary conditions don't work. That's why it is a simmering brainteaser which we could integrate twice to give initial/boundary conditions?
http://www.datasimfinancial.com
http://www.datasim.nl

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

ppauper
Posts: 70239
Joined: November 15th, 2001, 1:29 pm

### Re: Differentiating the integral

that other form doesn't really make it easier analytically, but you're the expert on computation so you'd know if it made the computing easier.

I guess it makes it easier to integrate, but integrating just gives the expression we had earlier

ppauper
Posts: 70239
Joined: November 15th, 2001, 1:29 pm

### Re: Differentiating the integral

what are the boundary conditions?
$L(h,k,\rho)=\int_{h}^{\infty}dx\int_{k}^{\infty}g(x,y,\rho)dy$
I think $h=+\infty$ or $k=+\infty$ then $L=0$
but $h=k=-\infty$ then $L=1$?

Cuchulainn
Topic Author
Posts: 61185
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Differentiating the integral

what are the boundary conditions?
$L(h,k,\rho)=\int_{h}^{\infty}dx\int_{k}^{\infty}g(x,y,\rho)dy$
I think $h=+\infty$ or $k=+\infty$ then $L=0$
but $h=k=-\infty$ then $L=1$?
Yes, that's the direction I took. It is a first special case to check the equation (assuming the DE is correct and BC are plausible). I tried approximating the boundary value problem by FDM but I get funny numbers, still. I'll check again.
http://www.datasimfinancial.com
http://www.datasim.nl

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

ppauper
Posts: 70239
Joined: November 15th, 2001, 1:29 pm

### Re: Differentiating the integral

again, I'm not a numerical guy, cuch's the expert, but (and cuch the expert probably knows why this won't work)

I'd use the expression for $\frac{\partial L}{\partial h}$ together with the boundary condition that $L=0$ when $h=+\infty$ and shoot down from $h=+\infty$
you can probably kludge together an approximation for $L$ for large $h$ and shoot down from that large value of $h$
$\frac{\partial L}{\partial h}\left.\right|_{k,\rho}=-\frac{1}{\sqrt{8\pi}}\exp(-\frac{h^{2}}{2})\;\mathrm{erfc}(\frac{k-\rho h}{\sqrt{2(1-\rho^2)}})$
for large $h$, ignore $k$,
$\frac{\partial L}{\partial h}\left.\right|_{k,\rho}=-\frac{1}{\sqrt{8\pi}}\exp(-\frac{h^{2}}{2})\;\mathrm{erfc}(-\frac{\rho h}{\sqrt{2(1-\rho^2)}}) =-\frac{1}{\sqrt{8\pi}}\exp(-\frac{h^{2}}{2})\left[2-\mathrm{erfc}(\frac{\rho h}{\sqrt{2(1-\rho^2)}})\right]$
and I've written it like that because there's an expansion of erfc(x) for large x here
at first cut, replace the erfc by 0 for large $h$ (if you want more terms, use the link above) so for large $h$
$\frac{\partial L}{\partial h}\left.\right|_{k,\rho}=-\frac{1}{\sqrt{2\pi}}\exp(-\frac{h^{2}}{2})$
so for large $h$ we can approximate $L=\frac{1}{2}\;\mathrm{erfc}(\frac{h}{\sqrt{2}})$

if you can follow that, you're smarter than me, but the point was to try and approximate the boundary condition for large $h$, so I'd solve
$\frac{\partial L}{\partial h}\left.\right|_{k,\rho}=-\frac{1}{\sqrt{8\pi}}\exp(-\frac{h^{2}}{2})\;\mathrm{erfc}(\frac{k-\rho h}{\sqrt{2(1-\rho^2)}})$
shooting down from some large value of $h=H$ with $L(H)=\frac{1}{2}\;\mathrm{erfc}(\frac{H}{\sqrt{2}})$

It would be even easier to start from $L(H)=0$ but if I've understood, that gives the wrong answers

Cuchulainn
Topic Author
Posts: 61185
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Differentiating the integral

Thanks, I'll check it out.
Actually, I don't know why my FD code does not work. I must be doing something silly.

The extremes are:

1. Differentiate twice to get a PDE like u_xy = RHS (works well)
2. Solve double integral 'directly' (work well).

The current case is just to differentiate WRT h and keep k as a parameter. So we have an ODE as mentioned.
http://www.datasimfinancial.com
http://www.datasim.nl

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

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

 JOBS BOARD

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

GZIP: On