Scientific Computing Using. Atriya Sen

Size: px
Start display at page:

Download "Scientific Computing Using. Atriya Sen"

Transcription

1 Scientific Computing Using Atriya Sen

2 Broad Outline Part I, in which I discuss several aspects of the Python programming language Part II, in which I talk about some Python modules for scientific computing Part III, in which I show you how Python can be integrated with other languages

3 Broad Outline Part I, in which I discuss several aspects of the Python programming language Part II, in which I talk about some Python modules for scientific computing Part III, in which I show you how Python can be integrated with other languages

4 #1: Readable & Compact Code Shorter and more readable programs Higher programmer productivity E F = open(filename, r ); F.read().split()

5 #2: Dynamic typing Types are decided at run-time, as opposed to static typing, where types are decided at compile-time Procedure to dump a data structure with a debugging message: def debug(leading_text, variable): if os.environ.get( MYDEBUG, 0 ) == 1 : print leading_text, variable Dynamic typing extends elegantly to nested heterogeneous data structures!

6 The Same Code In C++... template <class T> void debug(std::ostream& o, const std::string& leading_text, const T& variable) { } char* c = getenv("mydebug"); bool defined = false; if (c!= NULL) // if MYDEBUG is defined... if (std::string(c) == "1") // if MYDEBUG is true... defined = true; if (defined) o << leading_text << " " << variable << std::endl;

7 #3: Interactive Computing

8 #4: Easy GUI Programming A graphical Hello World program: #!/usr/bin/env python from Tkinter import * root = Tk() Label(root, text= Hello, World!, foreground="white", background="black").pack() root.mainloop() C + X11: 176 lines of ugly code Things get even worse for C when it comes to web development!

9 #5: Create Code At Runtime! Code can be constructed and executed at run-time: a = 1.2 no of iterations = 100 solution strategy = implicit c1 = 0 c2 = 0.1 A = 4 c3 = StringFunction( A*sin(x) ) Can we read this file and define a, no_of_iterations, solution_strategy, c1, c2, c3, A with the specified values? Yes!

10 #5: Create Code At Runtime (2) file = open( inputfile.dat, r ) for line in file: variable, value = line.split( = ).strip() variable = re.sub(, _, variable) exec(variable + = + value) # magic :D This cannot be done in C, C++, FORTRAN, or Java!

11 Python Compared To MATLAB Python modules provide functionality comparable to MATLAB Python can be as fast as MATLAB (and faster than Octave) The Python language is more flexible and powerful Object oriented programming is more convenient in Python Transferring functions as arguments to functions is simpler Nested, variable-type data structures are simpler to construct and use Interfacing with other languages and tools is simpler in Python MATLAB is more self-contained Python respects your freedom; Python runs on more platforms

12 Broad Outline Part I, in which I discuss several aspects of the Python programming language Part II, in which I talk about some Python modules for scientific computing Part III, in which I show you how Python can be integrated with other languages

13 numpy.scipy.or g numpy = Numeric + numarray Efficient array computations using a fixed-size, fixed-type multi-dimensional array type; also offers a matrix type Trigonometric and other functions don't use these on scalars! Basic random number generation and linear algebra capabilities More functionality in the numpyutils module

14 NumPy Example: Just How Fast Are We Talking? from numpy import * import time a = linspace(0, 1, 1E+07) t0 = time.clock() b = 3*a -1 t1 = time.clock() for i in xrange(a.size): b[i] = 3*a[i] - 1 t2 = time.clock() print '3*a-1: %g sec, loop: %g sec' % (t1-t0, t2- t1)

15

