A = SparseArray[{Band[{1, 2}] -> 1, Band[{2, 1}] -> -1}, {n,
n}]/(2*\[CapitalDelta]x);
B = SparseArray[{Band[{1, 1}] -> -2, Band[{1, 2}] -> 1,
Band[{2, 1}] -> 1}, {n, n}]/(\[CapitalDelta]x^2);
R = SparseArray[{Band[{1, 1}] -> 1}, {n, n}];
pde = -D[V[S, t], t] == ((r - 0.5 \[Sigma]^2).A + (0.5 \[Sigma]^2).B - r.R)V
Having constructed my matrices A,B and R, how do I solve in mathematica to get a single matrix? I need to replace it in the above equation. I've tried the above codes but failed. I need every element in each matrix be multiplied to the respective scalar.
(((r - 0.5 \[Sigma]^2)*A + (0.5 \[Sigma]^2)*B - r*R) // Normal // TableForm ).V– ssch Nov 14 '12 at 15:08-D[V[s, t], t] == ((r - 0.5 \[Sigma]^2) A + (0.5 \[Sigma]^2) B - r R).V[s, t]Point being, you seem to have reversed Dot and (element-wise) Times. – Daniel Lichtblau Feb 12 at 22:46