Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieugomez committed Jun 13, 2024
1 parent c708be6 commit 7281c10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/derivatives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function FirstDerivative(x::AbstractVector, y::AbstractVector; bc = (0, 0), dire
FirstDerivative{eltype(y)}(x, y, bc, direction)
end


Base.size(d::FirstDerivative) = (length(d.x), 1)

Base.IndexStyle(d::FirstDerivative) = IndexLinear()
Expand Down Expand Up @@ -56,7 +55,6 @@ function SecondDerivative(x::AbstractVector, y::AbstractVector; bc = (0, 0))
SecondDerivative{eltype(y)}(x, y, bc)
end


Base.size(d::SecondDerivative) = (length(d.x), 1)

Base.IndexStyle(d::SecondDerivative) = IndexLinear()
Expand Down
8 changes: 7 additions & 1 deletion src/feynman_kac.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ With direction = :backward
Solve the following PDE:
u(x, t[end]) = ψ(x)
0 = u_t + 𝕋u - v(x, t)u + f(x, t)
Equivalently, in integral form,
u(x, t) = E[∫_t^T e^{-∫_t^s v(x_u) du} f(x_s)ds + \int_t^t e^{-\int_t^T v(x_u)du} ψ(x_T)|x_t = x]
(notations are from the wikipedia article for Feynman–Kac formula)
With direction = :forward
Solve the following PDE:
u(x, t[1]) = ψ(x)
u_t = 𝕋u - v(x, t)u + f(x, t)
Equivalently, in integral form,
u(x, t) = E[∫_0^t e^{-∫_0^s v(x_u) du} f(x_s)ds + \int_0^t e^{-\int_0^t v(x_u)du} ψ(x_t)|x_0 = x]
The function returns a matrix of size(length(f), length(t))
"""
function feynman_kac(𝕋;
t::AbstractVector = range(0, 100, step = 1/12),
Expand Down

0 comments on commit 7281c10

Please sign in to comment.