Download full Introduction to Computation and Programming Using Python Revised and Expanded Edition John V. Guttag ebook all chapters
Download full Introduction to Computation and Programming Using Python Revised and Expanded Edition John V. Guttag ebook all chapters
com
https://ebookname.com/product/introduction-to-computation-
and-programming-using-python-revised-and-expanded-edition-
john-v-guttag/
OR CLICK HERE
DOWLOAD NOW
https://ebookname.com/product/programming-in-python-3-a-complete-
introduction-to-the-python-language-2nd-edition-summerfield/
ebookname.com
https://ebookname.com/product/intimate-matters-third-revised-and-
expanded-edition-john-demilio/
ebookname.com
https://ebookname.com/product/beginning-python-using-python-2-6-and-
python-3-1-wrox-programmer-to-programmer-james-payne/
ebookname.com
https://ebookname.com/product/psychological-aspects-of-cyberspace-
theory-research-applications-1st-edition-azy-barak-editor/
ebookname.com
https://ebookname.com/product/musicians-as-lifelong-
learners-32-biographies-1st-edition-rineke-smilde/
ebookname.com
https://ebookname.com/product/civilization-and-disease-henry-e-
sigerist/
ebookname.com
https://ebookname.com/product/congo-solo-misadventures-two-degrees-
north-1933-restored-unadulterated-ed-2011-emily-hahn/
ebookname.com
https://ebookname.com/product/studies-in-the-meaning-of-judaism-1st-
edition-eugene-b-borowitz/
ebookname.com
Encyclopedia Of Food And Culture 3 Volume Set 1st Edition
Solomon H. Katz (Editor In Chief)
https://ebookname.com/product/encyclopedia-of-food-and-
culture-3-volume-set-1st-edition-solomon-h-katz-editor-in-chief/
ebookname.com
Introduction to
Computation and
Programming Using Python
Introduction to
Computation and
Programming Using Python
John V. Guttag
All
rights
reserved.
No
part
of
this
book
may
be
reproduced
in
any
form
by
any
electronic
or
mechanical
means
(including
photocopying,
recording,
or
information
storage
and
retrieval)
without
permission
in
writing
from
the
publisher.
MIT
Press
books
may
be
purchased
at
special
quantity
discounts
for
business
or
sales
promotional
use.
For
information,
please
email
special_sales@mitpress.mit.edu
or
write
to
Special
Sales
Department,
The
MIT
Press,
55
Hayward
Street,
Cambridge,
MA
02142.
Introduction
to
computation
and
programming
using
Python
/
John
V.
Guttag.
—
Revised
and
expanded
edition.
pages cm
Includes index.
QA76.73.P48G88 2013
005.13'3—dc23
10
9
8
7
6
5
4
3
2
1
To my family:
Olga
David
Andrea
Michael
Mark
Addie
CONTENTS
PREFACE .......................................................................................................xiii
ACKNOWLEDGMENTS..................................................................................... xv
1
GETTING STARTED .................................................................................... 1
2
INTRODUCTION TO PYTHON ...................................................................... 7
2.1
The Basic Elements of Python ............................................................... 8
2.1.1
Objects, Expressions, and Numerical Types .................................... 9
2.1.2
Variables and Assignment ............................................................ 11
2.1.3
IDLE ............................................................................................ 13
2.2
Branching Programs ........................................................................... 14
2.3
Strings and Input ............................................................................... 16
2.3.1
Input ............................................................................................ 18
2.4
Iteration .............................................................................................. 18
3
SOME SIMPLE NUMERICAL PROGRAMS .................................................. 21
3.1
Exhaustive Enumeration .................................................................... 21
3.2
For Loops............................................................................................ 23
3.3
Approximate Solutions and Bisection Search ...................................... 25
3.4
A Few Words About Using Floats ........................................................ 29
3.5
Newton-Raphson ................................................................................ 32
4
FUNCTIONS, SCOPING, and ABSTRACTION ............................................. 34
4.1
Functions and Scoping ....................................................................... 35
4.1.1
Function Definitions ..................................................................... 35
4.1.2
Keyword Arguments and Default Values ....................................... 36
4.1.3
Scoping ........................................................................................ 37
13 RANDOM WALKS AND MORE ABOUT DATA VISUALIZATION ................. 179
13.1 The Drunkard’s Walk ...................................................................... 179
13.2 Biased Random Walks .................................................................... 186
17.2.3
Shortest Path: Depth-First Search and Breadth-First Search .... 246
18
DYNAMIC PROGRAMMING ..................................................................... 252
18.1
Fibonacci Sequences, Revisited ....................................................... 252
18.2
Dynamic Programming and the 0/1 Knapsack Problem................... 254
This book is based on an MIT course that has been offered twice a year since
2006. The course is aimed at students with little or no prior programming
experience who have desire to understand computational approaches to problem
solving. Each year, a few of the students in the class use the course as a
stepping stone to more advanced computer science courses. But for most of the
students it will be their only computer science course.
Because the course will be the only computer science course for most of the
students, we focus on breadth rather than depth. The goal is to provide
students with a brief introduction to many topics, so that they will have an idea
of what’s possible when the time comes to think about how to use computation
to accomplish a goal. That said, it is not a “computation appreciation” course.
It is a challenging and rigorous course in which the students spend a lot of time
and effort learning to bend the computer to their will.
The main goal of this book is to help you, the reader, become skillful at making
productive use of computational techniques. You should learn to apply
computational modes of thoughts to frame problems and to guide the process of
extracting information from data in a computational manner. The primary
knowledge you will take away from this book is the art of computational problem
solving.
The book is a bit eccentric. Part 1 (Chapters 1-8) is an unconventional
introduction to programming in Python. We braid together four strands of
material:
But the bulk of this part of the book is devoted to topics not found in most
introductory texts: data visualization, probabilistic and statistical thinking,
simulation models, and using computation to understand data.
1 This was Euclid’s purported response, circa 300 BC, to King Ptolemy’s request for an
From the Crypt to the dome the space measures 190 feet.
“When Wren planned his dome interior he had the difficulty caused by
the four limbs and their side aisles to overcome. He must have turned to his
uncle’s cathedral at Ely for enlightenment. In the earlier years of the
Fourteenth Century the central tower of Ely collapsed, and the sacrist Alan
de Walsingham, who acted as architect, seeing that the breadth of his nave,
choir and transepts happened to agree, took for his base this common
breadth, and cutting off the angles, obtained a spacious octagon. The four
sides terminating the main aisles are longer than the four alternate aisles at
the angles of the side aisles; but at Ely this presents no difficulty, owing to
the use of the pointed arch. As you stand in the centre of the octagon under
the lantern you see eight spacious arches of two different widths, all
springing from the same level and rising to the same height of eighty-five
feet, the terminal arch of the Norman nave pointed like its opposite
neighbour of the choir. Amongst Gothic churches the interior of Ely reigns
unique and supreme, certainly in England if not in Europe. Wren was
familiar with this cathedral, and even designed some restorations for it; and
he adopted the eight arches in preference to any possible scheme of four
great arches of sixty feet: but the use of the round arch, as distinct from the
pointed, deprived him of Sacrist Alan’s liberty, who without incongruity
made his intermediate arches of the shorter sides, springing from the same
level, rise to the same height as the others. Wren was compelled to make use
of some expedient to reconcile his two different spaces between piers of
forty feet and twenty-six feet, and accordingly arched these four smaller
intermediate spaces as follows. A smaller arch, rising from the architrave of
the great pier, spans each shorter side of the octagon, and has a ceiling or
semi-dome in the background, coming down to the terminal arches of the
side aisles. A blank wall space above is relieved by a section of an
ornamental arch of larger span, resting on the centre of the cornice; and
above this a third arch, rising from the level of the triforium cornice, rests
more upon the outer side of the great supporting pier, and thereby obtains the
required equal span of forty feet, and equal height of eighty-nine feet from
the ground. This also has a semi-dome; and the platform beneath on a level
with the clerestory is railed.
“The reduction of the octagon to the circle is facilitated by giving the
spandrels between the arches the necessary concave surface; and this stage is
finished off with a cantilever cornice, the work (at least in part) of one
Jonathan Maine. The eight great keystones of the arches by Caius Gabriel
Cibber are seven feet by five, and eighteen inches in relief.”—(A. D.)
The apse behind the altar cut off by the reredos is now
called the Jesus Chapel. Over the altar here is a copy of
Cima de Conegliano’s Doubting Thomas (in the National
Gallery).
The apse and the vaulting and the walls of the choir and
ambulatory have in recent years been decorated by Sir
William Richmond with richly-coloured mosaics. The chief
panels of the apse represent our Lord enthroned, with
recording angels on either side. In the choir the three
“saucer domes,” or cupolas, represent three Days of
Creation: Beasts, Fishes and birds. The four pendentives of
each bay are decorated with herald Angels, with extended
arms. Mosaics of the Crucifixion, Entombment,
Resurrection and Ascension, also by Sir William
Richmond, adorn the “quarter domes.”
The eight paintings by Thornhill, of scenes from the life
of St. Paul, can be viewed properly only from the
Whispering Gallery. In the niches above this Gallery are
statues of the Fathers of the Church. The spandrels between
the great arches are decorated by eight large mosaics
representing apostles and prophets: St. Matthew and St.
John are by G. F. Watts; St. Mark and St. Luke, by A.
Brittan; and the four prophets are the work of Alfred
Stevens.
The Transepts are of one arch only. The windows are
modern and represent bishops and kings of early days. In
the south transept aisle there is a window commemorating
the recovery of the Prince of Wales (Edward VII.) in 1872;
and a bronze tablet by Princess Louise in memory of
“4,300 sons of Britain beyond the seas” who were killed in
the South African war of 1899-1901.
To the left of the chief entrance is St. Dunstan’s Chapel,
sometimes called the North-West, or Morning Chapel. It
is richly decorated and contains a Salviati mosaic
representing the Three Marys at the Sepulchre.
In the south aisle, opposite, is the Chapel of the Order
of St. Michael and St. George, a Colonial order, conferred
only for distinguished services beyond the seas. The
Sovereign’s stall is at the western end; and on each side of
it is that of the Grand Master (Prince of Wales) and the
Duke of Connaught. From these diverge the oak stalls of
the Knights Grand Cross of the Order, over each of which
is suspended a silk banner with his personal arms. The
richly-gilded ceiling is decorated with the arms of the
King, the Prince of Wales, the late Duke of Cambridge and
Sir Robert Herbert, who were responsible for the scheme.
In the south window is a kneeling figure of the donor, Sir
Walter Wilkin. The chapel was dedicated on June 13, 1906,
in the presence of King Edward, the Prince of Wales and
many Knights.
Above this chapel the Library is situated to which the
curious Geometrical Staircase leads. This is circular, of a
diameter of twenty-five feet, and each step is supported by
the one below it. This is in the South tower.
St. Paul’s is second only to Westminster Abbey in the
number of Monuments to the celebrated dead. Immediately
within the west door stands a gilt monument to the officers
and men of the Coldstream Guards who fell in the South
African War. In the north aisle of the nave we come to
monuments of General Gordon, a recumbent figure on a
sarcophagus by Sir Joseph Edgar Boehm; Wellington, by
Alfred Stevens; Lord Leighton; Lord Melbourne. In the
north transept Sir Joshua Reynolds, by Flaxman; and
Admiral Rodney, by Rossi; in the south transept Nelson,
by Flaxman, who thus describes his work:
“Britannia is directing the young seamen’s attention to their great
example, Lord Nelson. On the die of the pedestal which supports the hero’s
statue are figures in basso-relievo, representing the Frozen Ocean, the
German Ocean, the Nile, and the Mediterranean. On the cornice and in the
frieze of laurel wreaths are the words, Copenhagen, Nile, Trafalgar. The
British Lion sits on the plinth, guarding the pedestal.”
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com