Mathematical Methods in Python A companion to Principles ...
Mathematical Methods in Python A companion to
Principles of Planetary Climate
R. T. Pierrehumbert c Draft date September 29, 2010
Preface
This document goes over some basic computer skills that will be useful in doing the problems in the Workbook sections of Principles of Planetary Climate, and in reproducing the calculations discussed in the text. It also serves as a quick-start introduction to the Python language, emphasizing those aspects of most interest to applications in the physical sciences.
i
ii
Contents
Preface
i
Contents
1
1 Some basic computer skills
3
1.1 Basic Skills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.1 Using xterms and logging in to the server . . . . . . . . . . . . . . . . . . . 4
1.1.2 About the Python Shell and idle . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.3 Running Python Locally . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Introduction to Python
9
2.1 Fun with Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.1 Basic operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.1.2 Lists, tuples and strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.1.3 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.4 Getting help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.5 Program control: Looping, conditionals and functions . . . . . . . . . . . . 13
2.2 More advanced Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2.1 Writing your own modules and executable scripts . . . . . . . . . . . . . . . 17
2.2.2 List comprehension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.3 Using objects in Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3 The numpy array module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.4 Courseware modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.4.1 The ClimateUtilities module . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.4.2 The phys module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.4.3 The planets module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
iii
1
2.5 Advanced Python Topics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.5.1 Defining your own objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.5.2 Getting input interactively . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.5.3 Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.5.4 Writing text data to files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 2.5.5 Reading text data from a file . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3 Appendix A: Hints for the user of Unix and its relatives
37
3.1 Simple Unix for the masses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2 A few useful Unix utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.3 Nasty Unix stuff I hope you won't have to deal with . . . . . . . . . . . . . . . . . 38
3.4 Public domain software to install on the server . . . . . . . . . . . . . . . . . . . . 41
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- getting started washington state university
- an introduction to python for absolute beginners
- introduction to linux
- micropython basics load files run code
- mathematical methods in python a companion to principles
- the road to using python with mcidas x
- running qshell techtarget
- python run command lien
- introduction to python
- python a simple tutorial bryn mawr
Related searches
- data analysis methods in research
- learning methods in education
- methods in teaching
- promotional methods in marketing
- teaching methods in education
- statistical methods in nursing research
- create a matrix in python using for
- mathematical models in economics
- list methods in python 3
- python list methods in module
- mathematical problem in engineering
- python add a list to a list