Python Solve a System of Linear Equations

Utility

The script on this page requires the utility module tompy.py

* * *

Python Script

The following script solves a system of equations of the form Ax=b
linear_system.py

The key lines are

from scipy import linalg

x = linalg.solve(A, b)

* * *

Fortran

A Fortran program for this problem is: SLE.F

The program is compiled via

gfortran -o SLE SLE.F -llapack

It uses the Lapack subroutine DGESV.

* * *

Tom Irvine

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s