adam-rumpf / matlab-scipy-examples

A collection of small scripts demonstrating how to accomplish mathematical tasks in both MATLAB and in Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MATLAB/SciPy Examples

A collection of small scripts demonstrating how to accomplish mathematical tasks in both MATLAB (or Octave) and in Python using SciPy, NumPy, and Matplotlib.

Description

This repo is primarily aimed at mathematicians and scientists whom are already used to using mathematical software packages for performing scientific computations, but whom wish to expand their options by working in a fully-fledged programming language. Commercial software packages can be somewhat limited in their functionality, and being able to perform the same tasks using a general programming language not only grants access to a much wider array of packages, but also allows these mathematical applications to be built into larger programs.

This repo contains a collection of example scripts to show how common mathematical tasks can be performed in MATLAB and in Python, with the goal of demonstrating how to convert a MATLAB program into an equivalent Python program. This is accomplished primarily through the use of the ndarray object and the linalg module from NumPy, which provide a MATLAB-like syntax for working with vectors and matrices, and the pyplot module from Matplotlib, which provides a MATLAB-like syntax for creating plots.

Each subdirectory contains MATLAB .m files and Python .py files. The two files are meant to correspond to each other (line-for-line where possible) and to show how the same set of steps can be accomplished in each program. The files named after the directory are standalone versions of the MATLAB and Python scripts, while the files with an _appended suffix include both versions alongside each other to make the line-by-line comparison more clear.

Contents

The Basics

Directory Link

Demonstrations for a variety of basic programming structures (such as loops, conditional statements, and functions) and mathematical commands (such as matrix and vector operations, solving linear systems, and creating plots).

The Lorenz System

Directory Link

An example of numerically solving the Lorenz system of ordinary differential equations and plotting the resulting curve in 3D space viewed from various perspectives. This demonstrates the general approach for numerically solving initial value problems as well as displaying figures arranged in a grid.

About

A collection of small scripts demonstrating how to accomplish mathematical tasks in both MATLAB and in Python.

License:The Unlicense


Languages

Language:Python 50.0%Language:MATLAB 50.0%