Hi. You sent me a message with a 9 * 9 Input matrix, and the 9 * 9
solution.
This vba solution inputs your data from A1:I9, and outputs the data
below that beginning in A12.
The matrix converges quickly for a 1-Year. I only looped 20 times (not
infinity) and got the same solution.
I normally would call functions in my library. Therefore, this is a
quick and dirty way to do it. Because the solution was in percent, I
multiplied the solution by 100.
This is just one of a few ways to show how a vba solution is, what I
think, is much easier to handle.
Sub Convergence()
Dim Y As Long
Dim J As Long
Dim Fx
Set Fx = WorksheetFunction
Y = 1 '1 Year
With ActiveWorkbook.Names
.Add "Orig", [A1].Resize(9, 9).Value
.Add "M", [A1].Resize(9, 9).Value
.Add "Ans", IdentityMatrix(9)
.Add "Ans", [Ans+M]
For J = 2 To 20
.Add "k", Y / Fx.Fact(J) ' T/j!
.Add "M", [MMult(M, Orig)] 'Matrix to the next power
.Add "Ans", [Ans + k*M] 'Sum
Next J
.Add "Ans", [Ans*100]
[A12].Resize(9, 9) = [Ans]
End With
End Sub
Function IdentityMatrix(n)
Dim s
s = "0+(Row(#)=Column(#))"
s = Replace(s, "#", [A1].Resize(n, n).Address)
IdentityMatrix = Evaluate(s)
End Function
= = = = = = = = = =
HTH
Dana DeLouis