QuantEcon / SimpleDifferentialOperators.jl

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

Implemetnation of affineboundary #188

Closed jlperla closed 5 years ago

jlperla commented 5 years ago

After #187

We want to do the code to support #187 It is not all that obvious what to pass into it to get the b^B. I think there are several interface approaches, but ultimately we need to be careful that we (1) we build it by pieces as we do with the others. that is maybe the following would work?

bc = (Absorbing(), Reflecting())
b = [2.0; 0.0]
b_bc = r * L₀affine(x̄, bc, b) - μ*L₁₋affine(x̄, bc, b) - σ^2 / 2 * L₂affine(x̄, bc, b)

Then you can use this as the fudge when doing the linear solve

v = L_bc \ (f + b_bc)

(where I think we can just drop the L₀affine(x̄, bc) since it would be 0 ??? could be wrong, though).

This would require carefully checking that the math composes well.

There are other options as well that could be done. For example, the L₁₋bc(x̄, bc, b) is an overload of this for affine boundary conditions, and it returns a tuple:

(L_1_bc, b_1_bc) = L₁₋bc(x̄, bc, b)
(L_2_bc, b_2_bc) = L₂bc(x̄, bc, b)
L_bc = I * ρ - μ * L_1_bc - σ^2 / 2 * L_2_bc
b_bc =        - μ * b_1_bc - σ^2 / 2 * b_2_bc 
π_bc = π.(x) + b_bc 
V = L_bc \ π_bc 

In order to support solving models with non-homogeneous boundary conditions, we should see if it is feasible to make

(the reset of the tasks related to example docs moved to a separate issue #193 )