turning expressions into functions symbolic substitution, series, and lambdify

Size: px
Start display at page:

Download "turning expressions into functions symbolic substitution, series, and lambdify"

Transcription

1 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables MCS 507 Lecture 7 Mathematical, Statistical and Scientific Software Jan Verschelde, 11 September 2013 Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

2 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

3 evaluating expressions Suppose we want to evaluate x 2 cos(y) + 4e z sin(x). >>> from math import cos, sin, exp >>> f = lambda x,y,z: x**2*cos(y) \ *exp(z)*sin(x) >>> f(1,2,3) >>> f(z=3,y=2,x=1) In f(z=3,y=2,x=1), we call f by its keyword arguments, linking the formal parameters x, y, z to the values 1, 2, 3. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

4 evaluating strings Restarting the interactive Python session, making a function for x 2 cos(y) + 4e z sin(x), stored in a string: >>> e = x**2*cos(y) + 4*exp(z)*sin(x) >>> from math import cos, sin, exp >>> f = lambda x,y,z: eval(e) >>> f(1,2,3) >>> f(z=3,x=1,y=2) Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

5 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

6 symbolic substitution With the substitution of sympy, we can evaluate an expression in symbolically, e.g., to permute the variables (x, y, z) (z, y, x): >>> from sympy import * >>> x,y,z = var( x,y,z ) >>> e = x**2*cos(y) + 4*exp(z)*sin(x) >>> Subs(e,(x,y,z),(z,y,x)) Subs(_x**2*cos(_y) + 4*exp(_z)*sin(_x), \ (_x, _y, _z), (z, y, x)) >>> _.doit() z**2*cos(y) + 4*exp(x)*sin(z) Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

7 approximating functions With series we do symbolic-numeric computation: >>> from sympy import * >>> x = var( x ) >>> sin(x).series(x,x0=0,n=7) x - x**3/6 + x**5/120 + O(x**7) Using an iterator: >>> s = sin(x).series(x,n=none) >>> L = [s.next() for i in range(3)]; L [x, -x**3/6, x**5/120] We experience the O(x**7) when evaluating: >>> S = sum(l) >>> Subs(S,(x),(0.01)).doit() >>> Subs(sin(x),(x),(0.01)).doit() Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

8 lambdify >>> from sympy.utilities import lambdify >>> help(lambdify) >>> from sympy.abc import x >>> f = lambdify(x,x**2) >>> f(2) 4 >>> g = lambdify(x,"x**2") >>> g <function <lambda> at 0x23b3b90> >>> g(3) 9 Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

9 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

10 a function definition def fun(xarg, yarg, zarg): """ Returns the value of the expression xarg**2*cos(yarg) + 4*exp(zarg)*sin(xarg) for numerical values of the formal arguments xarg, yarg, and zarg. """ from math import exp, cos, sin result = xarg**2*cos(yarg) + 4*exp(zarg)*sin(xarg) return result Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

11 function definitions A function header (e.g., def fun(xarg, yarg, zarg):) consists of 1 The name of the function (e.g., fun) follows def. 2 Formal arguments of the function are (e.g., xarg, yarg, zarg): between round brackets ( and ); separated by commas. Round brackets are needed even if no arguments. 3 The colon : follows ). The documentation string (between triple quotes) is optional, but is strongly recommended. The function body may have local variables, e.g., result. Values (e.g., result) are returned with return result. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

12 testing a function If we store the function definition for fun in the file ourfirstmodule.py, we can do >>> from ourfirstmodule import fun >>> fun(1,2,3) We import the function fun into an interactive Python session. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

13 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

14 help(ourfirstmodule) Help on module ourfirstmodule: NAME ourfirstmodule FILE /home/jan/courses/mcs507/fall13/lec07/ourfirstmodule.py DESCRIPTION A module is a collection of functions. This module exports two functions: fun and main. By the last line of this file, we can run this script at the command prompt $ as $ python ourfirstmodule.py. Alternatively, we can import fun and/or main in an interactive Python session. What follows under DESCRIPTION is the documentation string of the module, stored in the variable doc. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

15 help continued FUNCTIONS fun(xarg, yarg, zarg) Returns the value of the expression xarg**2*cos(yarg) + 4*exp(zarg)*sin(xarg) for numerical values of the formal arguments xarg, yarg, and zarg. main() Prompts the user for three values for the variables x, y, z and prints x**2*cos(y) + 4*exp(z)*sin(x). Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

16 the main function def main(): """ Prompts the user for three values for the variables x, y, z and prints x**2*cos(y) + 4*exp(z)*sin(x). """ print v = x**2*cos(y) + 4*exp(z)*sin(x) xval = input( give x : ) yval = input( give y : ) zval = input( give z : ) fval = fun(xval, yval, zval) print v =, fval At the time of the function call fun(xval, yval, zval), the values of xval, yval, zval are assigned to the formal arguments xarg, yarg, and zarg of the function definition. The variables xval, yval, zval are the actual arguments of the function. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

17 running main() We can also import the function main(). In order to run main() as a program at the command prompt $ $ python ourfirstmodule.py the last line in ourfirstmodule.py is if name == " main ": main() Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

