Hi All,
I am trying to solve tridiagonal matrix system. I found the code from internet and modified it little bit, but results are not as good as LinearSolve command in Mathematica. How can I improve the results? Any suggestion?
I have attached my code to post..
Thanks in advance..
Hi, you had only forgotten a comma in your algorithm: Thomas[a0, d0, c0, b0] := Module[{a = a0, b = b0, c = c0, d = d0, k, m, n = Length[b0], x}, For[k = 2, k <= n, k++, (here) Then it works properly! Best wishes
If you're going to adopt a procedural approach you will need to use Compile to even get close to what LinearSolve will deliver. But why not just use LinearSolve?
It looks as though you're entering vector elements subscripted. That's probably not helping any.