كتاب Hardcore Programming for Mechanical Engineers
منتدى هندسة الإنتاج والتصميم الميكانيكى
بسم الله الرحمن الرحيم

أهلا وسهلاً بك زائرنا الكريم
نتمنى أن تقضوا معنا أفضل الأوقات
وتسعدونا بالأراء والمساهمات
إذا كنت أحد أعضائنا يرجى تسجيل الدخول
أو وإذا كانت هذة زيارتك الأولى للمنتدى فنتشرف بإنضمامك لأسرتنا
وهذا شرح لطريقة التسجيل فى المنتدى بالفيديو :
http://www.eng2010.yoo7.com/t5785-topic
وشرح لطريقة التنزيل من المنتدى بالفيديو:
http://www.eng2010.yoo7.com/t2065-topic
إذا واجهتك مشاكل فى التسجيل أو تفعيل حسابك
وإذا نسيت بيانات الدخول للمنتدى
يرجى مراسلتنا على البريد الإلكترونى التالى :

Deabs2010@yahoo.com


-----------------------------------
-Warning-

This website uses cookies
We inform you that this site uses own, technical and third parties cookies to make sure our web page is user-friendly and to guarantee a high functionality of the webpage.
By continuing to browse this website, you declare to accept the use of cookies.
منتدى هندسة الإنتاج والتصميم الميكانيكى
بسم الله الرحمن الرحيم

أهلا وسهلاً بك زائرنا الكريم
نتمنى أن تقضوا معنا أفضل الأوقات
وتسعدونا بالأراء والمساهمات
إذا كنت أحد أعضائنا يرجى تسجيل الدخول
أو وإذا كانت هذة زيارتك الأولى للمنتدى فنتشرف بإنضمامك لأسرتنا
وهذا شرح لطريقة التسجيل فى المنتدى بالفيديو :
http://www.eng2010.yoo7.com/t5785-topic
وشرح لطريقة التنزيل من المنتدى بالفيديو:
http://www.eng2010.yoo7.com/t2065-topic
إذا واجهتك مشاكل فى التسجيل أو تفعيل حسابك
وإذا نسيت بيانات الدخول للمنتدى
يرجى مراسلتنا على البريد الإلكترونى التالى :

Deabs2010@yahoo.com


-----------------------------------
-Warning-

This website uses cookies
We inform you that this site uses own, technical and third parties cookies to make sure our web page is user-friendly and to guarantee a high functionality of the webpage.
By continuing to browse this website, you declare to accept the use of cookies.



 
الرئيسيةالبوابةأحدث الصورالتسجيلدخولحملة فيد واستفيدجروب المنتدى

شاطر
 

 كتاب Hardcore Programming for Mechanical Engineers

اذهب الى الأسفل 
كاتب الموضوعرسالة
Admin
مدير المنتدى
مدير المنتدى
Admin

عدد المساهمات : 18726
التقييم : 34712
تاريخ التسجيل : 01/07/2009
الدولة : مصر
العمل : مدير منتدى هندسة الإنتاج والتصميم الميكانيكى

كتاب Hardcore Programming for Mechanical Engineers  Empty
مُساهمةموضوع: كتاب Hardcore Programming for Mechanical Engineers    كتاب Hardcore Programming for Mechanical Engineers  Emptyالأحد 01 أغسطس 2021, 12:19 am

أخواني في الله
أحضرت لكم كتاب
Hardcore Programming for Mechanical Engineers
Build Engineering Applications from Scratch
by Ángel Sola Orbaiceta

كتاب Hardcore Programming for Mechanical Engineers  H_c_p_11
و المحتوى كما يلي :