18 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

19 the module search path The module sys exports the module search path as the dynamic object path. >>> import sys >>> sys.path [,...,...] sys.path[0] is the script directory, or. The order of the directories in the list returned by sys.path determines the order in which Python searches for modules to import. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

20 my math module def test(): print "This is my math module!" if name == " main ": test() If we save the code above as math.py in the current directory where we call the python interpreter, then: >>> import math >>> math.test() This is my math module! >> from math import cos Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name cos Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

21 doing an un-import What if we want to import the right math module? >>> import math >>> math.test() This is my math module! >>> import sys >>> sys.modules[ math ] <module math from math.py > >>> del sys.modules[ math ] modules is a dictionary of loaded modules, removing path[0]: >>> sys.path = sys.path[1:] >>> from math import cos >>> cos(3) Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

22 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

23 Sphinx generates documentation What is Sphinx? From Sphinx is a tool that makes it easy to create intelligent and beautiful documentation, written by Georg Brandl and licensed under the BSD license. It was originally created for the new Python documentation, and it has excellent facilities for the documentation of Python projects, but C/C++ is already supported as well, and it is planned to add special support for other languages as well. Sphinx uses restructuredtext as its markup language, and many of its strengths come from the power and straightforwardness of restructuredtext and its parsing and translating suite, the Docutils. The same documentation is generated in several formats, including latex, pdf, html. Why Sphinx? Used for the python language, numpy, sympy, matplotlib. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

24 step-by-step documentation generation Given Python code with documentation strings, generate documentation with Sphinx. There are a few steps to take: 1 Make a new directory doc and do "cd doc". 2 Run sphinx-quickstart in the doc directory. Following default options, doc contains a "Makefile" and two directories: "build" and "source". 3 Edit conf.py in source as follows: sys.path.insert(0, os.path.abspath( <path> )) where <path> is the directory where our Python code is. 4 Edit index.rst with ".. automodule::" lines. 5 Type "make latexpdf" or "make html" to generate. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

25 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

26 running sphinx-quickstart The doc directory is a subdirectory of the current directory that contains the module ourfirstmodule. Running sphinx-quickstart, some items: The root path is the current directory [.] if we run sphinx-quickstart in the doc directory. We want separate source and build directories. We can enter project name, author, version, and release numbers. Source files have suffix.rst. The master document is "index". We answer y to "autodoc" because we want automatically insert docstrings from modules. We answer y to "viewcode" to include links to the source code of documented Python objects. We also answer y to "Create Makefile?" Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

27 editing conf.py The source directory contains a file "conf.py" which we have to edit. sys.path.insert(0, os.path.abspath(../../ )) Because conf.py belongs to the directory source of the directory doc which is a subdirectory of the directory that contains ourfirstmodule.py. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

28 editing index.rst Welcome to ourfirstmodule s documentation! ========================================== The module ourfirstmodule is an example of a module. Example of use in the Python shell: :: >>> from ourfirstmodule import fun >>> fun(1,2,3) What follows after the :: will appear in a special format on html pages. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

29 use of automodule in index.rst the functions of ourfirstmodule The module ourfirstmodule exports one function fun and has a main program... automodule:: ourfirstmodule :members: The automodule will use the documentation string for each function of the module on the documentation pages. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

30 a screen shot Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

31 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

32 example_series.py from sympy import sin, cos, exp from sympy.abc import x, y, z e = x**2*cos(y) + 4*exp(z)*sin(x) # developing e about x = 0, 4th order print e.series(x, x0=0, n=4) # using an iterator of the series tx = e.series(x, x0=0, n=none) Lx = [tx.next() for i in range(3)] print Lx =, Lx e3x = sum(lx) # observe there is no O() in e3x print sum(lx) =, e3x produces 4*x*exp(z) + x**2*cos(y) - 2*x**3*exp(z)/3 + O(x**4) Lx = [4*x*exp(z), x**2*cos(y), -2*x**3*exp(z)/3] sum(lx) = -2*x**3*exp(z)/3 + x**2*cos(y) + 4*x*exp(z) Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

33 the script continued Only the middle term of Lx contains a function in y: prints # developing e3x about y = 1 ty = Lx[1].series(y, n=none) Ly = [ty.next() for i in range(2)] print Ly =, Ly e2y = sum(ly) print e2y =, e2y Ly = [x**2, -x**2*y**2/2] e2y = -x**2*y**2/2 + x**2 Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

34 developing in z gives print e2y =, e2y # developing z about z = 0, 3rd order tz0 = Lx[0].series(z, n=none) tz2 = Lx[2].series(z, n=none) Lz0 = [tz0.next() for i in range(2)] print Lz0 =, Lz0 Lz2 = [tz2.next() for i in range(2)] print Lz2 =, Lz2 s = sum(lz0) + sum(ly) + sum(lz2) print s =, s Lz0 = [4*x, 4*x*z] Lz2 = [-2*x**3/3, -2*x**3*z/3] s = -2*x**3*z/3-2*x**3/3 - x**2*y**2/2 \ + x**2 + 4*x*z + 4*x Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

