![]() |
Step back
How do you translate this into vba code?
for i = (N-1) downto 0 do for j = 0 to i do C[j] = disc * ( p*C[j+1] + (1-p)*C[j] ) 1. Particularly the part about "downto", so instead of running i from 0 to (N-1), this is a step-back running from (N-1) to 0. 2. How do you make the Function remember each individual value C[j] from j = 0 to i |
Step back
Hi
try Dim N as integer Dim i as integer Dim j as integer Dim C() N=10 Redim C(N) for i = (N-1) to 0 step -1 for j = 0 to i C(j)=disc * ( p*C[j+1] + (1-p)*C[j] ) next j next i Whatever disc and p is -----Original Message----- How do you translate this into vba code? for i = (N-1) downto 0 do for j = 0 to i do C[j] = disc * ( p*C[j+1] + (1-p)*C[j] ) 1. Particularly the part about "downto", so instead of running i from 0 to (N-1), this is a step-back running from (N-1) to 0. 2. How do you make the Function remember each individual value C[j] from j = 0 to i . |
All times are GMT +1. The time now is 10:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com