Professional Documents
Culture Documents
(Download PDF) Computational Nuclear Engineering and Radiological Science Using Python 1St Edition Ryan Mcclarren Online Ebook All Chapter PDF
(Download PDF) Computational Nuclear Engineering and Radiological Science Using Python 1St Edition Ryan Mcclarren Online Ebook All Chapter PDF
https://textbookfull.com/product/fundamentals-of-nuclear-science-
and-engineering-third-edition-faw/
https://textbookfull.com/product/ethics-and-law-for-chemical-
biological-radiological-nuclear-explosive-crises-donal-p-
omathuna/
https://textbookfull.com/product/chemical-and-biomedical-
engineering-calculations-using-python-1st-edition-jeffrey-j-heys/
https://textbookfull.com/product/computational-and-analytic-
methods-in-science-and-engineering-1st-edition-constanda/
Introduction to Python for Science and Engineering 1st
Edition David J. Pine
https://textbookfull.com/product/introduction-to-python-for-
science-and-engineering-1st-edition-david-j-pine/
https://textbookfull.com/product/computational-and-analytic-
methods-in-science-and-engineering-christian-constanda/
https://textbookfull.com/product/data-science-and-machine-
learning-interview-questions-using-python-second-edition-
vishwanathan-narayanan/
https://textbookfull.com/product/web-scraping-with-python-2nd-
edition-ryan-mitchell/
https://textbookfull.com/product/computational-problems-for-
physics-with-guided-solutions-using-python-1st-edition-rubin-h-
landau-manuel-jose-paez/
COMPUTATIONAL NUCLEAR
ENGINEERING AND RADIOLOGICAL
SCIENCE USING PYTHON™
COMPUTATIONAL
NUCLEAR
ENGINEERING AND
RADIOLOGICAL
SCIENCE USING
PYTHON™
Ryan G. McClarren
Department of Aerospace and Mechanical Engineering
University of Notre Dame, Notre Dame, IN, USA
Academic Press is an imprint of Elsevier
125 London Wall, London EC2Y 5AS, United Kingdom
525 B Street, Suite 1800, San Diego, CA 92101-4495, United States
50 Hampshire Street, 5th Floor, Cambridge, MA 02139, United States
The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, United Kingdom
Copyright © 2018 Elsevier Inc. All rights reserved.
No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical,
including photocopying, recording, or any information storage and retrieval system, without permission in writing from
the publisher. Details on how to seek permission, further information about the Publisher’s permissions policies and our
arrangements with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency, can be
found at our website: www.elsevier.com/permissions.
This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as
may be noted herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and experience broaden our
understanding, changes in research methods, professional practices, or medical treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any
information, methods, compounds, or experiments described herein. In using such information or methods they should be
mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability for any
injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or
operation of any methods, products, instructions, or ideas contained in the material herein.
ISBN: 978-0-12-812253-2
Acknowledgment xvii
3. Functions, Scoping, Recursion, and
I Other Miscellany
vii
viii CONTENTS
13. Open Root Finding Methods 16.1 Gauss Quadrature Rules 187
16.1.1. Where Did The�e Point� Come
13.1 Newton's Method 230
From? 288
13.2 Inexact Ne\\'ron 234
16.1.2. Code for Gauss-Legendre
13.J Secant Method 236
Quadrature 290
1304 Slow Convergence 238
16.2 Multi.dim ensionallntegrals 294
13.5 Newton's Method for Systems of Equarions 242
Coda 297
13.5.1. Rec tangular Parallelepiped
Problems 298
(Shoebox) Reactor Exmnple 243
Short Exercises 298
Coda 247
Programming Projects 298
Problems 147
Short Exercises 247
Programming Projects 247 17. Initial Value Problems
Ryan G. McClarren first tried to use com- a scientist at Los Alamos National Labora-
puters to solve scientific problems in mid- tory in the Computational Physics and Meth-
dle school when he thought his self-taught ods Group (CCS-2). He is the author of over
BASIC programming skills might make his al- 40 publications appearing in peer-reviewed
gebra homework easier. Currently, he is As- journals, including the Journal of Compu-
sociate Professor of Aerospace and Mechan- tational Physics, Nuclear Science and Engi-
ical Engineering at the University of Notre
neering, Physics of Plasmas, and the Journal
Dame. He obtained his Ph.D. (nuclear engi-
of Computational and Theoretical Transport.
neering and radiological sciences) from the
He also has extensive experience in applied
University of Michigan. He is an active re-
searcher in numerical methods for radiation data science and has consulted for a vari-
transport problems and uncertainty quan- ety of large firms applying computational
tification. Prior to joining Notre Dame, he science to problems in the retail, banking,
was Assistant Professor of Nuclear Engineer- and entertainment spaces. He lives in Indi-
ing in the Dwight Look College of Engi- ana with his wife, Katie and their four chil-
neering at Texas A&M University, and was dren: Beatrix, Flannery, Lowry, and Cormac.
xiii
Preface
This book is intended to serve two pur- where some knowledge of diffusion theory
poses: one to introduce students in nuclear for neutral particles is assumed. Neverthe-
and radiological engineering to Python and less, references to the relevant background
to use Python as a pedagogical tool for nu- are given.
merical methods relevant to their studies. The final part of the text covers the impor-
The audience for this book is intended to tant topic of Monte Carlo methods for parti-
be junior and senior undergraduate students. cle transport, in particular neutron transport.
Most of the material is, however, suitable The discussion mentions neutrons specifi-
for sophomore students if appropriate back- cally, but of the techniques directly apply
ground is provided for the nuclear reactor to gamma or x-ray transport, the eigenvalue
and radiation physics. The book arose out of discussion in Chapter 23 notwithstanding.
a set of lecture notes for a course at Texas For the Monte Carlo chapters, the discus-
A&M University that was for juniors who sion walks a fine line between demonstrating
had previously taken a course in nuclear re- the full power of Monte Carlo methods and
actor theory. minimizing the length of code listings. The
The first part of the book serves as the idea is to show the reader how complications
introduction to Python 3 and the relevant
could be added to Monte Carlo codes, with-
libraries for scientific computing (namely
out having each code have the totality of the
NumPy and Matplotlib). The use of the li-
functionality discussed.
brary SciPy is scrupulously minimized. This
This book adopts the philosophy that all
is not because the library is not useful (I find
the elements of the text should, where pos-
it particularly useful). Rather, learning the
numerical methods needed for engineering sible, be included in the flow of the discus-
problems would be minimized if students sion and not to treat figures and code listings
had such methods delivered on an Argen- as floating objects that can appear far from
tine platter. Additionally, this book does where they are mentioned. Additionally, in
not cover object-oriented programming with the early chapters, the code to generate the
Python. While this will be a useful skill for figures is included to demonstrate how one
those students that will develop engineering makes such figures using Python.
software as a career, there is simply not room The exercises in this book have been cho-
to do it justice in a single text. sen to demonstrate the features of the nu-
The second part of the text introduces tra- merical methods or Python code features dis-
ditional engineering numerical methods and cussed. The solutions are intended to include
applies them to engineering problems rel- a large amount of discussion and critical
evant to the audience. On the whole, the analysis of the results. This is especially true
applications do not assume a great deal for the programming projects. Ideally, the so-
of nuclear or radiological engineering back- lutions provided by students for these prob-
ground. The exception is chapters 18–20, lems are mini-lab reports, because in these
xv
xvi PREFACE
problems, the students are performing nu- Those students who do go on to be com-
merical experiments. putational scientists will deepen their un-
Finally, this book seeks to serve the needs derstanding in additional courses and read-
of students by making Python a tool for ing. I fully realize that this point of view
them to use to solve engineering problems. is not universally adopted. I only point out
Many of problems are designed to teach a that using calculators without understand-
student how to set up a problem and then ing the circuit boards inside did not make
solve it with a known algorithm. The pri- previous generations of students lesser scien-
mary goal is to know how to apply the tists.
method. My view is that a deep understand- My ultimate goal is that this book gen-
ing of numerical techniques is preferable, erates excitement in students for computa-
but not de rigeur for contemporary students. tional science.
Ryan G. McClarren
April 27, 2017
Acknowledgment
This text would not be possible with- Dr. Jean Ragusa for allowing me to present
out the many students who asked ques- a modified version of some of his problems
tions, pointed out mistakes, or told me what from when he taught a course using For-
I said that did not make sense during lec- tran.
tures or after reading my notes. In particu- I would also like to acknowledge the great
lar I want to thank Patrick Behne for catch- technology of Jupyter notebooks for creating
ing many errors in a very early draft of a means to express code in such a way as
my notes, and Logan Harbour for helping to interweave it with the reasoning behind
with the solutions to almost of the prob- it. I only hope that I could do the medium
lems herein. I would also like to thank justice.
Ryan G. McClarren
April 27, 2017
xvii
PAR T I
INTRODUCTION TO PYTHON
FOR SCIENTIFIC COMPUTING
C H A P T E R
1
Getting Started in Python
O U T L I N E
You can be shaped, or you can be broken. There is not much in between. Try to learn. Be coachable.
Try to learn from everybody, especially those who fail. This is hard. ... How promising you are as a
Student of the Game is a function of what you can pay attention to without running away.
David Foster Wallace, Infinite Jest
CHAPTER POINTS
• Python is a computer programming • Branching executes different parts of a
language that we can use to solve code depending on conditions the
engineering problems. programmer defines.
• One stores information in variables and • Iteration execute the same block of code
can make computations and comparisons repeatedly under controlled conditions.
with those variables.
What this codes says is that if the value of instructors_opinion is “annoying”, the
grade will be “F +”, otherwise or else if (elif in Python-speak) instructors_opinion
is “Not annoying” the grade will be “B+”, and anything else will be a grade of “A”. In the
example I typed in “Not Annoying” and the if statement and the elif statement require
that the string exactly match, so it executed the else part of the code.
The if-else construct allows the code to ex- cute [some other code] if expression1
ecute different branches based on the value of evaluates to false and expression2 eval-
expressions. The code uates to true, or will execute [something
if expression1: else] if both expression1 and expres-
[some code] sion2 evaluate to false. There could be more
elif expression2:
[some other code]
than one elif condition, or the else and
else: elif statements could not be there at all.
[something else] That is, it is possible to have an if without
will execute the block of code [some code] an elif or an else.
if expression1 evaluates to true, exe-
It is important to remember that when you want to check equality between two things you
need to use == and not a single equals sign. A single equals sign is what you use when you
want to assign something to a variable. You can compare numbers using the standard greater
than, less than, and other operators. See Box 1.10 for a list of commonly used operators.
In Python, when an expression evaluates to true, it evaluates to the integer 1; a false expres-
sion evaluates to 0. Therefore, we can treat a false expression as a zero and a true expression
as non-zero, as we will do in later examples.
Python also has a not operator. This operator will return true if its argument is false (or
zero); it will return false is the argument is true or nonzero. For example, not(0) will evalu-
ate to true, and not(1) and not(2.005) will both evaluate to false. The not operator can be
Another random document with
no related content on Scribd:
ie nou meeging naar de mooie meiden van Grint, naar
de lekkere Geert, Trijn, Cor en Annie.
Geen woord zei Dirk, vroeg ook niet of ie mee kon. Hij
strompelde zacht zwaaiend naast Klaas, de herberg
uit, als hoorde ie bij ’m.—
—Nou.. aa’s hai.… had d’r sels is.. binne wai ’t ook,
bromde Willem en nàbromde ’m Jan.