35 checking the series from sympy import Subs v = (0.01, 1.01, 0.01) ev = Subs(e, (x, y, z), v).doit() sv = Subs(s, (x, y, z), v).doit() print expression value =, ev print series value =, sv print difference =, abs(ev - sv) shows expression value = series value = difference = e-6 Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

36 Defining Functions 1 Lambda Functions turning expressions into functions symbolic substitution, series, and lambdify 2 Functions and Modules writing a function definition defining and using modules where does Python find its modules? 3 Documenting Software with Sphinx Sphinx generates documentation generating documentation for ourfirstmodule 4 Computing Series Developments exploring an example with a script series for expressions in two variables Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

37 running define_series.py The series() of sympy does not seem to apply for functions of several variables... $ python define_series.py give an expression : sin(x)*cos(y) give pair of variables : x,y give pair of orders : 2,2 x**3*y**2/12 - x**3/6 - x*y**2/2 + x Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

38 the function main() import sympy as sp def main(): """ Prompts user for an expression, a pair of variables and orders. """ from sympy import sin, cos expression = raw_input( give an expression : ) varpair = raw_input( give pair of variables (e.g.: x, y) : ) orders = input( give pair of orders (e.g.: 3, 4) : ) symvars = sp.var(varpair) print bivariate_series(eval(expression), symvars, orders) if name == " main ": main() Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

39 list comprehensions def bivariate_series(epr, varpair, orders): """ Returns a series of the expression epr in the pair of variables in varpair of respective orders in the pair orders. """ terms = epr.series(varpair[0], n=none) eterms = safe_expand(terms, orders[0]) terms2 = [a.series(varpair[1], n=none) for a in eterms] eterms2 = [safe_expand(t, orders[1]) for t in terms2] return sum([sum(term) for term in eterms2]) Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

40 exception handling def safe_expand(terms, order): """ Given an iterator, returns the list of terms up to the order order. Uses an exception handler to catch cases when there is no next term. """ result = [] for i in xrange(order): try: result.append(terms.next()) except StopIteration: return result return result Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

41 Summary + Exercises We started chapter 3 of the text book. Exercises: 1 The function numpy.linspace(a,b,n) returns a list of n equally spaced points in [a,b]. Write your own function definition for linspace. You may assume that n is at least 2 and a < b. 2 Compute the length of a path in the plane given by a list of coordinates (as tuples), see Exercise Extend the script define_series.py so it works for expressions in three variables. Test your solution on the expression x 2 cos(y) + 4e x sin(x). Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

42 more exercises 4 The formula T(t) = T + (T(0) T )e kt models the temperature T in function of time t. For k > 0, T(t) declines and models how an object cools off. Define a Python function that takes as arguments T(0), T, k, t and that returns T(t). 5 Use Sage or sympy to make a series approximation for T(t) from the previous exercise. Make a Python function from the series. Take various orders and compare the values at t = 0.1. The second homework is due on Friday 20 September, at 9AM: solve exercises 1 and 3 of Lecture 4; exercises 4 and 5 of Lecture 5; exercises 1, 2 and 5 of Lecture 6; exercises 1, 2, and 4 of Lecture 7. Scientific Software (MCS 507 L-7) Defining Functions 11 September / 42

Defining Functions. turning expressions into functions. writing a function definition defining and using modules

Defining Functions. turning expressions into functions. writing a function definition defining and using modules Defining Functions 1 Lambda Functions turning expressions into functions 2 Functions and Modules writing a function definition defining and using modules 3 Computing Series Developments exploring an example

More information

PHCpack, phcpy, and Sphinx

PHCpack, phcpy, and Sphinx PHCpack, phcpy, and Sphinx 1 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies the Python interface phcpy 2 Documenting Software with Sphinx Sphinx generates documentation

More information

Packaging Python code and Sphinx

Packaging Python code and Sphinx Packaging Python code and Sphinx 1 Python packages extending Python with your own package making ourfirstpackage 2 the software PHCpack a package for Polynomial Homotopy Continuation polyhedral homotopies

More information

Lists and Loops. browse Python docs and interactive help

Lists and Loops. browse Python docs and interactive help Lists and Loops 1 Help in Python browse Python docs and interactive help 2 Lists in Python defining lists lists as queues and stacks inserting and removing membership and ordering lists 3 Loops in Python

More information

LECTURE 26. Documenting Python

LECTURE 26. Documenting Python LECTURE 26 Documenting Python DOCUMENTATION Being able to properly document code, especially large projects with multiple contributors, is incredibly important. Code that is poorly-documented is sooner

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

Numerical Integration

Numerical Integration Numerical Integration 1 Functions using Functions functions as arguments of other functions the one-line if-else statement functions returning multiple values 2 Constructing Integration Rules with sympy

More information

callback, iterators, and generators

callback, iterators, and generators callback, iterators, and generators 1 Adding a Callback Function a function for Newton s method a function of the user to process results 2 A Newton Iterator defining a counter class refactoring the Newton

More information

Lists and Loops. defining lists lists as queues and stacks inserting and removing membership and ordering lists

