Introduction to Python for Engineers and Scientists (eBook)
XVII, 254 Seiten
Apress (Verlag)
978-1-4842-3204-0 (ISBN)
Familiarize yourself with the basics of Python for engineering and scientific computations using this concise, practical tutorial that is focused on writing code to learn concepts. Introduction to Python is useful for industry engineers, researchers, and students who are looking for open-source solutions for numerical computation.
In this book you will learn by doing, avoiding technical jargon, which makes the concepts easy to learn. First you'll see how to run basic calculations, absorbing technical complexities incrementally as you progress toward advanced topics. Throughout, the language is kept simple to ensure that readers at all levels can grasp the concepts.
What You'll Learn
- Understand the fundamentals of the Python programming language
- Apply Python to numerical computational programming projects in engineering and science
- Discover the Pythonic way of life
- Apply data types, operators, and arrays
- Carry out plotting for visualization
- Work with functions and loops
Who This Book Is For
Engineers, scientists, researchers, and students who are new to Python. Some prior programming experience would be helpful but not required.
Familiarize yourself with the basics of Python for engineering and scientific computations using this concise, practical tutorial that is focused on writing code to learn concepts. Introduction to Python is useful for industry engineers, researchers, and students who are looking for open-source solutions for numerical computation. In this book you will learn by doing, avoiding technical jargon, which makes the concepts easy to learn. First you'll see how to run basic calculations, absorbing technical complexities incrementally as you progress toward advanced topics. Throughout, the language is kept simple to ensure that readers at all levels can grasp the concepts. What You'll Learn Understand the fundamentals of the Python programming language Apply Python to numerical computational programming projects in engineering and science Discover the Pythonic way of life Applydata types, operators, and arrays Carry out plotting for visualization Work with functions and loops Who This Book Is For Engineers, scientists, researchers, and students who are new to Python. Some prior programming experience would be helpful but not required.
Sandeep Nagar, Ph.D. teaches and consults on the use of Python and other open source programming languages for for data science/analysis and numerical computing for engineering and science applications. In addition to teaching at universities, he frequently gives workshops covering open source software. Sandeep has a Ph.D. in Material Science from KTH, Sweden in May 2012. Prior to that degree, he obtained a M.Sc. in Physics with specialization in Electronics and Radio Physics and a B.Sc.B.Ed degrees in India.
Table of Contents 5
About the Author 13
About the Technical Reviewer 14
Acknowledgments 15
Chapter 1: Philosophy of Python 16
1.1 Introduction 16
1.1.1 High-Level Programming 17
1.1.2 Interactive Environment 17
1.1.3 Object Orientation 19
1.1.4 Multipurpose Nature 20
1.1.5 Minimalistic Design 21
1.1.6 Portability 22
1.1.7 Extensibility 22
1.2 History 23
1.2.1 Python 2 vs. Python 3 23
1.3 Python and Engineering 24
1.4 Modular Programming 25
1.5 Summary 26
1.6 Bibliography 26
Chapter 2: Introduction to Python Basics 28
2.1 Introduction 28
2.2 Installation 28
2.2.1 Windows 29
2.2.2 Ubuntu 30
2.2.3 Mac OS X 31
2.3 Using the Python Interpreter 32
2.4 Anaconda IDE 35
2.5 Python as a Calculator 37
2.6 Modules 39
2.6.1 Using a Module 41
2.7 Python Environment 42
2.7.1 Installing virtualenv 43
2.7.2 Activating virtualenv 44
2.7.3 Deactivating the Virtual Environment 44
2.8 Summary 45
2.9 Bibliography 45
Chapter 3: IPython 46
3.1 Introduction 46
3.2 Installing IPython 47
3.3 IPython Notebooks 53
3.3.1 Installing a Jupyter Notebook 53
3.4 Saving a Jupyter Notebook 57
3.5 Online Jupyter Environment 58
3.6 Summary 59
3.7 Bibliography 60
Chapter 4: Data Types 61
4.1 Introduction 61
4.2 Logical 62
4.3 Numeric 64
4.3.1 Integer 64
4.3.2 Floating Point Numbers 65
4.3.3 How to Store a Floating Point Number 66
4.3.4 Complex Numbers 69
4.4 Sequences 70
4.4.1 Strings 70
4.4.2 Lists and Tuples 72
4.5 Sets and Frozensets 73
4.6 Mappings 74
4.7 Null Objects 74
4.8 Summary 75
4.9 Bibliography 75
Chapter 5: Operators 76
5.1. Introduction 76
5.2. Concept of Variables 78
5.2.1 Rules of Naming Variables 80
5.3. Assignment Operator 81
5.4. Arithmetic Operators 88
5.5. Changing and Defining Data Type 90
5.5.1 Order of Usage 91
5.5.2 Comparison Operators 92
5.6. Membership Operator 93
5.7. Identity Operator 94
5.8. Bitwise Operators 95
5.8.1 Using Bitwise Operations 98
5.9. Summary 99
Chapter 6: Arrays 100
6.1 Introduction 100
6.2 numpy 101
6.3 ndarray 102
6.4 Automatic Creation of Arrays 105
6.4.1 zeros() 105
6.4.2 ones() 106
6.4.3 ones_like() 107
6.4.4 empty() 107
6.4.5 empty_like() 108
6.4.6 eye() 108
6.4.7 identity() 110
6.4.8 full() 111
6.4.9 full_like() 111
6.4.10 Random Numbers 112
Random Integers 113
Random Floating Point Numbers 114
Random Choice 115
Beta Distribution 117
Binomial Distribution 118
Normal Distribution 118
Other Distributions 119
6.5 Numerical Ranges 119
6.5.1 A Range of Numbers 119
6.5.2 Linearly Spaced Numbers 120
6.5.3 Logarithmically Spaced Numbers 121
6.5.4 meshgrid() 121
6.5.5 mgrid() and ogrid() 122
6.6 tile() 124
6.7 Broadcasting 125
6.8 Extracting Diagonal 127
6.9 Indexing 127
6.10 Slicing 129
6.11 Copies and Views 131
6.12 Masking 133
6.12.1 Fancy Indexing 133
6.12.2 Indexing with Boolean Arrays 134
6.13 Arrays Are Not Matrices 135
6.14 Some Basic Operations 139
6.14.1 sum 139
6.14.2 Minimum and Maximum 140
6.14.3 Statistics: Mean, Median, and Standard Deviation 140
6.14.4 sort() 141
6.14.5 Rounding Off 142
6.15 asarray() and asmatrix() 143
6.16 Summary 143
6.17 Bibliography 144
Chapter 7: Plotting 145
7.1 Introduction 145
7.2 matplotlib 146
7.2.1 pylab vs. pyplot 147
7.3 Plotting Basic Plots 148
7.3.1 Plotting More than One Graph on Same Axes 151
7.3.2 Various Features of a Plot 152
7.4 Setting Up to Properties 159
7.5 Histograms 159
7.6 Bar Charts 161
7.7 Error Bar Charts 164
7.8 Scatter Plots 166
7.9 Pie Charts 168
7.10 Polar Plots 170
7.11 Decorating Plots with Text, Arrows, and Annotations 171
7.12 Subplots 173
7.13 Saving a Plot to a File 175
7.14 Displaying Plots on Web Application Servers 176
7.14.1 IPython and Jupyter Notebook 178
7.15 Working with matplotlib in Object Mode 179
7.16 Logarithmic Plots 181
7.17 Two Plots on the Same Figure with at least One Axis Different 184
7.18 Contour Plots 185
7.19 3D Plotting in matplotlib 188
7.19.1 Line and Scatter Plots 188
7.19.2 Wiremesh and Surface Plots 191
7.19.3 Contour plots in 3D 194
7.19.4 Quiver Plots 195
7.20 Other Libraries for Plotting Data 197
7.20.1 plotly 197
7.21 Summary 198
7.22 Bibliography 198
Chapter 8: Functions and Loops 199
8.1 Introduction 199
8.2 Defining Functions 199
8.2.1 Function Name 200
8.2.2 Descriptive String 200
8.2.3 Indented Block of Statements 201
8.2.4 Return Statement 202
8.3 Multi-input and Multi-output Functions 203
8.4 Namespaces 204
8.4.1 Scope Rules 204
8.5 Concept of Loops 206
8.6 for Loop 207
8.7 if-else Loop 211
8.8 while Loop 213
8.9 Infinite Loops 215
8.10 while-else 216
8.11 Summary 217
Chapter 9: Object-Oriented Programming 218
9.1 Introduction 218
9.2 Procedural Programming vs. OOP 219
9.3 Objects 219
9.4 Types 223
9.5 Object Reference 225
9.5.1 Garbage Collection 226
9.5.2 Copy and Deepcopy 227
9.6 Class 230
9.6.1 Creating a Class 231
9.6.2 Class Variables and Class Methods 232
9.6.3 Constructor 234
Built-in Class Attributes 238
9.7 Summary 240
9.8 Bibliography 241
Chapter 10: Numerical Computing Formalism 242
10.1 Introduction 242
10.2 Physical Problems 243
10.3 Defining a Model 243
10.4 Python Packages 247
10.5 Python for Science and Engineering 247
10.6 Prototyping a Problem 248
10.6.1 What Is Prototyping? 249
10.6.2 Python for Fast Prototyping 249
10.7 Large Dataset Handling 250
10.8 Instrumentation and Control 252
10.9 Parallel Processing 254
10.10 Summary 255
10.11 Bibliography 256
Index 257
Erscheint lt. Verlag | 6.12.2017 |
---|---|
Zusatzinfo | XVII, 254 p. 30 illus. in color. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Informatik ► Programmiersprachen / -werkzeuge ► Python |
Schlagworte | Code • Course • engineer • Introduction • learn • programming • Python • Science • Scientist • source • Teach • Tutorial |
ISBN-10 | 1-4842-3204-6 / 1484232046 |
ISBN-13 | 978-1-4842-3204-0 / 9781484232040 |
Haben Sie eine Frage zum Produkt? |
![PDF](/img/icon_pdf_big.jpg)
Größe: 3,9 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich