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

https://www.youtube.com/watch?v=RquKAhdGajw this video shows how to import the math module and even gives a few examples on how to use the math module. posted by Paige Giordano on 10/5/2016

Section 2.4 The Archimedes Approach

THE ARCHIMEDES APPROACH http://www.craig-wood.com/nick/articles/pi-archimedes/ This is a link that shows how to calculate pi using the archimedes method in more depth. It offers diagrams, mathematical simplification and python examples that can help make the archimedes approach more understandable. Posted by Teri Akuk on the 5th of October 2016.

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

https://www.youtube.com/watch?v=8QYI83jySUE This video goes over simple for loops and accumulator patterns (Added by Eric Pappelardo, October 5th)

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

"Leibniz's Formula for Pi" https://proofwiki.org/wiki/Leibniz%27s_Formula_for_Pi (Last modified June 15th, 2016) This page explains in great detail where the Leibniz Formula comes from and how it works. (Added by Eric Landry 10/5/16)

Section 2.5.3 Product of Terms: The Wallis Formula

Section 2.6 A Monte Carlo Simulation

https://docs.python.org/2/library/random.html This page, created by the Python Software Foundation thoroughly explains the random module, what it does and all of the functions associated with it. The random module is a necessity in using the Monte Carlo simulation for calculating the value of pi. (Justin Boucher, October 4, 2016)

Section 2.6.1 Boolean Expressions

This page covers True and False statements and shows the order of operations the computer analyzes. http://www.thomas-cokelaer.info/tutorials/python/boolean.html (posted in October 5, by Ava Lauer) The following link explains True and False statements and Boolean operations, along with a few other things. https://docs.python.org/2/library/stdtypes.html (posted 10/05/16, Katelyn Valley)

This page provides a very helpful, step by step introduction the concept and application of boolean expressions https://en.m.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_2.6/Boolean_Expressions (posted 10/5/16 by Alec Barber)

this video covers the basic boolean expressions and values. Although the video does not go too in depth or deeply explain things, it makes it very easy to remember and this source still presents all of the different boolean operators and values that present different outcomes. it is easy to follow and is more than likely made to help better understand the Boolean data type. https://www.youtube.com/watch?v=cPg0w0OL7iQ (posted 10/5/16, Patrick Taylor)

This link shows basic descriptions of the values of a boolean expression. It is combines the boolean section with others that we have covered. keeping all helpful tables and charts on one page. https://docs.python.org/2/library/stdtypes.html (posted 10/5/2016, Katelyn Ellis)

This link explains the Boolean function http://mathworld.wolfram.com/BooleanFunction.html (October 5th) (Eliza Bulger)

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

http://composingprograms.com/pages/22-data-abstraction.html Data Abstraction: Section 2.2.4 - The Properties of Data breaks down IF and ELIF. In addition to that it also shows examples of different (yet basic) math functions we have not tried in class. Lastly, there is a brief explanation about logical operations. Published by John DeNero based on the textbook "Structure and Interpretation of Computer Programs”. Posted by Hinal Vaghela on 5 October 2016

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

Elif Statements https://learnpythonthehardway.org/book/ex30.html This website gives an easy to understand view of selection statements. This website shows how the code is put into python and has links to other aspects of python programming. Website last edited 2016. Posted on October 5, 2016 by Joe Locatell

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).

More Control Flow Tools https://docs.python.org/3/tutorial/controlflow.html This website has a intro to if, else and elif statements was well as an overview of loops. What is useful about this website is that they show how the two expressions can be combined into more useful programs. Website last updated on Sep 23, 2016.(Clara Gatsios October 5, 2016)

Python if...else Statement http://www.programiz.com/python-programming/if-elif-else This provides even more examples examples, flow charts and correct syntax usage for the three different types of statements. It breaks down each type in an easy to read way. (Kay Paradis October 5, 2016)

if else, and elif http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/ifstatements.html This explains if else and elif statements more and gives more examples of them by telling what to do and then showing what it should look like. (Travis Campbell October 5, 2016)

Python if else: An in Depth Guide... https://blog.udemy.com/python-if-else/. This article gives an "in depth guide" to working with if else statements. It gives examples of how to input the functions into Python and step by step instructions. (Sara Cohen October 5, 2016)

3.1 If Statements. http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/ifstatements.html Last updated Jan 14, 2014. This site provides many examples and descriptions of situations of if statements and how to use them. I found this site helpful because it consists of many examples which can be used to follow in python. (October 5, 2016. Jim LeNoir)

Section 2.6.4 Completing the Implementation

Intro to Darts Method: [1] This website is a great introduction of the monte carlo approximation of evaluating PI. This page also gives python code in which you can interact with to see the darts method in action. (Sam Hanson 10/5/16) 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

" https://www.youtube.com/watch?v=j0zHKiS05Z4 " This is a simple video that will help you to add graphics. This link " http://interactivepython.org/courselib/static/thinkcspy/Functions/ATurtleBarChart.html " will teach you how to create a bar graph. It uses similar techniques like "setworldcoordinates" and will further help you understand Turtle and Python (Randolph Mogren 10/5/2016)

Section 2.7 Summary