Lists and Loops. defining lists lists as queues and stacks inserting and removing membership and ordering lists Lists and Loops 1 Lists in Python defining lists lists as queues and stacks inserting and removing membership and ordering lists 2 Loops in Python for and while loops the composite trapezoidal rule MCS

More information

Root Finding Methods. sympy and Sage. MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011

Root Finding Methods. sympy and Sage. MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011 wrap Root Finding Methods 1 2 wrap MCS 507 Lecture 13 Mathematical, Statistical and Scientific Software Jan Verschelde, 21 September 2011 Root Finding Methods 1 wrap 2 wrap wrap octave-3.4.0:1> p = [1,0,2,-1]

More information

List Comprehensions and Simulations

List Comprehensions and Simulations List Comprehensions and Simulations 1 List Comprehensions examples in the Python shell zipping, filtering, and reducing 2 Monte Carlo Simulations testing the normal distribution the Mean Time Between Failures

More information

docs-python2readthedocs Documentation

docs-python2readthedocs Documentation docs-python2readthedocs Documentation Release 0.1.0 Matthew John Hayes Dec 01, 2017 Contents 1 Introduction 3 2 Install Sphinx 5 2.1 Pre-Work................................................. 5 2.2 Sphinx

More information

Interactive Computing

Interactive Computing Interactive Computing 1 Input/Output and Complex Arithmetic interactive Python scripts complex arithmetic 2 Python Coding Style and pylint coding style static code checking with pylint 3 Programming with

More information

How to Contribute to a Sphinx Doc Documentation

How to Contribute to a Sphinx Doc Documentation How to Contribute to a Sphinx Doc Documentation Release 1.0 Haoxi Zhan December 18, 2013 Contents 1 Install Sphinx 3 1.1 Linux................................................... 3 1.2 Mac OS X................................................

More information

differentiation techniques

differentiation techniques differentiation techniques 1 Callable Objects delayed execution of stored code 2 Numerical and Symbolic Differentiation numerical approximations for the derivative storing common code in a parent class

More information

Tuples and Nested Lists

Tuples and Nested Lists stored in hash 1 2 stored in hash 3 and 4 MCS 507 Lecture 6 Mathematical, Statistical and Scientific Software Jan Verschelde, 2 September 2011 and stored in hash 1 2 stored in hash 3 4 stored in hash tuples

More information

User Interfaces. getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy

User Interfaces. getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy User Interfaces 1 Command Line Interfaces getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy 2 Encapsulation by Object Oriented Programming

More information

SphinxTutorial Documentation

SphinxTutorial Documentation SphinxTutorial Documentation Release 1.0 Anthony Scemama April 12, 2013 CONTENTS 1 Introduction 3 2 Creating a new Sphinx project 5 3 restructuredtext 9 3.1 Sections..................................................

More information

Downloaded from Chapter 2. Functions

Downloaded from   Chapter 2. Functions Chapter 2 Functions After studying this lesson, students will be able to: Understand and apply the concept of module programming Write functions Identify and invoke appropriate predefined functions Create

More information

User Interfaces. MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September Command Line Interfaces

User Interfaces. MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September Command Line Interfaces User 1 2 MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September 2011 User 1 2 command line interfaces Many programs run without dialogue with user, as $ executable

More information

Effective Programming Practices for Economists. 13. Documenting (the code of) research projects

Effective Programming Practices for Economists. 13. Documenting (the code of) research projects Effective Programming Practices for Economists 13. Documenting (the code of) research projects Hans-Martin von Gaudecker Department of Economics, Universität Bonn At the end of this lecture you are able

More information

Web Clients and Crawlers

Web Clients and Crawlers Web Clients and Crawlers 1 Web Clients alternatives to web browsers opening a web page and copying its content 2 Scanning Files looking for strings between double quotes parsing URLs for the server location

More information

Lecture 3. Functions & Modules

