Message Boards Message Boards


How to Improve Thomas Algorithm - Solving Tridiagonal Matrix System

Posted 9 years ago
3 Replies
1 Total Likes

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..

POSTED BY: selahittin cinar
3 Replies
Posted 5 years ago

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

POSTED BY: Klaus von Bloh

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?

POSTED BY: Mike Honeychurch

It looks as though you're entering vector elements subscripted. That's probably not helping any.

POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract