ENGLISH

Hardcore Programming for Mechanical Engineers. BuildEngineeringApplications fromScratch

Book information

Publisher
No Starch Press
Year
2021
ISBN
9781718500785, 9781718500792, 2021930213
Language
english
Format
PDF
Filesize
11 MB (11890669 bytes)
Pages
\603
Library
RU-board
Time added
2021-12-04 21:55:41

Description

About the Author Brief Contents Contents in Detail Acknowledgments Introduction Who This Book Is For What You'll Learn About This Book What Is the "Hardcore" About? Why Python? Contents at a Glance Setting Up Your Environment Downloading the Book's Code Installing Python Installing and Configuring PyCharm PyCharm Introduction Creating Packages and Files Creating Run Configurations Debugging Python Code Summary Part I: Basics 1: A Short Python Primer Python Packages and Modules Modules Packages Running Files Importing Code Different Import Forms Documenting the Code with Docstrings Collections in Python Sets Tuples Lists Dictionaries Destructuring Summary 2: Two Python Paradigms Functional Programming Pure Functions Immutability Lambdas Higher-Order Functions Functions Inside Other Functions Filter, Map, and Reduce List Comprehensions Object-Oriented Programming Classes Magic Methods Type Hints Summary 3: The Command Line Unix and Windows Finding Your Shell Installing the Windows Subsystem for Linux Taking a First Look at the Shell Files and Directories Moving Around Creating Files and Directories Deleting Files and Directories Commands Summary Using Windows Subsystem for Linux Running Python Scripts Passing Arguments to the Script Standard Input and Output Redirecting the Output to a File Redirecting the Input from a File Using PyCharm's Python Console Summary Part II: 2D Geometry 4: Points and Vectors The Point Class Calculating Distance Between Points Addition and Subtraction Operators The Vector Class Addition and Subtraction Operators Scaling Vectors Displacing Points Vector Norms Immutable Design Naming Convention Dot Product Projecting Vectors Cross Product Parallel and Perpendicular Vectors Angles Between Vectors Rotating Vectors Sine and Cosine Completing Our Classes Checking Equality String Representation Vector Factories Unit Testing Testing Distances Testing Vector Plus and Minus Operations Testing Vector Product Operations Testing Vector Parallelism and Perpendicularity Three Golden Rules for Unit Testing Summary 5: Lines and Segments Segment Class The Segment's Direction The Segment's Length The t Parameter and Middle Points Closest Point Distance to a Point Segment Intersections Equality and String Representation Line Class Line Intersections Segment's Bisector Summary 6: Polygons Polygon Class Sides Centroid Contains Point Polygon Factory Polygon Equality Circle Class Contains Point Circle to Polygon Equality and String Representation Circle Factories Rect Class Contains Point Intersections Convert to Polygon Equality Rectangle Factories Summary 7: Affine Transformations Affine Transformations Examples of Affine Transformations The Affine Transformation Class Testing the Transformation of Points Transform Segments and Polygons Concatenating Transformations Inverting Affine Transformations Scaling Rotating Interpolating Transformations Motivating Interpolation Implementing Interpolation Geom2D Final Touches Test Files Running All Tests Package Imports Summary Part III: Graphics and Simulations 8: Drawing Vector Images Bitmaps and Vector Images The SVG Format The viewBox Space Transformation The svg Package Templates Loading Templates Image Templates Attributes The SVG Primitives Lines Rectangles Circles Polygons Polylines Text Groups Arrows Primitives Result Package Imports Summary 9: Building a Circle from Three Points Application Architecture Setup Creating a Run Configuration Why Use a Run Configuration? Reading the Input and Configuration Files Regular Expressions Regular Expressions Cheat Sheet Matching Points The Configuration File Problem Model and Resolution Generating Output Drawing the Output Circle Drawing the Input Points Result Flip the Y-Axis Distributing Our Application Understanding the Problem Finding a Solution Running the App Without an Input File Summary 10: Graphical User Interfaces and the Canvas Tkinter Our First GUI Program The Canvas Drawing Our Geometric Primitives The Canvas Wrapper Class Drawing Segments Drawing Polygons Drawing Arrows Summary 11: Animations, Simulations, and the Time Loop Defining Terms What Is an Animation? What Is a System? What Is a Simulation? What Is the Time Loop? Our First Animation Setup Adding a Frame Count Label Updating the System Creating Motion Abstracting the Main Loop Function Refactoring Our Simulation Playing with the Circle Divisions Playing with the Affine Transformation Cleaning Up the Module Summary 12: Animating Affine Transformations Application Architecture and Visibility Diagrams Setting Up Creating a Run Configuration Creating a Bash Script Reading the Configuration File Reading Input Formatting the Input Adding Example Input Parsing the Affine Transformation Parsing the Geometric Primitives Running the Simulation Building the User Interface Implementing the Simulation Logic Drawing the Axes Summary Part IV: Systems of Equations 13: Matrices and Vectors List Utils Setup Vectors Implementing the Vector Class Testing the Vector Class Matrices Setting Values Getting Values Scaling Values Matrix Equality Testing the Matrix Class Summary 14: Linear Equations Systems of Linear Equations Numerical Methods Cholesky Decomposition LU Factorization Methods Understanding Cholesky A Factorization by Hand A Resolution by Hand Implementing Cholesky Testing Cholesky: An Integration Test Summary Part V: Truss Structures 15: Structural Models Solving Structural Problems Structural Member Internal Forces Elastic Bodies Subject to External Forces Axial and Shear Forces Bending and Torsional Moments Tension and Compression Hooke's Law Stress-Strain Diagrams Plane Trusses Two-Force Members Stiffness Matrices in Global Coordinates Original Structure Model The Node Class The Bar Class The Structure Class Creating a Structure from the Python Shell The Structure Solution Model The Solution Nodes The Solution Bars The Structure Solution Summary 16: Structure Resolution Structure Resolution Interpreting the Stiffness Matrix Terms Structure Initialization The Main Structure Resolution Algorithm Numbering Degrees of Freedom Assembling and Resolving the System of Equations Creating the Solution The Result Advanced Unit Testing: Test Doubles Test Doubles The unittest.mock Package Testing the Structure Solution Class Testing the Structure Resolution Process Summary 17: Reading Input from a File Defining the Input Format The Nodes Format The Loads Format The Bars Format The File Format Finding the Regular Expressions The Nodes Regex The Loads Regex The Bars Regex Setup Parsing Nodes Testing the Node Parser Parsing Bars Testing the Bar Parser Parsing Loads Testing the Load Parser Parsing the Structure Overview Setup Ignoring Blank Lines and Comments Parsing the Lines Splitting the Lines and Instantiating the Structure The Result Testing the Structure Parser Summary 18: Producing an SVG Image and Text File Setup From Structure Solution to SVG The Configuration File The Settings The Solution Drawing Function Captions The Bars The Nodes The Node Reactions The Loads Putting It All Together The Final Result From Structure Solution to Text Structure Solution's String The Nodes The Bars The Unicode Characters Putting It All Together Summary 19Assembling Our Application A General Overview Setup Input Arguments Generating the Output The Main Script Trying the App Playing with the Arguments Solving a Large Structure Summary Bibliography Index Bibliography Index

Similar books