Lecture 3. Functions & Modules Lecture 3 Functions & Modules Labs this Week Lab 1 is due at the beginning of your lab If it is not yet by then, you cannot get credit Only exception is for students who added late (Those students should

More information

Lecture 3. Functions & Modules

Lecture 3. Functions & Modules Lecture 3 Functions & Modules Labs this Week Lab 1 is due at the beginning of your lab If it is not yet by then, you cannot get credit Only exception is for students who added late (Those students should

More information

operator overloading algorithmic differentiation the class DifferentialNumber operator overloading

operator overloading algorithmic differentiation the class DifferentialNumber operator overloading operator overloading 1 Computing with Differential Numbers algorithmic differentiation the class DifferentialNumber operator overloading 2 Computing with Double Doubles the class DoubleDouble defining

More information

Branching and Enumeration

Branching and Enumeration Branching and Enumeration 1 Booleans and Branching computing logical expressions computing truth tables with Sage if, else, and elif 2 Timing Python Code try-except costs more than if-else 3 Recursive

More information

Python Programming Exercises 1

Python Programming Exercises 1 Python Programming Exercises 1 Notes: throughout these exercises >>> preceeds code that should be typed directly into the Python interpreter. To get the most out of these exercises, don t just follow them

More information

Python in 10 (50) minutes

Python in 10 (50) minutes Python in 10 (50) minutes https://www.stavros.io/tutorials/python/ Python for Microcontrollers Getting started with MicroPython Donald Norris, McGrawHill (2017) Python is strongly typed (i.e. types are

More information

LECTURE 9. Development Tools

LECTURE 9. Development Tools LECTURE 9 Development Tools DEVELOPMENT TOOLS Since you are all still in the earlier stages of your semester-long projects, now is a good time to cover some useful modules and tools for managing larger

More information

LECTURE 9. Development Tools

LECTURE 9. Development Tools LECTURE 9 Development Tools DEVELOPMENT TOOLS Since you are all still in the earlier stages of your semester-long projects, now is a good time to cover some useful modules and tools for managing larger

More information

Recommonmark Documentation

Recommonmark Documentation Recommonmark Documentation Release 0.5.0 Lu Zero, Eric Holscher, and contributors Jan 22, 2019 Contents 1 Contents 3 2 Getting Started 11 3 Development 13 4 Why a bridge? 15 5 Why another bridge to docutils?

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

Brandon Rhodes Python Atlanta, July 2009

Brandon Rhodes Python Atlanta, July 2009 The Sphinx Documentation System Brandon Rhodes Python Atlanta, July 2009 Three application models 1. Monolithic Big App Plain text PDF output HTML Special Format 1. Monolithic Big App Plain text PDF output

More information

Introduction to Python. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas

Introduction to Python. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Introduction to Python Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas If you have your own PC, download and install a syntax-highlighting text editor and Python

More information

Python Lists: Example 1: >>> items=["apple", "orange",100,25.5] >>> items[0] 'apple' >>> 3*items[:2]

Python Lists: Example 1: >>> items=[apple, orange,100,25.5] >>> items[0] 'apple' >>> 3*items[:2] Python Lists: Lists are Python's compound data types. A list contains items separated by commas and enclosed within square brackets ([]). All the items belonging to a list can be of different data type.

More information

Introduction to Python

Introduction to Python Introduction to Python Version 1.1.5 (12/29/2008) [CG] Page 1 of 243 Introduction...6 About Python...7 The Python Interpreter...9 Exercises...11 Python Compilation...12 Python Scripts in Linux/Unix & Windows...14

More information

PYTHON. Varun Jain & Senior Software Engineer. Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT. CenturyLink Technologies India PVT LTD

PYTHON. Varun Jain & Senior Software Engineer. Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT. CenturyLink Technologies India PVT LTD PYTHON Varun Jain & Senior Software Engineer Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT CenturyLink Technologies India PVT LTD 1 About Python Python is a general-purpose interpreted, interactive,

More information

Problem 1 (a): List Operations

Problem 1 (a): List Operations Problem 1 (a): List Operations Task 1: Create a list, L1 = [1, 2, 3,.. N] Suppose we want the list to have the elements 1, 2, 10 range(n) creates the list from 0 to N-1 But we want the list to start from

More information

CHAPTER 2: Introduction to Python COMPUTER PROGRAMMING SKILLS

CHAPTER 2: Introduction to Python COMPUTER PROGRAMMING SKILLS CHAPTER 2: Introduction to Python COMPUTER PROGRAMMING SKILLS 1439-1440 1 Outline 1. Introduction 2. Why Python? 3. Compiler and Interpreter 4. The first program 5. Comments and Docstrings 6. Python Indentations

More information

Lecture 4. Defining Functions

Lecture 4. Defining Functions Lecture 4 Defining Functions Academic Integrity Quiz Reading quiz about the course AI policy Go to http://www.cs.cornell.edu/courses/cs11110/ Click Academic Integrity in side bar Read and take quiz in

More information

CS Programming Languages: Python

CS Programming Languages: Python CS 3101-1 - Programming Languages: Python Lecture 5: Exceptions / Daniel Bauer (bauer@cs.columbia.edu) October 08 2014 Daniel Bauer CS3101-1 Python - 05 - Exceptions / 1/35 Contents Exceptions Daniel Bauer

More information

MS6021 Scientific Computing. TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing

MS6021 Scientific Computing. TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing MS6021 Scientific Computing TOPICS: Python BASICS, INTRO to PYTHON for Scientific Computing Preliminary Notes on Python (v MatLab + other languages) When you enter Spyder (available on installing Anaconda),

More information

Math 20A lecture 10 The Gradient Vector

Math 20A lecture 10 The Gradient Vector Math 20A lecture 10 p. 1/12 Math 20A lecture 10 The Gradient Vector T.J. Barnet-Lamb tbl@brandeis.edu Brandeis University Math 20A lecture 10 p. 2/12 Announcements Homework five posted, due this Friday

More information

Physics 514 Basic Python Intro

Physics 514 Basic Python Intro Physics 514 Basic Python Intro Emanuel Gull September 8, 2014 1 Python Introduction Download and install python. On Linux this will be done with apt-get, evince, portage, yast, or any other package manager.

More information

The RestructuredText Book Documentation

The RestructuredText Book Documentation The RestructuredText Book Documentation Release 0.1 Daniel Greenfeld, Eric Holscher Sep 27, 2017 Contents 1 RestructuredText Tutorial 3 2 RestructuredText Guide 5 2.1 Basics...................................................

More information

Introduction to Python. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas

Introduction to Python. Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Introduction to Python Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas If you have your own PC, download and install a syntax-highlighting text editor and Python

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

LECTURE 2. Python Basics

LECTURE 2. Python Basics LECTURE 2 Python Basics MODULES ''' Module fib.py ''' from future import print_function def even_fib(n): total = 0 f1, f2 = 1, 2 while f1 < n: if f1 % 2 == 0: total = total + f1 f1, f2 = f2, f1 + f2 return

More information

Core Python is small by design

Core Python is small by design Core Python is small by design One of the key features of Python is that the actual core language is fairly small. This is an intentional design feature to maintain simplicity. Much of the powerful functionality

More information

2. Modules, Scripts, and I/O. Quick Note on print. The Windchill Calculation. Script Mode. Motivating Script Mode 1/22/2016

2. Modules, Scripts, and I/O. Quick Note on print. The Windchill Calculation. Script Mode. Motivating Script Mode 1/22/2016 2. Modules, Scripts, and I/O Topics: Script Mode Modules The print and input statements Formatting First look at importing stuff from other modules The Windchill Calculation Let s compute the windchill

More information

Web Interfaces. the web server Apache processing forms with Python scripts Python code to write HTML

Web Interfaces. the web server Apache processing forms with Python scripts Python code to write HTML Web Interfaces 1 Python Scripts in Browsers the web server Apache processing forms with Python scripts Python code to write HTML 2 Web Interfaces for the Determinant dynamic interactive forms passing data

More information

lambda forms map(), reduce(), filter(), eval(), and apply() estimating π with list comprehensions

lambda forms map(), reduce(), filter(), eval(), and apply() estimating π with list comprehensions Outline 1 Guessing Secrets functions returning functions oracles and trapdoor functions 2 anonymous functions lambda forms map(), reduce(), filter(), eval(), and apply() estimating π with list comprehensions

More information

2. Modules, Scripts, and I/O

2. Modules, Scripts, and I/O 2. Modules, Scripts, and I/O Topics: Script Mode Modules The print and input statements Formatting First look at importing stuff from other modules The Windchill Calculation Let s compute the windchill

More information

Introduction to Python Documentation

Introduction to Python Documentation Introduction to Python Documentation Release v0.0.1 M.Faisal Junaid Butt August 18, 2015 Contents 1 Models 3 2 Auto Generated Documentation 5 3 Hello World Program Documentation 9 4 Practice 11 5 Indices

More information

a name refers to an object side effect of assigning composite objects

a name refers to an object side effect of assigning composite objects Outline 1 Formal Languages syntax and semantics Backus-Naur Form 2 Strings, Lists, and Tuples composite data types building data structures the % operator 3 Shared References a name refers to an object

More information

Babes-Bolyai University

Babes-Bolyai University Babes-Bolyai University arthur@cs.ubbcluj.ro Overview 1 Modules programming - a software design technique that increases the extent to which software is composed of independent, interchangeable components

More information

ME 121 MATLAB Lesson 01 Introduction to MATLAB

ME 121 MATLAB Lesson 01 Introduction to MATLAB 1 ME 121 MATLAB Lesson 01 Introduction to MATLAB Learning Objectives Be able run MATLAB in the MCECS computer labs Be able to perform simple interactive calculations Be able to open and view an m-file

More information

The Standard Library

The Standard Library Lab 2 The Standard Library Lab Objective: Python is designed to make it easy to implement complex tasks with little code. To that end, every Python distribution includes several built-in functions for

More information

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D 1/60 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.

More information

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15 1 LECTURE 1: INTRO Introduction to Scientific Python, CME 193 Jan. 9, 2014 web.stanford.edu/~ermartin/teaching/cme193-winter15 Eileen Martin Some slides are from Sven Schmit s Fall 14 slides 2 Course Details

More information

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D

Interactive use. $ python. >>> print 'Hello, world!' Hello, world! >>> 3 $ Ctrl-D 1/58 Interactive use $ python Python 2.7.5 (default, Mar 9 2014, 22:15:05) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information.

More information

Course Outline - COMP150. Lectures and Labs

Course Outline - COMP150. Lectures and Labs Course Outline - COMP150 Lectures and Labs 1 The way of the program 1.1 The Python programming language 1.2 What is a program? 1.3 What is debugging? 1.4 Experimental debugging 1.5 Formal and natural languages

More information

Data Science with Python Course Catalog

Data Science with Python Course Catalog Enhance Your Contribution to the Business, Earn Industry-recognized Accreditations, and Develop Skills that Help You Advance in Your Career March 2018 www.iotintercon.com Table of Contents Syllabus Overview

More information

Lecture 3: Functions & Modules (Sections ) CS 1110 Introduction to Computing Using Python

Lecture 3: Functions & Modules (Sections ) CS 1110 Introduction to Computing Using Python http://www.cs.cornell.edu/courses/cs1110/2019sp Lecture 3: Functions & Modules (Sections 3.1-3.3) CS 1110 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner,

More information

OOP and Scripting in Python Advanced Features

OOP and Scripting in Python Advanced Features OOP and Scripting in Python Advanced Features Giuliano Armano Emanuele Tamponi Advanced Features Structure of a Python Script More on Defining Functions Default Argument Values Keyword Arguments Arbitrary

More information

Python in Economics and Finance

Python in Economics and Finance Python in Economics and Finance Part 2 John Stachurski, ANU June 2014 Topics Data types OOP Iteration Functions NumPy / SciPy Matplotlib Data Types We have already met several native Python data types»>

More information

Symbolic and Automatic Di erentiation in Python

Symbolic and Automatic Di erentiation in Python Lab 15 Symbolic and Automatic Di erentiation in Python Lab Objective: Python is good for more than just analysis of numerical data. There are several packages available which allow symbolic and automatic

More information

PHY224 Practical Physics I. Lecture 2

PHY224 Practical Physics I. Lecture 2 PHY224 Practical Physics I Python Review Lecture 2 Sept. 15 16 16, 2014 Summary Functions and Modules Graphs (plotting with Pylab) Scipy packages References M H. Goldwasser, D. Letscher: Object oriented

More information

processing data with a database

processing data with a database processing data with a database 1 MySQL and MySQLdb MySQL: an open source database running MySQL for database creation MySQLdb: an interface to MySQL for Python 2 CTA Tables in MySQL files in GTFS feed

More information

import matplotlib as mpl # As of July 2017 Bucknell computers use v. 2.x import matplotlib.pyplot as plt

import matplotlib as mpl # As of July 2017 Bucknell computers use v. 2.x import matplotlib.pyplot as plt Intro to sympy: variables differentiation integration evaluation of symbolic expressions In [1]: import sympy as sym sym.init_printing() # for LaTeX formatted output import scipy as sp import matplotlib

More information

The RestructuredText Book Documentation

The RestructuredText Book Documentation The RestructuredText Book Documentation Release 1.0 Daniel Greenfeld, Eric Holscher Sep 05, 2018 Tutorial 1 Schedule 2 1.1 Getting Started: Overview & Installing Initial Project................ 2 1.2 Step

More information

Python INTRODUCTION: Understanding the Open source Installation of python in Linux/windows. Understanding Interpreters * ipython.

Python INTRODUCTION: Understanding the Open source Installation of python in Linux/windows. Understanding Interpreters * ipython. INTRODUCTION: Understanding the Open source Installation of python in Linux/windows. Understanding Interpreters * ipython * bpython Getting started with. Setting up the IDE and various IDEs. Setting up

More information

Tcl/Tk for XSPECT a Michael Flynn

Tcl/Tk for XSPECT a Michael Flynn Tcl/Tk for XSPECT a Michael Flynn Tcl: Tcl (i.e. Tool Command Language) is an open source scripting language similar to other modern script languages such as Perl or Python. It is substantially more powerful

More information

Ch.3: Functions and branching

Ch.3: Functions and branching Ch.3: Functions and branching Ole Christian Lingjærde, Dept of Informatics, UiO September 4-8, 2017 Today s agenda A small quiz to test understanding of lists Live-programming of exercises 2.7, 2.14, 2.15

More information

Documentation. David Grellscheid

Documentation. David Grellscheid Documentation David Grellscheid 2015-04-22 Documentation is communication Need to consider all levels, they have different audiences: Code annotations: formatting, comments Structure-level documentation

More information

Variable and Data Type 2

Variable and Data Type 2 The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Intro. To Computers (LNGG 1003) Lab 3 Variable and Data Type 2 Eng. Ibraheem Lubbad March 2, 2017 Python Lists: Lists

More information

ERTH3021 Exploration and Mining Geophysics

ERTH3021 Exploration and Mining Geophysics ERTH3021 Exploration and Mining Geophysics Practical 1: Introduction to Scientific Programming using Python Purposes To introduce simple programming skills using the popular Python language. To provide

More information

Table of Contents EVALUATION COPY

Table of Contents EVALUATION COPY Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...

More information

Interval Arithmetic. MCS 507 Lecture 29 Mathematical, Statistical and Scientific Software Jan Verschelde, 28 October 2011

Interval Arithmetic. MCS 507 Lecture 29 Mathematical, Statistical and Scientific Software Jan Verschelde, 28 October 2011 Naive Arithmetic 1 2 Naive 3 MCS 507 Lecture 29 Mathematical, Statistical and Scientific Software Jan Verschelde, 28 October 2011 Naive Arithmetic 1 2 Naive 3 an expression Naive Problem: Evaluate f(x,

More information

Data type built into Python. Dictionaries are sometimes found in other languages as associative memories or associative arrays.

Data type built into Python. Dictionaries are sometimes found in other languages as associative memories or associative arrays. NETB 329 Lecture 4 Data Structures in Python Dictionaries Data type built into Python. Dictionaries are sometimes found in other languages as associative memories or associative arrays. 1 of 70 Unlike

More information

Arbitrary Precision and Symbolic Calculations

Arbitrary Precision and Symbolic Calculations Arbitrary Precision and Symbolic Calculations K. 1 1 Department of Mathematics 2018 Sympy There are several packages for Python that do symbolic mathematics. The most prominent of these seems to be Sympy.

More information

Basic Syntax - First Program 1

Basic Syntax - First Program 1 Python Basic Syntax Basic Syntax - First Program 1 All python files will have extension.py put the following source code in a test.py file. print "Hello, Python!";#hello world program run this program

More information

Part IV. More on Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26,

Part IV. More on Python. Tobias Neckel: Scripting with Bash and Python Compact Max-Planck, February 16-26, Part IV More on Python Compact Course @ Max-Planck, February 16-26, 2015 36 More on Strings Special string methods (excerpt) s = " Frodo and Sam and Bilbo " s. islower () s. isupper () s. startswith ("

More information

Introducing Python Modules

Introducing Python Modules Introducing Python Modules Based on CBSE Curriculum Class -11 By- Neha Tyagi PGT CS KV 5 Jaipur II Shift Jaipur Region Neha Tyagi, PGT CS II Shift Jaipur Introduction A book is generally divided into chapters.

More information

CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial

CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial CSI31 Lecture 5 Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial 1 3.1 Numberic Data Types When computers were first developed, they were seen primarily as

More information

ENGR (Socolofsky) Week 07 Python scripts

ENGR (Socolofsky) Week 07 Python scripts ENGR 102-213 (Socolofsky) Week 07 Python scripts A couple programming examples for this week are embedded in the lecture notes for Week 7. We repeat these here as brief examples of typical array-like operations

More information

Running Cython. overview hello world with Cython. experimental setup adding type declarations cdef functions & calling external functions

Running Cython. overview hello world with Cython. experimental setup adding type declarations cdef functions & calling external functions Running Cython 1 Getting Started with Cython overview hello world with Cython 2 Numerical Integration experimental setup adding type declarations cdef functions & calling external functions 3 Using Cython

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

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

Computer Lab 1: Introduction to Python

Computer Lab 1: Introduction to Python Computer Lab 1: Introduction to Python 1 I. Introduction Python is a programming language that is fairly easy to use. We will use Python for a few computer labs, beginning with this 9irst introduction.

More information

Grace days can not be used for this assignment

Grace days can not be used for this assignment CS513 Spring 19 Prof. Ron Matlab Assignment #0 Prepared by Narfi Stefansson Due January 30, 2019 Grace days can not be used for this assignment The Matlab assignments are not intended to be complete tutorials,

More information

Welcome to Bootcamp2015 s documentation!

Welcome to Bootcamp2015 s documentation! Welcome to Bootcamp2015 s documentation! This website (or pdf) will be home to some resources that will be useful for boot campers and instructors. Lecture notes and assignments for the econ course associated

More information

PHY224 Practical Physics I. Lecture 2

PHY224 Practical Physics I. Lecture 2 PHY224 Practical Physics I Python Review Lecture 2 Sept. 19 20 20, 2013 Summary Functions and Modules Graphs (plotting with Pylab) Scipy packages References M H. Goldwasser, D. Letscher: Object oriented

More information

Algebra Homework Application Nick Hobbs

Algebra Homework Application Nick Hobbs Algebra Homework Application Nick Hobbs Project Overview: The goal of this project was to create a dynamic math textbook. The application would provide instant feedback to students working on math homework,

More information

PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1

PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1 PHYS 210: Introduction to Computational Physics Octave/MATLAB Exercises 1 1. Problems from Gilat, Ch. 1.10 Open a terminal window, change to directory /octave, and using your text editor, create the file

More information

Lecture 5. Defining Functions

Lecture 5. Defining Functions Lecture 5 Defining Functions Announcements for this Lecture Last Call Quiz: About the Course Take it by tomorrow Also remember the survey Readings Sections 3.5 3.3 today Also 6.-6.4 See online readings

More information

Outline. the try-except statement the try-finally statement. exceptions are classes raising exceptions defining exceptions

Outline. the try-except statement the try-finally statement. exceptions are classes raising exceptions defining exceptions Outline 1 Exception Handling the try-except statement the try-finally statement 2 Python s Exception Hierarchy exceptions are classes raising exceptions defining exceptions 3 Anytime Algorithms estimating

More information

Python for Informatics

Python for Informatics Python for Informatics Exploring Information Version 0.0.6 Charles Severance Chapter 3 Conditional execution 3.1 Boolean expressions A boolean expression is an expression that is either true or false.

More information

MATLAB TUTORIAL WORKSHEET

MATLAB TUTORIAL WORKSHEET MATLAB TUTORIAL WORKSHEET What is MATLAB? Software package used for computation High-level programming language with easy to use interactive environment Access MATLAB at Tufts here: https://it.tufts.edu/sw-matlabstudent

More information

61A Lecture 3. Friday, September 5

61A Lecture 3. Friday, September 5 61A Lecture 3 Friday, September 5 Announcements There's plenty of room in live lecture if you want to come (but videos are still better) Please don't make noise outside of the previous lecture! Homework

More information