QuantEcon / SimpleDifferentialOperators.jl

Library for simple upwind finite differences
MIT License
12 stars 2 forks source link

Solve steady state KFE with absorbing barrier and entry/exit #154

Open jlperla opened 5 years ago

jlperla commented 5 years ago

We can add this to a new KFE notebook for looking at evolutions of KFE with birth-death.

The setup will be a:

In differentiable form, I believe the setup is then

D_t f(t,x) = - mu D_x f(t,x) + sigma^2/2 D_xx f(t,x) - delta f(t,x) + S(t) h(x)
f(t, x) = 0 for all x <= 0
- 2 mu/sigma^2 f(x_max, t) + D_x f(x_max, t) = 0
S(t) = delta + the flux at 0 boundary 

where int_0^{xmax} h(x) dx = 1

jlperla commented 5 years ago

For an h(x) example, you should try a few things. First, do an impulse by choosing some x in the grid at node m and then h = [0; 0;. .... 1 ; 0;. 0] etc. i.e. only have a value at the m'th point.

Also try a truncated exponential, which will end up being the main one we are interested in.

The continous equation for an exponential , truncated at xmax and with parameter theta is

θ = 2.0
x̄ = 4.0
f(x) = θ * exp(-θ * x) / (1 - exp(-θ * x̄))

To discretize on a grid

# Discretize on grid x?
x = range(0.0, x̄, length = 10)
f̂ = f.(x) / sum(f.(x) )

# Or should we be taking out the ends?
f̂ = f.(x[2:end-1]) / sum(f.(x[2:end-1]) )