![Page 1: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/1.jpg)
600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church
• Intended audience: – Students considering a major in
• science, engineering or medicine
• Small Class• Diversity: Geeks Mainstream
– like Calculus &“typing”– College High School Elementary School– Fun (not too much work) Sell the field
• Practical: – Please bring laptops to class if you can
• Familiarize students with lots of stuff (breadth)• Not just a single programming language (not depth)
• Fundamentals: – Lots more to Computer Science than hacking
![Page 2: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/2.jpg)
Teamwork, Web-work, etc.• Encourage teamwork, Google, Wikipedia, etc.• Homework:
– Submit by email to [email protected]– Due Tuesday morning at sunrise
• So I have time to adjust my Tuesday lectures (if necessary)
– Target: 2 hours per hour of class• 1 hour installing software, plus• 1 hour of exercises (as opposed to problem sets)
– Homework comes with hints (as opposed to recipes)• Feel free to ask for more hints ([email protected])
– Example: Use Google to figure out how to install• R (a stat package)• LISP (http://www.newlisp.org/) • cygwin (Unix for Windows)
![Page 3: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/3.jpg)
Cheating• Please don’t, but if you do, you are only cheating yourself• I want to encourage teamwork & web-work
– Because they are great ways to learn– “Although you may work in small groups, each student must submit his/her own
program and the code may not be a copy of others’ code. You may share ideas and help – but you must write your own code and your assignment MUST be SUBSTANTIALLY different from all others.”
– Ok to submit a team effort (especially if you tell me who you are working with)
• If you can’t do the homework, explain why– My bad– Software package doesn’t work for your machine– I asked for more than 2 hours (feel free to stop after 2 hours)
• Homework is for your benefit (and mine)• Homework will be graded: satisfactory (or not)• Exams (mid-term & final) Grades
– Goal: Learn from the homework You’ll do fine on the exams
![Page 4: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/4.jpg)
First Four Weeks• Symbolic Programming (how CS was taught in 1970s)
– Practical: Familiarize students with stat package(s),• As well as symbolic alternatives: LISP & Wolfram Alpha
– Fundamental:• Stuff you can’t do with your favorite stat package• LISP: Recursion, Eval, Symbolic Differentiation• Lambda Calculus (“Small is Beautiful” beyond reason; Church’s Thesis & Computability)
• Unix for Poets (“Small is Beautiful”)– How to program (without realizing that it is programming) – How to use tr, awk & those other crazy Unix utilities (pipes)– Examples: count words (and ngrams); find interesting word associations.
• More Unix for Poets• Python & NLTK (Natural Language Toolkit):
– Unix for Poets (without Unix)– Formal Language Theory & Chomsky Hierarchy
![Page 5: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/5.jpg)
Symbolic Features(Bet you can’t do this with your favorite statistics package)
• Complex Numbers: Sqrt(-1)• Roots (without approximations)• Differentiation (without approximations)• Integration (without approximations)• The On-Line Encyclopedia of Integer Sequenc
es• Eval
![Page 6: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/6.jpg)
Sqrt(-1) Error (for many tools)
![Page 7: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/7.jpg)
Roots (without approximations)2/)51( x
![Page 8: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/8.jpg)
Numerical Methods:Approximations such as Newton’s Method
![Page 9: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/9.jpg)
Complex Roots
![Page 10: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/10.jpg)
Newton’s Methodhttp://archives.math.utk.edu/visual.calculus/3/newton.5/
1 3 5 7 9 11 13 152.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
3
sqrt(5)
Iteration (n)
Estim
ate
of s
qrt(
5)
![Page 11: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/11.jpg)
Newton’s Methodhttp://archives.math.utk.edu/visual.calculus/3/newton.5/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 152.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
3
-5
0
5
10
15
20
sqrt(5) sqrt(-5)
Iteration (n)
Estim
ate
of s
qrt(
5)
Estim
ate
of s
qrt(
-5)
![Page 12: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/12.jpg)
Symbolic Alternative
1 3 5 7 9 11 13 152.22.32.42.52.62.72.82.9
3
-5
0
5
10
15
20
sqrt(5) sqrt(-5)
Iteration (n)
Estim
ate
of s
qrt(
5)
Estim
ate
of s
qrt(
-5)
![Page 13: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/13.jpg)
![Page 14: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/14.jpg)
![Page 15: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/15.jpg)
Symbolic Methods Search
![Page 16: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/16.jpg)
Recursion
![Page 17: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/17.jpg)
(define (fact x) (if (<= x 1) 1
(* x (fact (- x 1)))))
(define (fib x) (if (<= x 2) 1
(+ (fib (- x 1)) (fib (- x 2)))))
(define (len x)(if (empty? x) 0
(+ 1 (len (rest x)))))
(define (rev x)(if (empty? x) x
(append (rev (rest x)) (list (first x)))))
More RecursionLecture3/recursive_examples.lsp
![Page 18: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/18.jpg)
The Roots of LISPEval
![Page 19: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/19.jpg)
Symbolic Differentiation
![Page 20: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/20.jpg)
Symbolic DifferentiationLecture1/deriv.lsp
http://mitpress.mit.edu/sicp/full-text/sicp/book/node39.html
![Page 22: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/22.jpg)
Semantics
![Page 23: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/23.jpg)
Surprise: Church’s Thesis
![Page 24: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/24.jpg)
• Effective Procedure– always give some answer – always give the right answer– always be completed in a finite number of steps– work for all instances of problems of the class
• Recursively Computable– Three definitions later found to be equiv to one another• general recursion• Turing machines• λ-calculus
• Church's thesis:– Effectively Procedure = Recursively Computable – Not a mathematical statement No proof
Church’s Thesishttp://en.wikipedia.org/wiki/Effectively_calculable
![Page 25: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/25.jpg)
![Page 26: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/26.jpg)
Recursion & Factorial http://www.allisons.org/ll/FP/Lambda/Introduction/
![Page 27: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/27.jpg)
Summary: Symbolic Features(Bet you can’t do this with your favorite statistics package)
• Complex Numbers: Sqrt(-1)• Roots (without approximations)• Differentiation (without approximations)• Integration (without approximations)• The On-Line Encyclopedia of Integer Sequenc
es• Eval
![Page 28: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/28.jpg)
First Four Weeks• Symbolic Programming (how CS was taught in 1970s)
– Practical: Familiarize students with stat package(s),• As well as symbolic alternatives: LISP & Wolfram Alpha
– Fundamental:• Stuff you can’t do with your favorite stat package• LISP: Recursion, Eval, Symbolic Differentiation• Lambda Calculus (“Small is Beautiful” beyond reason; Church’s Thesis & Computability)
• Unix for Poets (“Small is Beautiful”)– How to program (without realizing that it is programming) – How to use tr, awk & those other crazy Unix utilities (pipes)– Examples: count words (and ngrams); find interesting word associations.
• More Unix for Poets• Python & NLTK (Natural Language Toolkit):
– Unix for Poets (without Unix)– Formal Language Theory & Chomsky Hierarchy
![Page 29: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/29.jpg)
Homework: Questions [email protected]
• Install (hint: Google)– R (a stat package)– LISP (http://www.newlisp.org/) – cygwin (Unix for Windows); skip if you have Unix
• Send me an email with:– Subject: 600.103 Homework #1 from <name>– Body: screen shots (see next couple of slides)– Due Tuesday morning (at sunrise)
![Page 30: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/30.jpg)
Homework: sqrt(4)• Screenshots of sqrt(4) and sqrt(-4) from
– R– Wolfram Alpha– Newton’s Method http://archives.math.utk.edu/visual.calculus/3/newton.5– LISP
• For Newton’s Method, what settings generate– sqrt(4) 2 v. sqrt(4) -2– Are there any settings so that sqrt(4) NaN?
• In R, show me the following plot– x = seq(-4,4,1/10)– plot(x, x^2 - 4)– abline(h=0)– abline(v=c(-2,2), col="red")
![Page 31: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/31.jpg)
Fibonacci
• Use NewLisp & Encyclopedia of Integer Sequences to compute Fibonacci– F(n) = F(n-1) + F(n-2), F(0)=F(1)=1– What is F(15)?
![Page 32: 600.103 FUNDAMENTALS OF PRACTICAL COMPUTING Ken Church](https://reader036.vdocument.in/reader036/viewer/2022062305/56814bd0550346895db8a9e6/html5/thumbnails/32.jpg)
Readings
• The Roots of LISP– Use Google to find the article– “The unusual thing about Lisp-- in fact, the
defining quality of Lisp-- is that it can be written in itself.”
• The Halting Problem (Wikipedia)– What does this have to do with Computability?