Programming and Scientific Computing in Python
معرفی کتاب «Programming and Scientific Computing in Python» نوشتهٔ J.M. Hoekstra, J. Ellerbroek، منتشرشده توسط نشر TU Delft در سال 2022. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Programming and Scientific Computing in Python» در دستهٔ بدون دستهبندی قرار دارد.
The first version of this reader was developed for, and during the pilot of, the Programming course in the first year of the BSc program Aerospace Engineering at the Delft University of Technology in 2012. Originally it was written for Python 2 and then converted to Python 3. The goal of the Python programming course is to enable the student to: • write a program for scientific computing • develop models • analyse behaviour of the models, for instance using plots • visualise models by animating graphics The course assumes some mathematical skills, but no programming experience whatsoever. This document is provided as a reference for the elaboration of the assignments. The reader is encouraged to read through the relevant chapters applicable to a particular problem. For later reference, many tables, as well as some appendices with quick reference guides, have been included. These encompass the most often used functions and methods. For a complete overview, there is the excellent documentation as provided with Python in the IDLE Help menu, as well as the downloadable and on-line documentation for the Python modules NumPy, SciPy, Matplotlib and Pygame. Also, the set-up of the present course is to show the appeal of programming. Having this powerful tool at hand allows the reader to use the computer as a ‘mathematical slave’. And by making models, one basically has the universe in a sandbox at one’s disposal: Any complex problem can be programmed and displayed, from molecular behaviour to the motion in a complex gravity field in space. An important ingredient at the beginning of the course is the ability to solve mathematical puzzles and numerical problems. Also the very easy to use graphics module Pygame module has been included in this reader. This allows, next to the simulation of a physical problem, a real-time visualization and some control (mouse and keyboard) for the user, which also adds some fun for the beginning and struggling programmer in the form of visual feedback. Next to the mathematical puzzles, challenges (like Project Euler and the Python challenge) and simulations and games, there is a programming contest included in the last module of the course for which there is a prize for the winners. Often students surprise me with their skills and creativity in such a contest by submitting impressive simulations and games. Also check out the accompanying videos: Search for “AE1205” on Youtube. Many thanks to the students and teaching assistants, whose questions, input and feedback formed the foundation for this reader. Getting started What is programming? What is Python? Installing Python Windows macOS Linux Explanation of the installed modules Configuring the IDLE editor Working environments: IDLE, PyCharm, Spyder, and others Documentation Sneak preview: Try the Python language yourself Variables and the assignment statement Finding your way around: many ways in which you can get help Method 1: Using help("text") or interactive help() Method 2: Python documentation in Help Pull-down menu Method 3: Get help from the huge Python community Variable assignment and types Assignment and implicit type declaration Short-hand when using original value with an operator Number operations in Python Float: variable type for floating point values Int: variable type for round numbers like counter or index) Complex numbers String operations Booleans and logical expressions The list type: an ordered collection of items What are lists? Indexing and slicing, list functions and delete Quick creation of lists with repeating values List methods Some useful built-in functions Python syntax: Statements Assignment The print statement Using print Formatting your output The input function Checking conditions: the if-statement Iteration using a for-loop Additional tools for for-loops: itertools Iteration using a while-loop Controlling a loop: break and continue Making your code reusable and readable Extending Python: Using modules The import statement Importing from a module Renaming imports within the import statement Math functions in Python: the math module Overview of functions and constants in the math module The random module Exploring other modules Defining your own functions and modules Defining a function: The def statement Accepting arguments in your function Providing default values Passing arguments by order or by name Returning data from your function Variable names: Arguments and return variables Returning a result by updating an argument Managing a project: defining your own modules File input/output and string handling Opening and closing files Easy opening and closing: the with statement Reading data from the file object Iteratively reading data If you need more control A full example: Reading a formatted file Writing to files Useful string methods Matplotlib: Data visualisation in Python The basics: plotting a 2D XY-graph Multiple plots and setting their scaling: subplot and axis Interactive plots 3D and contour plots Plotting on a map Overview of essential pyplot functions Numerical integration Euler's method Adding dimensions and the atan2 function NumPy and SciPy: Scientific programming with arrays and matrices Arrays Creating NumPy arrays Indexing and slicing NumPy arrays Logical expressions using arrays Speeding it up: Vectorising your code with NumPy Matrix operations: Linear algebra with NumPy Genfromtxt: Easy data-file reading using NumPy SciPy: a toolbox for scientists and engineers SciPy example: Polynomial fit on noisy data Tuples, dictionaries, and sets Tuples Sets Dictionaries Pygame: Animation, visualisation and controls The basics: importing and initialising Setting up the Pygame window Surfaces and Rectangles Bitmaps and images Drawing shapes and lines When your drawing is ready: flipping the display Timing and the game loop Method 1: Fixed time-step Method 2: Variable time-step The termination condition of the game loop Processing inputs: Keyboard, mouse, and other events Overview of basic Pygame functions Creating your own types: Object-Oriented Programming Implementing operator behaviour for your type Graphical User Interface building in Python TkInter PyQt wxPython PyGtk Reading and writing data files: beyond the basics Tabular data: CSV files Doing it yourself Doing it with a library Tabular data: Excel spreadsheets Openpyxl: Reading and writing directly to XLSX Excel files Xlrd and xlwt: Reading and writing the old .xls format Reading and writing Excel files with Pandas Hierarchical data: JSON files Hierarchical data: XML files Binary data: MATLAB mat files Binary data: PDF files Binary data: Any binary file Exception handling in Python Creating self-contained bundles of your program using PyInstaller Making an executable of your program Example Mazeman game Adding additional files to make your program run Making a setup installer for your program Version Control Basic concepts of version control Repository, working copy Revision, commit, check-out Comparing source code Distributed vs centralised VCS Branches and merging Overview of Git commands Overview of Subversion commands Beyond the course: Exploring applications of Python Alternatives for Pygame for (2D) visualisation TkInter Canvas (included in Python) Arcade Alternatives for 3D visualisation Visual Python: easy 3D graphics Panda3D OpenGL Animating your graphics: Physics Creating graphics GIMP and its Python console Blender Interfacing with hardware The Raspberry Pi MicroPython Examples Logicals and loops: Bubblesort Answers to exercises Jupyter: the interactive Python notebook Programming and Scientific Computing in Python - Cheat sheet Getting started Variable assignment and types Python syntax: Statements Making your code reusable and readable Extending Python: using modules Defining your own functions and modules File IO and string handling Matplotlib: Data visualisation in Python Numerical integration NumPy and SciPy: Scientific programming with arrays and matrices Tuples, dictionaries, and sets Pygame: Animation, visualisation and controls
دانلود کتاب Programming and Scientific Computing in Python