Modeling and Simulation of Everyday Things, 2nd Edition / Моделирование и симуляция повседневных вещей, 2-е издание
Год издания: 2025
Автор: Roth Michael / Рот Майкл
Издательство: CRC Press
ISBN: 978-1-0036-0451-8
Язык: Английский
Формат: PDF/EPUB
Качество: Издательский макет или текст (eBook)
Интерактивное оглавление: Да
Количество страниц: 545
Описание: With Python, C++, FORTRAN, and a friendly conversational tone peppered with attempted humor, Modeling and Simulation of Everyday Things takes us on a journey through constructing models and simulations of systems and processes in everyday life and beyond. Readers can access an example‑packed online repository of programs in each of the three languages, including seldom covered work in generalized geometries and 3D.
This second edition is a wonderful confluence of development of Python and C++ applications and will cultivate a broad perspective in the readership through having translations of major programs available in Python, C++, and FORTRAN (as we move forward, software engineers and researchers are recognizing the value of legacy programming). In addition to leveraging the best of the three languages, the readership can explore versatility in visualization by using native Python graphics as well as POV Raytracer and third‑party animation tools. We approach modeling of a system by introducing the theoretical framework of the system, followed by its discretized form, and then with narrated programs and sample results that also appear in the online repository.
Readers will be able to critically think through constructing models and simulations of a vast array of systems, interpreting results, and visualizing them (which includes examples for visually and auditorily impaired individuals). Most importantly, their confidence will propel them forward to meet the challenges of the field and to think "outside the book." Leveraging the best of three coding languages, two tracks for visualization, a conversational tone, and numerous examples, this book is extremely versatile and can be used by from high school through science undergraduates in 2‑year and 4‑year institutions. The text is also ideal for use in Data Science as well as Professional Science Master’s programs.
Благодаря Python, C++, FORTRAN и дружелюбному разговорному тону, приправленному юмором, моделирование повседневных вещей отправляет нас в путешествие по построению моделей и симуляции систем и процессов в повседневной жизни и за ее пределами. Читатели могут получить доступ к онлайн‑репозиторию с примерами программ на каждом из трех языков, включая редко публикуемые работы по обобщенной геометрии и 3D.
Это второе издание представляет собой замечательное сочетание разработок приложений на Python и C++ и расширит кругозор читателей благодаря переводам основных программ на Python, C++ и FORTRAN (по мере продвижения вперед инженеры-программисты и исследователи осознают ценность устаревшего программирования). В дополнение к использованию лучших возможностей трех языков, читатели могут изучить универсальность визуализации, используя графику на родном языке Python, а также POV Raytracer и сторонние инструменты анимации. Мы подходим к моделированию системы, представляя теоретические основы системы, за которыми следует ее дискретизированная форма, а затем описанные программы и примеры результатов, которые также отображаются в онлайн-хранилище.
Читатели смогут критически осмыслить построение моделей и имитационное моделирование широкого спектра систем, интерпретацию результатов и их визуализацию (включая примеры для людей с нарушениями зрения и слуха). Самое главное, что их уверенность в себе будет побуждать их решать задачи в данной области и мыслить "нестандартно". Используя лучшие из трех языков программирования, два трека для визуализации, разговорный тон и многочисленные примеры, эта книга чрезвычайно универсальна и может быть использована как старшеклассниками, так и студентами естественнонаучных специальностей на 2‑х и 4‑х курсах обучения. Этот текст также идеально подходит для использования в области науки о данных, а также в профессиональных магистерских программах по естественным наукам.
Примеры страниц (скриншоты)
Оглавление
1 Some perspectives on the neighborhood 1
1.1 Introduction: when are computer simulations useful? 1
1.2 How much should a simulation be trusted? 7
1.3 Who first used them and why they came about 8
1.4 What’s the state of the art? What limits have been pushed? 13
1.5 The simulation’s new clothes 14
1.6 Computer modeling is a highly interdisciplinary field 17
1.7 What types of models are most important for everyday things? 19
1.8 When do you build your own tools and when are black boxes the best? 22
References 23
2 Getting some solid tools in place 25
Cutting to the chase: programs in this chapter 25
2.1 Introduction: getting set to go 25
2.2 Using your own machine: local platforms for Python, C++, and FORTRAN 26
2.3 A remote platform widely used in science and technology: UNIX 27
2.3.1 Logging on and file transfer 27
2.3.2 UNIX shells 30
2.3.3 Directories 30
2.3.4 Files 31
2.3.5 Commands between machines and file transfer: ssh and sftp 32
2.3.6 Other useful commands 33
2.3.7 More advanced commands 34
2.3.8 Online help 34
2.3.9 Logging out 34
2.4 A popular remote editor: Vi 35
2.4.1 Starting the Vi editor 35
2.4.2 A couple “in a bind” commands 35
2.4.3 Moving around in Vi 36
2.5 Compiling, linking, and executing simple programs 37
2.6 A comparative study in coding and computing 40
2.6.1 About the three languages chosen for this text (FORTRAN? Really?) 40
2.6.2 Smoke testing our three languages with “Hello” codes 41
2.6.3 Foundational programs in three languages you can build from 42
2.6.4 Sequences and series 50
2.6.5 Derivatives and integrals 56
2.6.6 C++, Python, FORTRAN walk into a bar:
comparing programs and results 68
2.7 How do I choose a good algorithm? 71
2.8 Examples of what can be done wrong:
compile errors, execution errors and bugs 71
2.8.1 Compile errors are mistakes which prevent compilation of the program 71
2.8.2 Linker errors are mistakes which also
prevent compilation of the program 73
2.8.3 Bugs generally cause a “Wealth” of execution (runtime) problems 73
2.8.4 Are there best practices in debugging? 75
2.9 Critically thinking about your work: relevance, applicability and limits 75
2.10 Your work in the broader context of scientific and technological communities 76
References 78
3 Visualization: Experiencing and sharing the beauty and
relevance of your work 80
Cutting to the chase: programs in this chapter 80
3.1 Introduction: visualization includes everyone 80
3.2 Visualizing two‑dimensional data sets 81
3.2.1 Data centering: right to the point 81
3.2.2 Data spread: just how scattered are you? 83
3.2.3 Data trends: how correlated is your data? 83
3.2.4 Straight line plotting: a powerful data analysis tool 84
3.3 Visualizing three‑dimensional data sets 85
3.4 Four‑ and higher‑dimensional visualization 86
3.5 Effective (reduced) systems 87
3.5.1 An object rolling down a ramp 87
3.5.2 A More complicated system: block with four wheels 89
3.6 Exaggerating aspects of a system: limiting cases 91
3.7 Visualizing calculus part I: derivatives 92
3.8 Visualizing calculus part II: integrals 94
3.9 Critically thinking about how best to visualize your results 96
3.10 Making pictures and movies 96
3.11 A sample visualization program as told by POV Raytracer and Python 97
3.12 Visualization for everyone: seeing and hearing a coffee cup cooling 104
3.13 Examples of visualization and presentation of data 111
3.13.1 When should data be presented in tables? 111
3.13.2 Representing data visually 113
3.14 Visualizing various stages of cancer cell growth 124
3.15 Baked‑in and native graphics capabilities 136
References 139
4 Headlines that touch our humanity 141
Cutting to the chase: programs in this chapter 141
4.1 Introduction 141
4.2 The synergy between ball games and science 142
4.2.1 Starting the modeling process for a baseball game 142
4.2.2 How the simulation will play out: putting the model into action 145
4.2.3 Details for the computer 146
4.2.4 Construction and validation: getting ready for an unknown problem 147
4.2.5 A word about timesteps and stability 148
4.2.6 Simulating baseball flight 149
4.3 Physics on the field: achieving more efficient football tackles 155
4.3.1 The model: not quite like play diagrams in a locker room 155
4.3.2 How the program will work: making it look like a tackle 157
4.3.3 Issues relevant to the computer 158
4.3.4 Development and validation 158
4.3.5 Simulating a football tackle 159
4.4 A Physics nerd, a cool guy, and a pool table 169
4.4.1 Mathematical game rules 169
4.4.2 How the code will work 171
4.4.3 Details for the computer 172
4.4.4 Development and validation 172
4.4.5 Simulating a pool break 172
4.5 The unpleasant things in life that harm us 185
4.5.1 Simulating auto collisions 185
4.5.2 Protecting better against bullet impact 192
4.6 Diseases 194
4.6.1 Python feature: simulating and animating
tumor growth using the Eden model 194
4.6.2 Modeling epidemics 199
References 204
5 The many faces of music 206
Cutting to the chase: programs in this chapter 206
5.1 Introductory thoughts 206
5.2 Modeling uniform strings that vibrate 207
5.2.1 Problem statement: clamped string with uniform density and tension 207
5.2.2 Simulating the motion of a uniform string 209
5.3 A bit of background on Fourier transforms and sound spectra 215
5.4 Modeling the sound of a stringed instrument 217
5.4.1 Problem statement for stringed instruments 217
5.4.2 Simulating stringed instruments: focus on the guitar 217
5.5 Modeling strings with variable density and/or tension 221
5.5.1 The motivation to study non‑uniform strings 221
5.5.2 Problem statement: clamped string with
variable density and/or tension 222
5.5.3 Simulating the motion of a string when density or tension can vary 223
5.6 Modeling a clamped rectangular sheet 229
5.6.1 The problem statement for a clamped rectangular sheet or membrane 229
5.6.2 Simulating the motion of a clamped rectangular sheet 231
5.7 Modeling a clamped circular drumhead or membrane 239
5.7.1 Problem statement: clamped circular drumhead 239
5.7.2 Simulating the motion of a clamped circular drumhead/membrane 241
5.8 Advantages and disadvantages of each method 249
5.9 When resonance is not your friend: the Tacoma Narrows bridge 249
References 253
6 Going with the flow 254
Cutting to the chase: programs in this chapter 254
6.1 Introductory thoughts 255
6.2 The effect of boundaries on fluids 255
6.3 Modeling flow through a pipe or channel 257
6.3.1 The problem statement 257
6.3.2 Simulating flow through a pipe or channel 259
6.4 Modeling flow in a driven cavity 268
6.4.1 The problem statement 268
6.4.2 Simulating flow in a driven cavity 268
6.5 How fluids and contaminants move through porous media 276
6.6 Modeling porous flow and miscible contaminant transport 277
6.6.1 The problem statement 277
6.6.2 Simulating porous flow and contaminant transport in a rectangle 278
6.7 Heat transport: porous medium flow in disguise 286
6.8 Python feature: modeling 1D heat transport: the homogeneous conducting bar 286
6.8.1 The problem statement and solution 286
6.8.2 Python feature: simulating heat transport in a conducting bar 288
6.9 Modeling 2D heat transport: the nonuniform thermally conducting plate 292
6.9.1 The problem statement 292
6.9.2 Simulating heat transport in a nonuniform conducting plate 292
6.10 Modeling 3D heat transport 297
6.10.1 The problem statement: the uniform thermally conducting cylinder 298
6.10.2 Simulating the temperature field in a uniform
thermally conducting cylinder 299
6.11 More 3D heat transport in curvilinear coordinates 307
6.11.1 The problem statement: the uniform thermally conducting sphere 307
6.11.2 Simulating the temperature field in a uniform
thermally conducting sphere 308
References 318
7 One of the most versatile simulation tools around 320
Cutting to the chase: programs in this chapter 320
7.1 Introduction 320
7.2 Theory behind our material point method simulations 321
7.2.1 The MPM algorithm utilized here 321
7.2.2 Calculating the internal force: elasticity theory
and stress–strain relationships 323
7.3 Simulating elastic colliding spheres with MPM 327
7.3.1 The code 327
7.4 Applications of the material point method simulation 348
7.4.1 Blood flow 348
7.4.2 Planetary impact 351
References 357
8 Atomic and molecular modeling 359
Cutting to the chase: programs in this chapter 359
8.1 Introduction to molecular dynamics computer simulations 359
8.2 Molecular Dynamics simulation of a system of particles 360
8.2.1 Initial thoughts 360
8.2.2 Constructing the program 360
8.2.3 Comments on validation 373
8.2.4 Thermostats: nobody does temperature control like nature does 374
8.2.5 Choosing an integration algorithm for your simulation 374
8.2.6 More complicated stuff: modeling molecules with molecular dynamics 376
8.2.7 There’s more to life that solid, liquid, and gas 377
8.2.8 When molecular dynamics works out better than you had hoped 379
8.3 Monte Carlo simulations 380
8.3.1 Theory behind the simulations 380
8.3.2 Using Monte Carlo to simulate well‑known magnetic systems 383
8.3.3 Comments on validation 394
8.3.4 Learning new things about how layered magnetic systems behave 394
8.3.5 When Monte Carlo works out better than you had hoped 396
8.4 How do we choose MD or MC? 397
8.5 Matter waves: Schrödinger’s Equation 397
8.5.1 Hydrogenic species under spherical confinement 397
8.5.2 Python feature: calculating energy levels of hydrogenic atoms 398
8.5.3 Comments on other translations of the code 402
References 405
9 Classical astrophysical simulations 407
Cutting to the chase: programs in this chapter 407
9.1 Direct simulations of planetary and galactic systems 407
9.1.1 Some background: scratching the surface 407
9.1.2 Python feature: simulating planetary and galactic systems 408
9.2 Advanced planetary dynamics simulation and programming: go climb a tree 418
9.2.1 Some background 418
9.2.2 Advanced C++ feature: simulating planetary
aggregation with Barnes‑Hut 418
References 436
10 Object‑oriented programming (OOP) 437
Cutting to the chase: programs in this chapter 437
10.1 Introductory thoughts 437
10.2 Four tenants of object‑oriented programming 438
10.2.1 Encapsulation and abstraction 438
10.2.2 Polymorphism 441
10.2.3 Inheritance 444
10.2.4 OOP in FORTRAN…yes…FORTRAN 447
10.3 Python feature: 3D heat transport with OOP 447
References 456
11 When heavy lifting is needed: Parallel computing, scripting, and GPUs 458
Cutting to the chase: programs in this chapter 458
11.1 Introductory thoughts 458
11.2 Message Passing Interface (MPI) 459
11.3 Decompositions: breaking up is easy to do 459
11.4 Example parallel programs 460
11.4.1 A word or several about compiling and running MPI programs 460
11.5 An integral done with MPI 461
11.5.1 Python feature: MPI calculation of the integral (11.1) 461
11.5.2 The same integral in C++ with MPI 464
11.5.3 Finally, the integral in FORTRAN with MPI 469
11.6 Python feature: 3D cartesian heat transport with MPI 473
11.7 UNIX scripting 481
11.8 Graphics processing units (GPUs) 483
References 484
12 The revolution of artificial intelligence 486
12.1 Introduction 486
12.2 Types of AI 487
12.2.1 Machine learning 487
12.2.2 Neural networking (deep learning) 487
12.2.3 Natural language processing 487
12.2.4 Robotics 487
12.2.5 Expert systems 488
12.2.6 General AI 488
12.3 How best to learn practical AI basics 488
12.3.1 Online courses and tutorials 488
12.3.2 Interactive learning platforms 489
12.3.3 YouTube videos 489
12.3.4 AI blogs 489
12.3.5 AI communities 489
12.3.6 Podcasts and webinars 490
12.4 Concluding remarks 490
Appendix I: Snow in July 491
Index 523