Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Comparing Python, MATLAB, and Mathcad

Sample Code in Python, Matlab, and Mathcad

Polynomial fit
Integrate function
Stiff ODE system
System of 6 nonlinear equations
Interpolation

2D heat equation: MATLAB/Python only

IPython Notebooks

Thanks to David Lignell for providing the comparison code

Code: fit polynomial to data


Python

Matlab

Python

Mathcad

Code: integrate function


Python

Matlab

Python
2 files
(optional)

Mathcad

Code: Stiff ODE system


Python

Matlab

2Python
files

Mathcad

Code: interpolation
Python

Matlab

Python

2 files

Mathcad

Code: system of nonlinear equations


Python

Matlab

Python

2 files

Flow through 3 parallel pipes given total flow, pipe props

Mathcad

Code: 2D unsteady heat equation


Python

Matlab

Finite difference, Euler integration

IPython Notebook

A wrapper with full Python


functionality
Web interface (and others)
Workbook

Edit and output dynamically


Document as you go, with formatting
Print/share
Embed images and movies, etc.
Direct code loading

Interactive e-books are written in


IPython notebook
Symbolic solver with formatted
output

You might also like