CS 135/Additional Materials/Chapter 2

From Worcester State University Computer Science Department Wiki
Jump to: navigation, search

Resources are grouped by sections of the chapter. When adding a new resource, please try to add it to the appropriate section.

Section 2.1 Objectives

Section 2.2 What is Pi? http://www.livescience.com/29197-what-is-pi.html 9/21/16 created in 2013 This resource is very helpful/useful because this website has a great deal of details on pi, the history of pi such as where and when it was created, and even includes a diagram of pi being represented in the equation of finding the circle's circumference. It has all the information you need about pi right in front of you without having to search through chapters in the book. Ryan Connor

Section 2.3 More about the math Module

https://www.youtube.com/watch?v=nm92ZoCkYoo this video is very useful because it explains what libraries are, their uses, and how to access them. Moreover, it explains how to load the random module which I personally had trouble with. Furthermore, it shows how the randint function works and how to use it. Posted by Hanan Ibraheim on 10/4/2016

Section 2.4 The Archimedes Approach

Section 2.4.1 The Python Implementation

Section 2.4.2 Developing a Function to Compute Pi

"Programs to Compute Pi" https://www.angio.net/pi/pi-programs.html (Date created: not stated) I thought this resource was very helpful in figuring out how to compute pi within Python. It gives you examples in how to do them as well. (Added by Alex Lombardi - 4 October 2016)

Section 2.5 Accumulator Approximations

Section 2.5.1 The Accumulator Pattern

"For Loops in Python" https://www.youtube.com/watch?v=9LgyKiq_hU0 (created 30 June 2011) This resource is a video discussing how the range function works and how this is applied to 'for loops'. It then provides a detailed example and explanation of how 'for loops' are used in an accumulation of sums. (added by Nicole Daury - 3 October 2016)

Section 2.5.2 Summation of Terms: The Leibniz Formula

Section 2.5.3 Product of Terms: The Wallis Formula

Section 2.6 A Monte Carlo Simulation

Section 2.6.1 Boolean Expressions

Section 2.6.2 Compound Boolean Expressions and Logical Operators

"Conditional Execution" - http://www.pythonlearn.com/html-008/cfbook004.html - created in 2013 - This resource is an online book that provides plenty of examples of Boolean expressions and Logical Operator Behaviors to help better understand the programming. - Jennifer Recalde - 3 October, 2016. https://www.tutorialspoint.com/python/python_if_else.htm This website explains a little more and gives examples of how to use ifelse statements along with using elif.Not only does this website show you a diagram of how to structure the statements but it also then gives you an example with real numbers so you can understand more clearly how it works. -Taylor Hutchings

http://www.openbookproject.net/thinkcs/python/english2e/ch04.html This website gives a thorough explanation of the different Boolean expressions and gives several examples of different types. Last edited 2010. (posted on October 4, 2016 by Anna Haynes).

Section 2.6.3 Selection Statements

if, else and elif statements https://www.youtube.com/watch?v=ric82V2s2z4 This video explains what a if,else and elif statement is. Also shows an example of using the if,else, and elif statements. Video posted Sep 29, 2015. Megan Bellve October 3,2016

IF...ELSE...ELIF Statements https://www.tutorialspoint.com/python/python_if_else.htm This website includes a lot of helpful information about if/else expressions including a flow diagram as well as a thorough explanation of the elif statement. You can turn the pages in the site to see more tutorials. Website last edited 2016. (posted on October 4, 2016 by Leah Stanley).

Section 2.6.4 Completing the Implementation

Number of Darts Method: https://www.youtube.com/watch?v=p1oQVHfg0Gg This video shows a way you can approximate pi by using the dart method like we did in class, but it is somewhat different from how we did it. (Chantal Thomas 10/3/16)

Section 2.6.5 Adding Graphics

Section 2.7 Summary