16 SciPy ( Builds on NumPy to provide a rapidly developing environment for scientific computing Special mathematical functions Integration ODE solvers Random variables and statistics Linear algebra calls up LAPACK Optimization and root-finding Interpolation An alternative is ScientificPython (dirac.cnrsorleans.fr/plone/software/scientificpython) A short digression: matplotlib and gnuplot

17 SciPy Examples Finding the first four zeroes of the Bessel function J3: from scipy.special import jn_zeros jn_zeros(3, 4) Simple integration: from scipy import integrate def myfunc(x): return sin(x) result, error = integrate.quad(myfunc, 0, pi) print result, error

18

19 Biopython (biopython.org) Parse bioinformatics files Use NCBI Blast, Entrez, PubMed and ExPASy data Interfaces to common bioinformatics programs A standard sequence class Tools for performing common operations on sequences Code to perform classification of data Code for dealing with alignments Split up parallelizable tasks into separate processes GUI-based programs Extensive documentation Integration with BioSQL

20

21 SymPy (sympy.org) Aims to become a fullfeatured computer algebra system Written in pure Python An alternative is Swiginac (SWIGbased interface to GiNaC, which is written in C++) Limits Symbolic matrices Quantum physics Differential equations Pattern matching Geometric algebra Complex numbers Expansions

22 SymPy Example def make_symbols(*args): return [Symbol(s) for s in args] x, a, A, omega, sigma, m, t = \ make_symbols('x', 'a', 'A', 'omega', 'sigma', 'm', 't') f = A*exp(-((x-m)/(2*sigma))**2)*exp(- a*t)*sin(2*pi*omega*x) Prms = {'A': 1, 'a': 0.1, 'm': 1, 'sigma': 1, 'omega': 1, 't': 0.2} print diff(f, x, 2)

23 More Python Modules! PyPI The Python Package Index (pypi.python.org/pypi)

24 Broad Outline Part I, in which I discuss several aspects of the Python programming language Part II, in which I talk about some Python modules for scientific computing Part III, in which I show you how Python can be integrated with other languages

25 Python and C Migration of performancecritical code to C Access existing C code Python is written in C and designed to be extended with C functions C has strong typing rules; variables in Python are typeless So, we need a wrapper function written in C extern double hw1(double r1, double r2); from hw import hw1 r1 = 1.2; r2 = -1.2 s = hw1(r1, r2) Python C API Extending and Embedding the Python Interpreter (official documentation) Needed to manipulate Python data structures in C

26 The Wrapper Function static PyObject *_wrap_hw1(pyobject *self, PyObject *args) { double arg1, arg2, result; if (! PyArg_ParseTuple(args, "dd:hw1", &arg1, &arg2)) { } return NULL; result = hw1(arg1, arg2); return Py_BuildValue("d", result); } Compile the wrapper function Compile the hw1 function Link their object codes to form a shared library module This is called an extension module and can be imported into Python code There is no way to tell between a C module and a Python module

27 Generation of Wrapper Code SWIG (Simplified Wrapper Interface Generator) for C and C++ F2PY for FORTRAN Instant has support for inline C code. Uses SWIG Pysco is a JIT for Python Pyrex and Cython convert pseudo-python code to C Many other tools available CXX, SCXX, Boost.Python, Weave, Pyrex, Pysco

28 Python, Java,.NET Seamless implementation of Python on.net Python tools for MS Visual Studio Implementation on Python on the JVM Seamless - any Java class can be used in a Jython script

29 Python, MATLAB, Mathematica The pymat module sends NumPy arrays to MATLAB. It only has the functions open, close, eval, put, get The mlabwrap module makes MATLAB command available directly in Python PYML is a Python- Mathematica interface import pymat x = linspace(0, 4*math.pi, 401) m = pymat.open() pymat.put(m, x, x); pymat.eval(m, y = sin(x) ) pymat.eval(m, plot(x,y) ) y = pymat.get(m, y ) import time; time.sleep(4) pymat.close(m)

30 Where To Go For More or even Both by Mark Pilgrim Python Scripting For Computational Science by H. P. Langtangen The password for the 3 rd edition is 'Clicking' (for MATLAB users)

Slides from INF Course intro

Slides from INF Course intro Slides from INF3331- Course intro p. 1/38 Slides from INF3331 - Course intro Ola Skavhaug, Joakim Sundnes and Hans Petter Langtangen Dept. of Informatics, Univ. of Oslo & Simula Research Laboratory August

More information

Python Scripting for Computational Science

Python Scripting for Computational Science Hans Petter Langtangen Python Scripting for Computational Science Third Edition With 62 Figures 43 Springer Table of Contents 1 Introduction... 1 1.1 Scripting versus Traditional Programming... 1 1.1.1

More information

Python Scripting for Computational Science

Python Scripting for Computational Science Hans Petter Langtangen Python Scripting for Computational Science Third Edition With 62 Figures Sprin ger Table of Contents 1 Introduction 1 1.1 Scripting versus Traditional Programming 1 1.1.1 Why Scripting

More information

Mixed language programming

Mixed language programming Mixed language programming Simon Funke 1,2 Ola Skavhaug 3 Joakim Sundnes 1,2 Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory 1 Dept. of Informatics, University of

More information

The G3 F2PY for connecting Python to Fortran 90 programs

The G3 F2PY for connecting Python to Fortran 90 programs The G3 F2PY for connecting Python to Fortran 90 programs Pearu Peterson pearu@simula.no F2PY What is it? Example. What more it can do? What it cannot do? G3 F2PY The 3rd generation of F2PY. Aims and status.

More information

Mixed language programming with NumPy arrays

Mixed language programming with NumPy arrays Mixed language programming with NumPy arrays Simon Funke 1,2 Ola Skavhaug 3 Joakim Sundnes 1,2 Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory 1 Dept. of Informatics,

More information

Python where we can, C ++ where we must

Python where we can, C ++ where we must Python where we can, C ++ where we must Source: http://xkcd.com/353/ Guy K. Kloss Python where we can,c++ where we must 1/28 Python where we can, C ++ where we must Guy K. Kloss BarCamp Auckland 2007 15

More information

Introduction to Scripting Languages. October 2017

Introduction to Scripting Languages. October 2017 Introduction to Scripting Languages damien.francois@uclouvain.be October 2017 1 Goal of this session: Advocate the use of scripting languages and help you choose the most suitable for your needs 2 Agenda

More information

Astronomical Data Analysis with Python

Astronomical Data Analysis with Python Astronomical Data Analysis with Python Lecture 8 Yogesh Wadadekar NCRA-TIFR July August 2010 Yogesh Wadadekar (NCRA-TIFR) Topical course 1 / 27 Slides available at: http://www.ncra.tifr.res.in/ yogesh/python_course_2010/

More information

C - extensions. only a small part of application benefits from compiled code

C - extensions. only a small part of application benefits from compiled code C - EXTENSIONS C - extensions Some times there are time critical parts of code which would benefit from compiled language 90/10 rule: 90 % of time is spent in 10 % of code only a small part of application

More information

Introduction to Scientific Computing with Python, part two.

Introduction to Scientific Computing with Python, part two. Introduction to Scientific Computing with Python, part two. M. Emmett Department of Mathematics University of North Carolina at Chapel Hill June 20 2012 The Zen of Python zen of python... fire up python

More information

Python, C, C++, and Fortran Relationship Status: It s Not That Complicated. Philip Semanchuk

Python, C, C++, and Fortran Relationship Status: It s Not That Complicated. Philip Semanchuk Python, C, C++, and Fortran Relationship Status: It s Not That Complicated Philip Semanchuk (philip@pyspoken.com) This presentation is part of a talk I gave at PyData Carolinas 2016. This presentation

More information

Advanced and Parallel Python

Advanced and Parallel Python Advanced and Parallel Python December 1st, 2016 http://tinyurl.com/cq-advanced-python-20161201 By: Bart Oldeman and Pier-Luc St-Onge 1 Financial Partners 2 Setup for the workshop 1. Get a user ID and password

More information

LECTURE 19. Numerical and Scientific Packages

LECTURE 19. Numerical and Scientific Packages LECTURE 19 Numerical and Scientific Packages NUMERICAL AND SCIENTIFIC APPLICATIONS As you might expect, there are a number of third-party packages available for numerical and scientific computing that

More information

Python for Earth Scientists

Python for Earth Scientists Python for Earth Scientists Andrew Walker andrew.walker@bris.ac.uk Python is: A dynamic, interpreted programming language. Python is: A dynamic, interpreted programming language. Data Source code Object

More information

LECTURE 22. Numerical and Scientific Packages

LECTURE 22. Numerical and Scientific Packages LECTURE 22 Numerical and Scientific Packages NUMERIC AND SCIENTIFIC APPLICATIONS As you might expect, there are a number of third-party packages available for numerical and scientific computing that extend

More information

Part VI. Scientific Computing in Python. Alfredo Parra : Scripting with Python Compact Max-PlanckMarch 6-10,

Part VI. Scientific Computing in Python. Alfredo Parra : Scripting with Python Compact Max-PlanckMarch 6-10, Part VI Scientific Computing in Python Compact Course @ Max-PlanckMarch 6-10, 2017 63 Doing maths in Python Standard sequence types (list, tuple,... ) Can be used as arrays Can contain different types

More information

Scientific Computing: Lecture 1

Scientific Computing: Lecture 1 Scientific Computing: Lecture 1 Introduction to course, syllabus, software Getting started Enthought Canopy, TextWrangler editor, python environment, ipython, unix shell Data structures in Python Integers,

More information

Contents Computing with Formulas

Contents Computing with Formulas Contents 1 Computing with Formulas... 1 1.1 The First Programming Encounter: a Formula... 1 1.1.1 Using a Program as a Calculator... 2 1.1.2 About Programs and Programming... 2 1.1.3 Tools for Writing

More information

Day 15: Science Code in Python

Day 15: Science Code in Python Day 15: Science Code in Python 1 Turn In Homework 2 Homework Review 3 Science Code in Python? 4 Custom Code vs. Off-the-Shelf Trade-offs Costs (your time vs. your $$$) Your time (coding vs. learning) Control

More information

Introduction to Python. Didzis Gosko

Introduction to Python. Didzis Gosko Introduction to Python Didzis Gosko Scripting language From Wikipedia: A scripting language or script language is a programming language that supports scripts, programs written for a special run-time environment

More information

Scientific Computing with Python and CUDA

Scientific Computing with Python and CUDA Scientific Computing with Python and CUDA Stefan Reiterer High Performance Computing Seminar, January 17 2011 Stefan Reiterer () Scientific Computing with Python and CUDA HPC Seminar 1 / 55 Inhalt 1 A

More information

Introduction to Scientific Computing

Introduction to Scientific Computing University of Tartu, Institute of Computer Science Introduction to Scientific Computing MTAT.08.025 eero.vainikko@ut.ee Spring 2017 2 Practical information Lectures: Liivi 2-122 MON 10:15 Computer classes:

More information

Swiginac - Extending Python with Symbolic Mathematics

Swiginac - Extending Python with Symbolic Mathematics Famms Swiginac Swiginac - Extending Python with Symbolic Mathematics Ola Skavhaug 1,2 Ondrej Certic 3,4 Simula Research Laboratory 1 Dept. of Informatics, University of Oslo 2 Faculty of Mathematics and

More information

ENGR 102 Engineering Lab I - Computation

ENGR 102 Engineering Lab I - Computation ENGR 102 Engineering Lab I - Computation Learning Objectives by Week 1 ENGR 102 Engineering Lab I Computation 2 Credits 2. Introduction to the design and development of computer applications for engineers;

More information

Lezione 7. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Lezione 7. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi Lezione 7 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza BioPython Installing and exploration Tutorial

More information

Python Programming, bridging course 2011

Python Programming, bridging course 2011 Python Programming, bridging course 2011 About the course Few lectures Focus on programming practice Slides on the homepage No course book. Using online resources instead. Online Python resources http://www.python.org/

More information

Introduction to Scientific Computing with Matlab

Introduction to Scientific Computing with Matlab Introduction to Scientific Computing with Matlab Matlab is an interactive system for numerical computations. It is widely used in universities and industry, and has many advantages over languages such

More information

MatLab Just a beginning

MatLab Just a beginning MatLab Just a beginning P.Kanungo Dept. of E & TC, C.V. Raman College of Engineering, Bhubaneswar Introduction MATLAB is a high-performance language for technical computing. MATLAB is an acronym for MATrix

More information

NAG at Manchester. Michael Croucher (University of Manchester)

NAG at Manchester. Michael Croucher (University of Manchester) NAG at Manchester Michael Croucher (University of Manchester) Michael.Croucher@manchester.ac.uk www.walkingrandomly.com Twitter: @walkingrandomly My background PhD Computational Physics from Sheffield

More information

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled

Interpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac

More information

Python on GACRC Computing Resources

Python on GACRC Computing Resources Python on GACRC Computing Resources Georgia Advanced Computing Resource Center EITS/University of Georgia Zhuofei Hou, zhuofei@uga.edu 1 Outline GACRC Python Overview Python on Clusters Python Packages

More information

Scientific computing platforms at PGI / JCNS

Scientific computing platforms at PGI / JCNS Member of the Helmholtz Association Scientific computing platforms at PGI / JCNS PGI-1 / IAS-1 Scientific Visualization Workshop Josef Heinen Outline Introduction Python distributions The SciPy stack Julia

More information

CODE-GENERATION FOR DIFFERENTIAL EQUATION SOLVERS

CODE-GENERATION FOR DIFFERENTIAL EQUATION SOLVERS CODE-GENERATION FOR DIFFERENTIAL EQUATION SOLVERS Dániel Berényi Wigner RCP, GPU Laboratory, Budapest, Hungary Perspectives of GPU Computing in Physics and Astrophysics Rome 2014. INTRODUCTION The most

More information

SciPy. scipy [www.scipy.org and links on course web page] scipy arrays

SciPy. scipy [www.scipy.org and links on course web page] scipy arrays SciPy scipy [www.scipy.org and links on course web page] - scipy is a collection of many useful numerical algorithms (numpy is the array core) - Python wrappers around compiled libraries and subroutines

More information

System Design S.CS301

System Design S.CS301 System Design S.CS301 (Autumn 2015/16) Page 1 Agenda Contents: Course overview Reading materials What is the MATLAB? MATLAB system History of MATLAB License of MATLAB Release history Syntax of MATLAB (Autumn

More information

Python for Scientists

Python for Scientists High level programming language with an emphasis on easy to read and easy to write code Includes an extensive standard library We use version 3 History: Exists since 1991 Python 3: December 2008 General

More information

Introduction to Mathematical Programming

Introduction to Mathematical Programming Introduction to Mathematical Programming Ming Zhong Lecture 3 September 5, 2018 Ming Zhong (JHU) AMS Fall 2018 1 / 14 Programming with MATLAB Table of Contents 1 Programming with MATLAB 2 Logic, Loops

More information

A Short History of Array Computing in Python. Wolf Vollprecht, PyParis 2018

A Short History of Array Computing in Python. Wolf Vollprecht, PyParis 2018 A Short History of Array Computing in Python Wolf Vollprecht, PyParis 2018 TOC - - Array computing in general History up to NumPy Libraries after NumPy - Pure Python libraries - JIT / AOT compilers - Deep

More information

F21SC Industrial Programming: Python: Python Libraries

F21SC Industrial Programming: Python: Python Libraries F21SC Industrial Programming: Python: Python Libraries Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2017/18 0 No proprietary software has

More information

PYTHON FOR MEDICAL PHYSICISTS. Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital

PYTHON FOR MEDICAL PHYSICISTS. Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital PYTHON FOR MEDICAL PHYSICISTS Radiation Oncology Medical Physics Cancer Care Services, Royal Brisbane & Women s Hospital TUTORIAL 1: INTRODUCTION Thursday 1 st October, 2015 AGENDA 1. Reference list 2.

More information

The SciPy Stack. Jay Summet

The SciPy Stack. Jay Summet The SciPy Stack Jay Summet May 1, 2014 Outline Numpy - Arrays, Linear Algebra, Vector Ops MatPlotLib - Data Plotting SciPy - Optimization, Scientific functions TITLE OF PRESENTATION 2 What is Numpy? 3rd

More information

Matrex Table of Contents

Matrex Table of Contents Matrex Table of Contents Matrex...1 What is the equivalent of a spreadsheet in Matrex?...2 Why I should use Matrex instead of a spreadsheet application?...3 Concepts...4 System architecture in the future

More information

Get It Interpreter Scripts Arrays. Basic Python. K. Cooper 1. 1 Department of Mathematics. Washington State University. Basics

Get It Interpreter Scripts Arrays. Basic Python. K. Cooper 1. 1 Department of Mathematics. Washington State University. Basics Basic Python K. 1 1 Department of Mathematics 2018 Python Guido van Rossum 1994 Original Python was developed to version 2.7 2010 2.7 continues to receive maintenance New Python 3.x 2008 The 3.x version

More information

Introduction to Numerical Python. Matthijs Douze SED Grenoble

Introduction to Numerical Python. Matthijs Douze SED Grenoble Introduction to Numerical Python Matthijs Douze SED Grenoble What should I talk about? Python (and numpy) is very rich threshold to make a new library is low everyone makes libraries! choose what is worthwhile

More information

python. a presentation to the Rice University CS Club November 30, 2006 Daniel Sandler

python. a presentation to the Rice University CS Club November 30, 2006 Daniel Sandler python. a presentation to the Rice University CS Club November 30, 2006 Daniel Sandler http://www.cs.rice.edu/~dsandler/python/ 1. 2. 3. 4. 1. A young mind is corrupted. Me, circa 2000 (very busy) Many

More information

Sunpy Python for Solar Physics Juan Carlos Martínez Oliveros

Sunpy Python for Solar Physics Juan Carlos Martínez Oliveros Sunpy Python for Solar Physics Juan Carlos Martínez Oliveros In the beginning (ENIAC) Evolution Evolution Evolution Introduction The SunPy project is an effort to create an opensource software library

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

The Python Scripting Language. Slides (mostly) by: Bob Dowling Presented by: Bruce Beckles University of Cambridge Computing Service

The Python Scripting Language. Slides (mostly) by: Bob Dowling Presented by: Bruce Beckles University of Cambridge Computing Service The Python Scripting Language Slides (mostly) by: Bob Dowling Presented by: Bruce Beckles University of Cambridge Computing Service 1 Why Python? e-science interviews basic programming skills easy access

More information

Chapter 2. MathScript

Chapter 2. MathScript Chapter 2. MathScript 2.1 What is MathScript MathScript is math-oriented, text-based computing language to address tasks mathematic calculation: Most suitable for Mathematic calculation. Matrix based data

More information

1 Week 1: Basics of scientific programming I

1 Week 1: Basics of scientific programming I MTH739N/P/U: Topics in Scientific Computing Autumn 2016 1 Week 1: Basics of scientific programming I 1.1 Introduction The aim of this course is use computing software platforms to solve scientific and

More information

Lezione 7. BioPython. Contents. BioPython Installing and exploration Tutorial. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi

Lezione 7. BioPython. Contents. BioPython Installing and exploration Tutorial. Bioinformatica. Mauro Ceccanti e Alberto Paoluzzi Lezione 7 Bioinformatica Mauro Ceccanti e Alberto Paoluzzi Dip. Informatica e Automazione Università Roma Tre Dip. Medicina Clinica Università La Sapienza with Biopython Biopython is a set of freely available

More information

ARTIFICIAL INTELLIGENCE AND PYTHON

ARTIFICIAL INTELLIGENCE AND PYTHON ARTIFICIAL INTELLIGENCE AND PYTHON DAY 1 STANLEY LIANG, LASSONDE SCHOOL OF ENGINEERING, YORK UNIVERSITY WHAT IS PYTHON An interpreted high-level programming language for general-purpose programming. Python

More information

Extensions in C and Fortran

Extensions in C and Fortran Extensions in C and Fortran Why? C and Fortran are compiled languages Source code is translated to machine instructons by the compiler before you run. Ex: gfortran -o mycode mycode.f90 gcc -o mycode mycode.c

More information

pandas: Rich Data Analysis Tools for Quant Finance

pandas: Rich Data Analysis Tools for Quant Finance pandas: Rich Data Analysis Tools for Quant Finance Wes McKinney April 24, 2012, QWAFAFEW Boston about me MIT 07 AQR Capital: 2007-2010 Global Macro and Credit Research WES MCKINNEY pandas: 2008 - Present

More information

STEPHEN WOLFRAM MATHEMATICADO. Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS

STEPHEN WOLFRAM MATHEMATICADO. Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS STEPHEN WOLFRAM MATHEMATICADO OO Fourth Edition WOLFRAM MEDIA CAMBRIDGE UNIVERSITY PRESS Table of Contents XXI a section new for Version 3 a section new for Version 4 a section substantially modified for

More information

Introduction to the Julia language. Marc Fuentes - SED Bordeaux

Introduction to the Julia language. Marc Fuentes - SED Bordeaux Introduction to the Julia language Marc Fuentes - SED Bordeaux Outline 1 motivations Outline 1 motivations 2 Julia as a numerical language Outline 1 motivations 2 Julia as a numerical language 3 types

More information

phcpy: an API for PHCpack

phcpy: an API for PHCpack phcpy: an API for PHCpack Jan Verschelde University of Illinois at Chicago Department of Mathematics, Statistics, and Computer Science http://www.math.uic.edu/ jan jan@math.uic.edu Graduate Computational

More information

On the performance of the Python programming language for serial and parallel scientific computations

On the performance of the Python programming language for serial and parallel scientific computations Scientific Programming 13 (2005) 31 56 31 IOS Press On the performance of the Python programming language for serial and parallel scientific computations Xing Cai a,b, Hans Petter Langtangen a,b and Halvard

More information

Part VI. Scientific Computing in Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,

Part VI. Scientific Computing in Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26, Part VI Scientific Computing in Python Compact Course @ Max-Planck, February 16-26, 2015 81 More on Maths Module math Constants pi and e Functions that operate on int and float All return values float

More information

Introduction to Python Part 2

Introduction to Python Part 2 Introduction to Python Part 2 v0.2 Brian Gregor Research Computing Services Information Services & Technology Tutorial Outline Part 2 Functions Tuples and dictionaries Modules numpy and matplotlib modules

More information

Chapter 1 Introduction to MATLAB

Chapter 1 Introduction to MATLAB Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,

More information

http://tinyurl.com/cq-advanced-python-20151029 1 2 ##: ********** ## csuser## @[S## ********** guillimin.hpc.mcgill.ca class## ********** qsub interactive.pbs 3 cp -a /software/workshop/cq-formation-advanced-python

More information

PYTHON IS SLOW. Make it faster with C. Ben Shaw

PYTHON IS SLOW. Make it faster with C. Ben Shaw PYTHON IS SLOW Make it faster with C Ben Shaw It s OK that Python isn t fast, you can write your slow functions in C! Everyone TABLE OF CONTENTS C Module vs C Types TABLE OF CONTENTS C Module vs C Types

More information

Scientific Python. 1 of 10 23/11/ :00

Scientific Python.   1 of 10 23/11/ :00 Scientific Python Neelofer Banglawala Kevin Stratford nbanglaw@epcc.ed.ac.uk kevin@epcc.ed.ac.uk Original course authors: Andy Turner Arno Proeme 1 of 10 23/11/2015 00:00 www.archer.ac.uk support@archer.ac.uk

More information

MATLAB to iphone Made Easy

MATLAB to iphone Made Easy MATLAB to iphone Made Easy Generating readable and portable C code from your MATLAB algorithms for your iphone or ipad app Bill Chou 2014 The MathWorks, Inc. 1 2 4 Quick Demo MATLAB Coder >> Demo 5 Agenda

More information

Introduction to Python for Scientific Computing

Introduction to Python for Scientific Computing 1 Introduction to Python for Scientific Computing http://tinyurl.com/cq-intro-python-20151022 By: Bart Oldeman, Calcul Québec McGill HPC Bart.Oldeman@calculquebec.ca, Bart.Oldeman@mcgill.ca Partners and

More information

Matlab Advanced Programming. Matt Wyant University of Washington

Matlab Advanced Programming. Matt Wyant University of Washington Matlab Advanced Programming Matt Wyant University of Washington Matlab as a programming Language Strengths (as compared to C/C++/Fortran) Fast to write -no type declarations needed Memory allocation/deallocation

More information

tutorial : modeling synaptic plasticity

tutorial : modeling synaptic plasticity tutorial : modeling synaptic plasticity Computational Neuroscience by the Mediterranean Winter School, Jan 20th, 2016 Michael Graupner Université Paris Descartes CNRS UMR 8118, Paris, France michael.graupner@parisdescartes.fr

More information

Function call overhead benchmarks with MATLAB, Octave, Python, Cython and C

Function call overhead benchmarks with MATLAB, Octave, Python, Cython and C Function call overhead benchmarks with MATLAB, Octave, Python, Cython and C André Gaul September 23, 2018 arxiv:1202.2736v1 [cs.pl] 13 Feb 2012 1 Background In many applications a function has to be called

More information

First Time Experiences Using SciPy for Computer Vision Research

First Time Experiences Using SciPy for Computer Vision Research First Time Experiences Using SciPy for Computer Vision Research Damian Eads and Edward Rosten ISR Division Los Alamos National Laboratory Los Alamos, New Mexico {eads,edrosten}@lanl.gov Find the cars Research

More information

Scientific Computing using Python

Scientific Computing using Python Scientific Computing using Python Swaprava Nath Dept. of CSE IIT Kanpur mini-course webpage: https://swaprava.wordpress.com/a-short-course-on-python/ Disclaimer: the contents of this lecture series are

More information

AMath 483/583 Lecture 8

AMath 483/583 Lecture 8 AMath 483/583 Lecture 8 This lecture: Fortran subroutines and functions Arrays Dynamic memory Reading: class notes: Fortran Arrays class notes: Fortran Subroutines and Functions class notes: gfortran flags

More information

MS6021 Scientific Computing. MatLab and Python for Mathematical Modelling. Aimed at the absolute beginner.

MS6021 Scientific Computing. MatLab and Python for Mathematical Modelling. Aimed at the absolute beginner. MS6021 Scientific Computing MatLab and Python for Mathematical Modelling. Aimed at the absolute beginner. Natalia Kopteva Email: natalia.kopteva@ul.ie Web: http://www.staff.ul.ie/natalia/ Room: B2037 Office

More information

Exceptions in Python. AMath 483/583 Lecture 27 May 27, Exceptions in Python. Exceptions in Python

Exceptions in Python. AMath 483/583 Lecture 27 May 27, Exceptions in Python. Exceptions in Python AMath 483/583 Lecture 27 May 27, 2011 Today: Python exception handling Python plus Fortran: f2py Next week: More Python plus Fortran Visualization Parallel IPython Read: Class notes and references If you

More information

Python for Science and Engineering

Python for Science and Engineering Python for Science and Engineering Hans-Petter Halvorsen https://www.halvorsen.blog Python for Science and Engineering Python for Science and Engineering Hans-Petter Halvorsen 2018 Python for Science and

More information

Lecture 1: What is MATLAB?

Lecture 1: What is MATLAB? Lecture 1: What is MATLAB? Dr. Mohammed Hawa Electrical Engineering Department University of Jordan EE201: Computer Applications. See Textbook Chapter 1. MATLAB MATLAB (MATrix LABoratory) is a numerical

More information

Introduction to Scientific Computing Languages

Introduction to Scientific Computing Languages 1 / 1 Introduction to Scientific Computing Languages Prof. Paolo Bientinesi pauldj@aices.rwth-aachen.de Languages for Scientific Computing 2 / 1 What is a programming language? Languages for Scientific

More information

Study guide: Algorithms and implementations for exponential decay models

Study guide: Algorithms and implementations for exponential decay models Study guide: Algorithms and implementations for exponential decay models Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory 1 Department of Informatics, University of

More information

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

Ordinary Differential Equation Solver Language (ODESL) Reference Manual Ordinary Differential Equation Solver Language (ODESL) Reference Manual Rui Chen 11/03/2010 1. Introduction ODESL is a computer language specifically designed to solve ordinary differential equations (ODE

More information

Introduction to Scientific Computing Languages

Introduction to Scientific Computing Languages 1 / 17 Introduction to Scientific Computing Languages Prof. Paolo Bientinesi pauldj@aices.rwth-aachen.de Languages for Scientific Computing 2 / 17 What is a programming language? Languages for Scientific

More information

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing SECTION 1: INTRODUCTION ENGR 112 Introduction to Engineering Computing 2 Course Overview What is Programming? 3 Programming The implementation of algorithms in a particular computer programming language

More information

Phys Techniques of Radio Astronomy Part 1: Python Programming LECTURE 3

Phys Techniques of Radio Astronomy Part 1: Python Programming LECTURE 3 Phys 60441 Techniques of Radio Astronomy Part 1: Python Programming LECTURE 3 Tim O Brien Room 3.214 Alan Turing Building tim.obrien@manchester.ac.uk Tuples Lists and strings are examples of sequences.

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

More information

2.0 MATLAB Fundamentals

2.0 MATLAB Fundamentals 2.0 MATLAB Fundamentals 2.1 INTRODUCTION MATLAB is a computer program for computing scientific and engineering problems that can be expressed in mathematical form. The name MATLAB stands for MATrix LABoratory,

More information

Managing Your Biological Data with Python

Managing Your Biological Data with Python Chapman & Hall/CRC Mathematical and Computational Biology Series Managing Your Biological Data with Python Ailegra Via Kristian Rother Anna Tramontano CRC Press Taylor & Francis Group Boca Raton London

More information

CVEN 302. Computer Applications in Engineering and Construction. Dr. Tony Cahill Environmental and Water Resources Division

CVEN 302. Computer Applications in Engineering and Construction. Dr. Tony Cahill Environmental and Water Resources Division CVEN 302 Computer Applications in Engineering and Construction Dr. Tony Cahill Environmental and Water Resources Division Instructors Instructor: Tony Cahill Office: WERC 205J Office Hours: T/R 3:00 4:00PM.

More information

The Cantor Handbook. Alexander Rieder

The Cantor Handbook. Alexander Rieder Alexander Rieder 2 Contents 1 Introduction 5 2 Using Cantor 6 2.1 Cantor features....................................... 6 2.2 The Cantor backends.................................... 7 2.3 The Cantor Workspace...................................

More information

python 01 September 16, 2016

python 01 September 16, 2016 python 01 September 16, 2016 1 Introduction to Python adapted from Steve Phelps lectures - (http://sphelps.net) 2 Python is interpreted Python is an interpreted language (Java and C are not). In [1]: 7

More information

Introduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis

Introduction to Matlab. Summer School CEA-EDF-INRIA 2011 of Numerical Analysis Introduction to Matlab 1 Outline What is Matlab? Matlab desktop & interface Scalar variables Vectors and matrices Exercise 1 Booleans Control structures File organization User defined functions Exercise

More information

Deconstructing Java TM

Deconstructing Java TM Deconstructing Java TM Gilad Bracha 1 Original Sin: Primitive Types Eight types: bool, byte, char, short, int, long, float, double... and void too! Eight special cases in many APIs Cannot store in collections

More information

PYTABLES & Family. Analyzing and Sharing HDF5 Data with Python. Francesc Altet. HDF Workshop November 30, December 2, Cárabos Coop. V.

PYTABLES & Family. Analyzing and Sharing HDF5 Data with Python. Francesc Altet. HDF Workshop November 30, December 2, Cárabos Coop. V. & Family Analyzing and Sharing HDF5 Data with Python Cárabos Coop. V. HDF Workshop November 30, 2005 - December 2, 2005. & Family Who are we? An Introduction to the Python Language Cárabos is the company

More information

Supporting Data Parallelism in Matcloud: Final Report

Supporting Data Parallelism in Matcloud: Final Report Supporting Data Parallelism in Matcloud: Final Report Yongpeng Zhang, Xing Wu 1 Overview Matcloud is an on-line service to run Matlab-like script on client s web browser. Internally it is accelerated by

More information

NumPy quick reference

NumPy quick reference John W. Shipman 2016-05-30 12:28 Abstract A guide to the more common functions of NumPy, a numerical computation module for the Python programming language. This publication is available in Web form1 and

More information

Python: Swiss-Army Glue. Josh Karpel Graduate Student, Yavuz Group UW-Madison Physics Department

Python: Swiss-Army Glue. Josh Karpel Graduate Student, Yavuz Group UW-Madison Physics Department 1 Python: Swiss-Army Glue Josh Karpel Graduate Student, Yavuz Group UW-Madison Physics Department My Research: Matrix Multiplication 2 My Research: Computational Quantum Mechanics 3 Why

More information

Time : 3 hours. Full Marks : 75. Own words as far as practicable. The questions are of equal value. Answer any five questions.

Time : 3 hours. Full Marks : 75. Own words as far as practicable. The questions are of equal value. Answer any five questions. XEV (H-3) BCA (6) 2 0 1 0 Time : 3 hours Full Marks : 75 Candidates are required to give their answers in their Own words as far as practicable. The questions are of equal value. Answer any five questions.

More information

(Ca...

(Ca... 1 of 8 9/7/18, 1:59 PM Getting started with 228 computational exercises Many physics problems lend themselves to solution methods that are best implemented (or essentially can only be implemented) with

More information

Appendix B Boost.Python

Appendix B Boost.Python Financial Modelling in Python By S. Fletcher & C. Gardner 2009 John Wiley & Sons Ltd Appendix B Boost.Python The Boost.Python library provides a framework for seamlessly wrapping C++ classes, functions

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Contents 1.1 Objectives... 1 1.2 Lab Requirement... 1 1.3 Background of MATLAB... 1 1.4 The MATLAB System... 1 1.5 Start of MATLAB... 3 1.6 Working Modes of MATLAB... 4 1.7 Basic

More information

David J. Pine. Introduction to Python for Science & Engineering

David J. Pine. Introduction to Python for Science & Engineering David J. Pine Introduction to Python for Science & Engineering To Alex Pine who introduced me to Python Contents Preface About the Author xi xv 1 Introduction 1 1.1 Introduction to Python for Science and

More information