小编dun*_*nno的帖子

在具有3个边界条件的二维阵列中迭代有限差分格式

在完成本科毕业论文的中间步骤中,我试图通过显式有限差分方案来解决R中的Black-Scholes PDE.到目前为止,我一直在及时(沿时间离散化)和股票价格离散化反复迭代.我已经实现了欧洲看涨期权的边界条件,并且我试图根据Phil Goddard对该模型的描述来向后解决问题.

R <- matrix(NA, ncol=length(t), nrow=length(S))

# Value at Maturity:
R[,length(t)] <- Vold <- pmax(S - K,0) 

# Value at S = S_max; V = fwd
R[length(S),] <- V_max <- S_max - K * exp(-r_yr * (t_T - t))

# Value at S = S_0; V = 0
R[1,] = V_min <- t - t

# Run Model
# -----------------------------------------------------------------------------------------

# Define Coefficient-Functions a_j, b_j, and c_j
a_ <- function(j){
  a_j <- (1/2) * …
Run Code Online (Sandbox Code Playgroud)

arrays for-loop r numerical-methods pde

6
推荐指数
0
解决办法
1342
查看次数

julia notebook 交互式窗口 pyplot

如何使用PyPlotJupyter 笔记本中的交互式制作我的 3d 绘图?

我有一个曲面图:

using PyPlot
x=1:0.1:10
y=x'
z=x.^2 + y.^2
surf(x,y,z)
Run Code Online (Sandbox Code Playgroud)

但它在我笔记本的固定窗口中。

matplotlib julia

3
推荐指数
1
解决办法
1553
查看次数

标签 统计

arrays ×1

for-loop ×1

julia ×1

matplotlib ×1

numerical-methods ×1

pde ×1

r ×1