BRIEF CONTENTS
Acknowledgments xxi
Introduction xxiii
PART I: BASICS
Chapter 1: A Short Python Primer 3
Chapter 2: Two Python Paradigms . 23
Chapter 3: The Command Line . 49
PART II: 2D GEOMETRY
Chapter 4: Points and Vectors . 65
Chapter 5: Lines and Segments 101
Chapter 6: Polygons 131
Chapter 7: Affine Transformations 171
PART III: GRAPHICS AND SIMULATIONS
Chapter 8: Drawing Vector Images . 203
Chapter 9: Building a Circle from Three Points . 233
Chapter 10: Graphical User Interfaces and the Canvas . 265
Chapter 11: Animations, Simulations, and the Time Loop . 287
Chapter 12: Animating Affine Transformations . 307
PART IV: SYSTEMS OF EQUATIONS
Chapter 13: Matrices and Vectors 337
Chapter 14: Linear Equations 359
PART V: TRUSS STRUCTURES
Chapter 15: Structural Models . 387
Chapter 16: Structure Resolution . 427
Chapter 17: Reading Input from a File 465Chapter 18: Producing an SVG Image and Text File 493
Chapter 19: Assembling Our Application . 529
Bibliography . 547
Index 549
x Brief ContentsCO N T E N T S I N D E T AI L
ACKNOWLEDGMENTS xxi
INTRODUCTION xxiii
Who This Book Is For xxiii
What You’ll Learn . xxiv
About This Book . xxiv
What Is the ”Hardcore” About? xxv
Why Python? . xxv
Contents at a Glance xxvii
Setting Up Your Environment xxix
Downloading the Book’s Code . xxix
Installing Python xxx
Installing and Configuring PyCharm . xxxi
PyCharm Introduction xxxiv
Creating Packages and Files . xxxv
Creating Run Configurations . xxxvi
Debugging Python Code . xxxix
Summary . xliv
PART I
BASICS
1
A SHORT PYTHON PRIMER 3
Python Packages and Modules 3
Modules . 4
Packages 4
Running Files 5
Importing Code . 5
Different Import Forms . 6
Documenting the Code with Docstrings 9
Collections in Python . 11
Sets . 11
Tuples . 12
Lists 15
Dictionaries 18Destructuring 20
Summary . 21
2
TWO PYTHON PARADIGMS 23
Functional Programming . 23
Pure Functions 24
Immutability 25
Lambdas . 26
Higher-Order Functions 27
Functions Inside Other Functions 28
Filter, Map, and Reduce . 29
List Comprehensions . 35
Object-Oriented Programming 36
Classes 37
Magic Methods . 43
Type Hints 45
Summary . 47
3
THE COMMAND LINE 49
Unix and Windows 49
Finding Your Shell . 50
Installing the Windows Subsystem for Linux 50
Taking a First Look at the Shell . 51
Files and Directories . 51
Moving Around . 52
Creating Files and Directories 53
Deleting Files and Directories . 54
Commands Summary 55
Using Windows Subsystem for Linux 55
Running Python Scripts . 56
Passing Arguments to the Script . 57
Standard Input and Output . 58
Redirecting the Output to a File . 58
Redirecting the Input from a File 58
Using PyCharm’s Python Console . 59
Summary . 61
xii Contents in DetailPART II
2D GEOMETRY
4
POINTS AND VECTORS 65
The Point Class 67
Calculating Distance Between Points 68
Addition and Subtraction Operators 69
The Vector Class 71
Addition and Subtraction Operators 72
Scaling Vectors . 73
Displacing Points 73
Vector Norms . 74
Immutable Design . 76
Naming Convention . 77
Dot Product . 77
Projecting Vectors . 78
Cross Product . 79
Parallel and Perpendicular Vectors 80
Angles Between Vectors . 81
Rotating Vectors 83
Sine and Cosine 84
Completing Our Classes . 85
Checking Equality . 85
String Representation 88
Vector Factories . 89
Unit Testing . 90
Testing Distances 91
Testing Vector Plus and Minus Operations . 94
Testing Vector Product Operations 95
Testing Vector Parallelism and Perpendicularity . 96
Three Golden Rules for Unit Testing . 97
Summary . 99
5
LINES AND SEGMENTS 101
Segment Class 101
The Segment’s Direction . 103
The Segment’s Length 105
The t Parameter and Middle Points 107
Closest Point 114
Distance to a Point 117
Segment Intersections 117
Equality and String Representation 121
Contents in Detail xiiiLine Class 124
Line Intersections 126
Segment’s Bisector . 128
Summary . 129
6
POLYGONS 131
Polygon Class . 132
Sides 133
Centroid . 137
Contains Point 139
Polygon Factory . 144
Polygon Equality 146
Circle Class . 148
Contains Point 149
Circle to Polygon 150
Equality and String Representation 152
Circle Factories . 153
Rect Class 155
Contains Point 158
Intersections 158
Convert to Polygon 164
Equality 165
Rectangle Factories 167
Summary . 169
7
AFFINE TRANSFORMATIONS 171
Affine Transformations . 172
Examples of Affine Transformations . 174
The Affine Transformation Class . 177
Testing the Transformation of Points . 178
Transform Segments and Polygons 179
Concatenating Transformations . 181
Inverting Affine Transformations 184
Scaling 187
Rotating 189
Interpolating Transformations . 192
Motivating Interpolation . 192
Implementing Interpolation . 195
Geom2D Final Touches 197
Test Files . 197
Running All Tests 197
Package Imports 198
Summary . 199
xiv Contents in DetailPART III
GRAPHICS AND SIMULATIONS
8
DRAWING VECTOR IMAGES 203
Bitmaps and Vector Images . 204
The SVG Format . 204
The viewBox 207
Space Transformation . 208
The svg Package 210
Templates 210
Loading Templates 212
Image Templates 213
Attributes . 215
The SVG Primitives 217
Lines . 217
Rectangles . 219
Circles . 221
Polygons . 222
Polylines . 223
Text . 224
Groups 225
Arrows . 226
Primitives Result . 229
Package Imports . 231
Summary . 231
9
BUILDING A CIRCLE FROM THREE POINTS 233
Application Architecture 234
Setup 235
Creating a Run Configuration 236
Why Use a Run Configuration? . 239
Reading the Input and Configuration Files 239
Regular Expressions . 241
Regular Expressions Cheat Sheet . 246
Matching Points . 246
The Configuration File . 248
Problem Model and Resolution 249
Generating Output 250
Drawing the Output Circle . 251
Drawing the Input Points . 254
Result 256
Flip the Y-Axis 258
Contents in Detail xvDistributing Our Application 258
Understanding the Problem 259
Finding a Solution . 260
Running the App Without an Input File 263
Summary . 263
10
GRAPHICAL USER INTERFACES AND THE CANVAS 265
Tkinter 266
Our First GUI Program . 266
The Canvas 270
Drawing Our Geometric Primitives 276
The Canvas Wrapper Class 276
Drawing Segments 278
Drawing Polygons . 279
Drawing Arrows 281
Summary . 285
11
ANIMATIONS, SIMULATIONS, AND THE TIME LOOP 287
Defining Terms 288
What Is an Animation? 288
What Is a System? 288
What Is a Simulation? . 289
What Is the Time Loop? 291
Our First Animation 292
Setup 292
Adding a Frame Count Label . 294
Updating the System 296
Creating Motion 297
Abstracting the Main Loop Function . 299
Refactoring Our Simulation . 301
Playing with the Circle Divisions 302
Playing with the Affine Transformation . 303
Cleaning Up the Module . 305
Summary . 305
12
ANIMATING AFFINE TRANSFORMATIONS 307
Application Architecture and Visibility Diagrams 308
Setting Up 309
Creating a Run Configuration 310
Creating a Bash Script . 310
Reading the Configuration File 311
xvi Contents in DetailReading Input . 312
Formatting the Input . 312
Adding Example Input . 313
Parsing the Affine Transformation . 315
Parsing the Geometric Primitives 317
Running the Simulation . 325
Building the User Interface . 325
Implementing the Simulation Logic 327
Drawing the Axes . 329
Summary . 334
PART IV
SYSTEMS OF EQUATIONS
13
MATRICES AND VECTORS 337
List Utils 338
Setup 339
Vectors . 340
Implementing the Vector Class 340
Testing the Vector Class . 344
Matrices 346
Setting Values 347
Getting Values 349
Scaling Values 350
Matrix Equality . 351
Testing the Matrix Class . 354
Summary . 358
14
LINEAR EQUATIONS 359
Systems of Linear Equations 359
Numerical Methods 361
Cholesky Decomposition . 361
LU Factorization Methods 362
Understanding Cholesky . 365
A Factorization by Hand . 366
A Resolution by Hand . 367
Implementing Cholesky 370
Testing Cholesky: An Integration Test . 381
Summary . 382
Contents in Detail xviiPART V
TRUSS STRUCTURES
15
STRUCTURAL MODELS 387
Solving Structural Problems . 388
Structural Member Internal Forces . 388
Elastic Bodies Subject to External Forces . 389
Axial and Shear Forces 390
Bending and Torsional Moments 391
Tension and Compression 392
Hooke’s Law . 392
Stress-Strain Diagrams . 393
Plane Trusses 394
Two-Force Members . 396
Stiffness Matrices in Global Coordinates . 397
Original Structure Model . 400
The Node Class 400
The Bar Class . 404
The Structure Class 408
Creating a Structure from the Python Shell . 410
The Structure Solution Model . 411
The Solution Nodes . 411
The Solution Bars . 414
The Structure Solution 421
Summary . 426
16
STRUCTURE RESOLUTION 427
Structure Resolution 428
Interpreting the Stiffness Matrix Terms . 429
Structure Initialization 429
The Main Structure Resolution Algorithm . 430
Numbering Degrees of Freedom 432
Assembling and Resolving the System of Equations . 433
Creating the Solution 441
The Result 443
Advanced Unit Testing: Test Doubles 447
Test Doubles 447
The unittest.mock Package . 448
Testing the Structure Solution Class 453
Testing the Structure Resolution Process 457
Summary . 463
xviii Contents in Detail17
READING INPUT FROM A FILE 465
Defining the Input Format . 465
The Nodes Format 466
The Loads Format . 466
The Bars Format 467
The File Format . 467
Finding the Regular Expressions . 468
The Nodes Regex . 468
The Loads Regex 469
The Bars Regex . 470
Setup 471
Parsing Nodes 471
Testing the Node Parser . 473
Parsing Bars 474
Testing the Bar Parser . 475
Parsing Loads . 476
Testing the Load Parser 477
Parsing the Structure . 478
Overview 479
Setup 480
Ignoring Blank Lines and Comments . 480
Parsing the Lines 481
Splitting the Lines and Instantiating the Structure 483
The Result 484
Testing the Structure Parser . 487
Summary . 492
18
PRODUCING AN SVG IMAGE AND TEXT FILE 493
Setup 494
From Structure Solution to SVG . 494
The Configuration File . 495
The Settings 496
The Solution Drawing Function . 497
Captions . 499
The Bars . 501
The Nodes . 509
The Node Reactions . 511
The Loads 517
Putting It All Together 518
The Final Result . 519
From Structure Solution to Text 521
Structure Solution’s String 522
The Nodes . 523
The Bars . 525
Contents in Detail xixThe Unicode Characters . 526
Putting It All Together 527
Summary . 528
19
ASSEMBLING OUR APPLICATION 529
A General Overview . 529
Setup 530
Input Arguments . 531
Generating the Output . 534
The Main Script . 535
Trying the App 536
Playing with the Arguments 540
Solving a Large Structure 542
Summary . 546
BIBLIOGRAPHY 547
INDEX 54
I N D E X
Symbols
** (dictionary unpacking), 498
% (modulo), 134, 296
** (power), 69
P (summation), 366
A
abstraction, 299
affine space, 172
affine transformation, 172–174
augmented matrix, 173
concatenation, 181
identity transformation, 174, 193
inverse, 185
rotation, 190
scaling, 187
analytic solution, 290
animation, 288
frame, 288
architecture, software, 234
attribute, class, 37
attribute chaining, 104
B
backward substitution, 364, 377
balanced system of forces, 389
binary operator
intersection, 160
bisector, 128
bitmap image, 204
browser
developer tools, 205
byte string, 213
C
Cholesky decomposition, numerical
method, 365
circle
center, 148
chord, 155
radius, 148
class, 37
__dict__, 69
__init__, 38
instantiation, 37
self, 38
clean code, 155
coefficient matrix, 360
collections, 11–20
dictionary, 18
list, 15
set, 11
tuple, 12
collinear forces, 397
color
#rrggbbaa, 206
column vector, 340
command
cat, 54
cd, 52
chmod, 262
echo, 53
ls, 52
mkdir, 53
pwd, 51
rm, 54
sudo, 56
touch, 53
whoami, 51
command line, 49
absolute path, 52
argument, See option
option, 54
processor, 49
program, 233
relative path, 52
standard input, 58
standard output, 58
compound inequality, 158
cross product, 79
Crout, numerical method, 363D
debugger, xxxix–xliii
breakpoint, xl
console, xliii
run configuration, xli
stack frame, xlii
Step into, xli
Step over, xli
decoding, 213
decorator
property, 39
decoupled, 308
degrees of freedom, 397
Demeter, law of, See principle of least
knowledge
destructuring, 20–21
deterministic, 99
differential equation, 290
direction vector, 103
direction versor, 103
docstring, 9
documentation
Sphinx, 10
domain logic, 233
domain of knowledge, 160
Doolittle, numerical method, 363
dot product, 77
dunder methods, See magic methods
duplication of code, See knowledge
duplication
dynamic dispatching, 42
E
edge case, 143
eigenvalues, 362
environment variable, 262
PWD, 262
PYTHONPATH, 262
errors
AttributeError, 41
EOFError, 317
IndexError, 15, 341
ValueError, 133
ZeroDivisionError, 143
Euler’s numerical method, 290
event driven, 267
event handler, 267
exception
user­defined, 111
F
f­strings, 89
factory function, 89
fail fast, 109
force
axial, 390
axial component, 78
compression, 390, 393
normal, See axial
shear, 391
shear component, 83
tangent, See shear
tensile, 393
tension, 390
forward substitution, 364, 375
fracture strain, 394
frames per second (FPS), 290
free body diagram, 288
frictionless union, 396
function
access modifiers, 29
higher­order, 27–29
inside function, 28
lambda, 26–27
predicate, 30
pure, 24–25
reducer, 32
shared state, 25
side effect, 25
functional programming, 23–36
functools
reduce, 32–35
G
geometry
t parameter, 107
circle, 148–149
line, 124
parallelogram, 164
point, 67–71
polygon, 132–133
rectangle, 155–157
segment, 101
vector, 71–85
versor, 75, 90
Git, xxix
GitHub, xxix
global
dict, 18
550 Indexenumerate, 14, 16
filter, 30–31
help, 10
len, 11, 13, 15
list, 15
map, 31–32
range, 146
set, 11
str, 88
tuple, 13
H
hard­coding, 248
Hooke’s law, 392
I
IDE, See integrated development
environment
immutability, 23, 25–26
immutable, 12, 219
import
alias, 8, 430
relative, 9, 240
__init__.py, 4
InkStructure, application, 188
integrated development environment,
xxxi
integration test, 381, 447
internal forces, 389
interpolation, 192
ease­in­out, 194
iterator, 30
J
JSON format, 248
K
keyword
class, 37
def, 24
lambda, 26
None, 120
knowledge duplication, 160
L
lambda calculus, 26
linear equation, 359
coefficients, 360
free term, 360
unknown, 360
linear interpolation, 193
linear transformation, 172
Linux
distro, 50
superuser, 56
list
append, 16
flatten, 280
slice, 16–17
list comprehension, 35–36
LU factorization, 362
M
magic methods, 43
__add__, 44, 70
__eq__, 45, 86
__str__, 88
__sub__, 44, 70
magic numbers, 110, 430
__main__, 4
main loop, See time loop
markdown, xxx
matrix, 337
identity, 184
lower­triangular, 362
main diagonal, 361
nonsingular, 363
positive definite, 362
square, 346, 361
symmetric, 361
transposed, 349
upper­triangular, 362
mechanical stress, 390
model space, 184
modular arithmetic, 135
module, 4
argparse, 531
add_argument, 533
ArgumentParser, 532
import, 5–9
json, 249
loads, 249, 496
math, 66
copysign, 82
fabs, 66
Index 551operator, 34
os
getcwd, 261
os.path
normpath, 261
sys
path, 259
Tkinter, 266
unittest, 92
assertAlmostEqual, 92
assertEqual, 95
assertFalse, 97
assertIsNone, 121
assertRaises, 112
assertTrue, 97
TestCase, 92
moment
bending, 392
normal to section, 391
tangent to section, 391
torsional, 391
multiple assignment, 120
mutable, 219
N
__name__, 4
Newton’s third law, 423
nonlinear equation, 360
normal (perpendicular) versor, 104
number
floating point, See real
real, 65
numerical method, 359, 361
direct, 361
iterative, 361
O
object, 36
encapsulation, 346
method, 40–43
signature, 43
property, 39–40
state, 277
object­oriented programming, 36–45
open interval, 160
open source, 98
operator
** (dictionary unpacking), 498
% (modulo), 134, 296
** (power), 69
in, 11, 14, 19
overloading, 43, 70
ternary, 349
out of bounds, See errors: IndexError
P
package, 4
parser, 468
parsing, 483
pascal case, 37
pass, 293
PEP 238, 240
plaintext file, 235
plane truss, 394
point
projections, 67
polygon
centroid, 137
perimeter, 133
side, 132, 133
vertex, 132
polygonal chain, 132
principle of least knowledge, 125
proportional limit, 394
Python Enhancement Proposal, See
PEP
Python Standard Library, xxvi
R
raise exception, 111
raster image, See bitmap image
raw string literal, 245
ray casting algorithm, 139
reaction force, 412
readme, xxix
rectangle
origin, 155
overlap, 158
size, 155
refactoring code, 301
regex, See regular expression
regression, 91
regular expression, 241–246
capture group, 245
character set, 242
quantifier, 243
552 Indexresistant element, 388
reusability, 308
rich­text editor, 205, 235
rotation
pivot, 189
row vector, 340
run configuration, xxxvi, 236
S
Scalable Vector Graphics, See SVG
scientific notation, number, 526
screen space, 184
script, 4
segment
direction, 103
set
add, 12
difference, 12
remove, 12
union, 12
side effect, 24
silent fail, 109
simulation, 289
ahead of time, 290
motion, 297
real time, 290
system, 288
time delta, 291
static equilibrium, 389, 417
stiffness, 397
stiffness matrix, 398
strain ϵ, 393
stress σ, 393
stress­strain diagrams, 393
string, 211
join, 214
structure, 388
external constraint, 395
external support, See external
constraint
node, 395
two­force member, 397
SVG, 204
attributes, 206, 215
circle, 221
group, 225
line, 217
polygon, 222
polyline, 223
rect, 219
text, 224
transform, 208
viewBox, 207
system of equations
matrix form, 337, 360
T
TDD, See Test­Driven Development
template, 210
placeholder, 210
test
assertion, 91
fixture, 98
subject, 91, 98
test double, 447
dummy, 447
fake, 447
mock, 448
stub, 448
test­driven development, 371
time loop, 291
Tkinter
Button, 269
Canvas, 270
Entry, 268
Label, 268
main loop, 267
widget, 266
traceback, 94
truss structure, 388
tuple
count, 13
index, 14
type hints, 45–46
float, 46
int, 46
str, 46
U
ultimate strength, See ultimate stress
ultimate stress, 394
Unicode characters, 525–526
unit testing, 90–91
three golden rules, 97–99
Controlled Environment, 98
One Reason to Fail, 98
Test Independence, 99
Index 553Unix
prompt, See terminal
shell, See terminal
terminal, 50
unpacking, See destructuring
UTF­8 encoding, 213
utils package, 134
V
vector
angle, 81
norm, 74
normal, 75
normalize, 75
parallelism, 81
perpendicularity, 81
unit, 75
vector image, 204
version control system, xxix


كلمة سر فك الضغط : books-world.net
The Unzip Password : books-world.net
أتمنى أن تستفيدوا من محتوى الموضوع وأن ينال إعجابكم

رابط من موقع عالم الكتب لتنزيل كتاب Hardcore Programming for Mechanical Engineers
رابط مباشر لتنزيل كتاب Hardcore Programming for Mechanical Engineers
الرجوع الى أعلى الصفحة اذهب الى الأسفل
 
كتاب Hardcore Programming for Mechanical Engineers
الرجوع الى أعلى الصفحة 
صفحة 2 من اصل 1
 مواضيع مماثلة
-
» كتاب Mechanical Engineers’ Handbook - Volume 2
» كتاب Mechanical Engineers’ Handbook - Volume 1
» كتاب Mechanical Engineers’ Handbook Volume 1
» كتاب Mechanical Engineers' Handbook, Volume 2
» كتاب Mechanical Engineers’ Handbook - Volume 3

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتدى هندسة الإنتاج والتصميم الميكانيكى :: المنتديات الهندسية :: منتدى الكتب والمحاضرات الهندسية :: منتدى الكتب والمحاضرات الهندسية الأجنبية-
انتقل الى: