0% found this document useful (0 votes)
8 views

lec 2 What is computation

Uploaded by

ricksonyonah24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

lec 2 What is computation

Uploaded by

ricksonyonah24
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

What is computation

Prof Sane
● Fork →
○ computational (computation based), (Indian)
○ axiomatic (proof based) (Greek tradition)
● Algorithm → Al Khwarizmi -> “Compendious Books of Hindu Calculational
Methods” (800 ce)
○ The use of decimal numbers, mult, add, div etc…
○ Kh. never understood negative numbers
○ al gorismi → algorithm
● Axiomatic: popular, and a lot intellectual work went into it
● “al jabbar” → algebra, “balancing” no symbols whatsoever (symbolic 1650ce,
Vieta)
● Schools → axiomatics is mathematics
● Equation solving has pride of place in school.
Prof Sane
● Equations are necessary for describing problems, but it is impossible to solve
equations more complicated that quartics (4th power)
● Differential equations become more unsolveable even more quickly
● You end up inventing algorithms for both of the above
● Newtons eq “worked” → predictions were correct
○ Neptune (1880??) (prediction and observation disagreed)
■ Waman Tilak -- he got it better and more correct than
■ Solution: there is an unknown planet that is perturbing neptune → Pluto
○ Our theory is correct, but our experimental setup has limitations
● Failed again around 1930, this time for Mercury
○ Unknown planet called Vulcan → but nobody could find it
○ This time though Mercury motion was explained by a better theory, Relativity
Prob 1
● Sum of numbers from 1.. n is n*(n+1)/2
Induction : non inductive proofs
1 + 2 + 3.. + n

n + (n-1) + .. 1

--------------------

(n+1) + (n+1) + … (n+1) → n times

n*(n+1)

-- each line is half n*(n+1)/2


Metaphor for induction

● There is a non-uniform infinite ladder, prove that I can climb to any height
desired.
● Non uniform means: The distance between steps can vary
● If the following 2 conditions hold
○ I can climb to the first step from the ground
○ If I am at ANY Kth step, I can always climb to the K+1th step
● Then
○ I can climb to any height desired
● Another way of saying: no step is further apart than my ability to climb
Formal notion of induction
I have to prove a proposition Q involving a property P(x)
Q --> FOR ALL n, n is non-negative integer, P(n) is true
P(n) --> induction hypothesis
Steps
1. For n == 0, P(0) is true
2. Choose any arbitrary non-neg integer k (I don’t know what it is, so I rep with a
symbol)
a. ASSUME that the property P(k) is True (it is true at integer k)
b. PROVE that GIVEN P(k) I can prove P(k+1)
Gofer version of induction
Gofer version of induction upto whichever n is given. Start with a list of integers.

ints.n = [1...n]

sum : [Int] -> Int -- usual summation, also called sigma

and : [Bool] -> Bool -- “and” is True if all elements of input list are true “myand.True.True = True”

A proposition, or a predicate, is an expression that yields Bool

propP : Int -> Bool, propQ : Int -> Bool

--- Sigma(i = 0 to n) =? n (n + 1) 2

propP.n = sum.(ints.n) == n*(n+1)/2 -- for any integer n

-- Prove that: Q Sigma(i = 0 to n) =? n (n + 1) 2

propQ.m = and.[ propP.k | k ← [1...m] ] -- for ALL integers upto m

-- Q --> FOR ALL n, n is non-negative integer, P(n) is true ( generalized for any predicate / proposition “p”) (countable)

--Principle of Induction “Schema” -- schema is a technical name when you want to say statements about “Any Proposition”

propGQ.p.m = and.[ p.k | k ← [1...m] ]


Induction, formally
1. Prove that: Q Sigma(i = 0 to n) =? n (n + 1) 2
2. What is LHS and what is RHS
3. P(0)
a. LHS => Sigma(i = 0 to 0)
b. RHS => 0 * (0+1) / 2
c. LHS = RHS hooray climbed the first rung
4. P(k) -- I don’t know what k is (doesn’t matter what k is)
a. LHS1 = Sigma(i=0 to k) RHS1 = k(k+1)/2
b. assume LHS1 = RHS1
5. P(k+1)
a. LHS2 = Sigma(i=0 to k+1) RHS2 = (k+1)*(k+2)/2
b. assuming 4b, prove 5a
6. Prove that LHS2 = k(k+1)/2 + (k+1), RHS2 = (k+1)*(k+2)/2
7. Primary implication: The truth of P(k) implies the truth of P(k+1) P(k) => P(k+1)
8. P(0) => P(1) => P(2) =>...P(u) => P(u+1) => …..
Induction in programming

● Suppose you have written a program Z that looks at a list of numbers and tells
you whether property P is true, where P is “for every pair of numbers, the
smaller appears before the larger in a list”
● You already know what the property is.
● If the program is k-th way through (it has examined k numbers), and then it
will successfully verify the k, k+1th pair has property P,
● Then that program Z will work for any list of numbers.
Python

1. variables and integers and strings


2. Lists/Arrays, and numpy arrays
3. functions
4. if/then/else and booleans
5. while loops
6. All other features of programming languages can be translated into these 5
things.
Prajas Naik
We know it is true for n = 0 and n = 1
let it be true for arbitrary n
therefore, 1+2+3+....+n = n(n+1)/2
we need to show that 1+2+...+n+(n+1) = (n+1)(n+2)/2
but 1 + 2 + .... + n + (n+1) = n(n+1)/2 + (n+1)
= (2n + 2 + n^2 + n)/2
= (n+1)(n+2)/2
thus proved by induction
Prajas Naik
2) A - All boxes (2, 5, 6) have 0, but the program doesn’t have an end statement

B - COPY 1 3

COPY 2 1

COPY 3 2

END

i_(k) = 1

i_(k+1) = i_(k) + 2

i_(k+2) = i_(k+1) +
Samichi
● Sum of numbers from 1.. n is n*(n+1)/2
● N = 1 ; 1*(1+1)/2
● 1*2/2
● 1 ; hence proved
● 1+ 2 + … + n + (n+1) = n*(n+1)/2 + (n+1)
● (2n + 2 + n^2 + n)/2
● (n+1)(n+2)/2
Shatakshi barde
Pratik Patil
● Sum of numbers from 1.. n is n*(n+1)/2
Let us considering P(n) = 1 + 2 + 3 + ….. + n = n(n +1)/2

For the n = 1

LHS of P (n) = 1

RHS of P (n) = 1 (1+1)/2 = 1

Therefore, LHS = RHS Here, P (n) is true for n = 1 Let us consider P (n) be the true for n = k, therefore 1 + 2 + 3 + …. + k =
k (k+1)/2 … (i)

Then, (1 + 2 + 3 + … + k) + (k + 1) = k(k + 1)/2 + (k + 1) = (k + 1) (k/2 + 1) = [(k + 1) (k + 2)]/2 = [(k + 1) [(k + 1) + 1]]/2 P (n)
is true for n = k + 1 P (n) is true for all n ∈ N

Therefore, by the principle of Mathematical Induction Thus, P (n) = 1 + 2 + 3 + ….. + n = n (n +1)/2 is true for all n ∈ N.
Nidhi
To prove : Sum of numbers from 1.. n is n*(n+1)/2

Let n = 1, then sum of n numbers is 1 * (1 +1 )/2 ⇒ 1*2 / 2 ⇒ 1

hence n = 1 is true

let us assume it is true when n=k for some integer k

Therefore, 1 + 2 + ... + k = k*(k+1) /2 → equation 1

When n = k+ 1, sum of numbers from 1 to k+1 cane be written as

1 + 2+ ... + k + (k+1) = k*(k+1)/2


⇒ k*(k+1)/2 + (k+1) (from equation 1 )
⇒ k*(k+1)/2 + 2(k+1)/2
⇒ (k+1)* (k + 2)/2
⇒ (k+1)*(k+1+1)/2
⇒ n * (n+1)/2
Hence proved by induction
Mukund
To prove by induction we first need to prove if the statement is satisfied with 1 and then for p (n) ⇒ p (n+1)

summation n = [n (n+1)] / 2

lhs ⇒ sum up to 1 is 1

rhs ⇒ [1*2] / 2

rhs ⇒ 1

lhs = rhs hence proved

if it is true for any n then it must be true for n +1 as well

lhs ⇒ sum upto n + 1 ⇒ (Sum upto n) + (n+1)

lhs⇒ [n (n+1) ]/ 2 + n+1

lhs ⇒ [n^2 + n + 2n +2 ] /2

Rhs ⇒ [(n+1) (n+2)]/2

rhs ⇒ [n^2 + 3n + 2 ]

hence lhs=rhs

hence proved by induction

All boxes contain Zero [ 2, 5 and 6]


Ishaan Karnani
Background :-

● Basics of Java, Python and C++


● Game Development using GML
● HTML and CSS

Deevankumar
Sum of numbers from 1.. n is n*(n+1)/2

1+2+3+...n = n(n+1/2) eq1

1+2+3+....(k+1) =k(k+1)/2)+(k+1) eq2

Solving 1 and 2

1+2+3+...n = n(n+1/2)
Kinjalkini Gautam
1. Yes, the sum of numbers from 1 to 1 is n*(n+1)/2 = 1
a. Since 1(1+1)/2 = 1
b. Therefore proved for first member of set
2. Assume that the sum of numbers from 1 to n is n*(n+1)/2
3. From this it follows that the sum of numbers from 1 to (n+1), is (n+1)(n+2)/2
4. Therefore the proposition is true for the first member of the set and if it is true
for a number of the set, it is true for the next number.
5. This means that the proposition is true for all numbers.
Rishikarthik Velliangiri
- Sum of numbers from 1.. n is Pattern:
n*(n+1)/2 When n increase by one, the answer increases by n compared to the
previous answer
n=1

1*(1+1)/2 = 1
Ex: n = 2, ans: 3

n=2 n = 3, ans: 6

2*(2+1)/2 = 3 = 2 + 1 3+n

n=3 3+3=6

3*(3+1)/2 = 6 = 3 + 2 + 1 Previous answer of 3 increase by 3 when n=3 and became 6. This means
the new integer was added to the sum of all integers upto n.
n=4
Which Means: 1+2+3+4+…+n = n*(n+1)/2
4*(4+1)/2 = 10 = 4 + 3 + 2 + 1

1, 3, 6, 10, 15, 21, 28, 36, 45, 55 ….. Statement is true.


Aadit Shah

If n = 5, from 1…5 - 5*(5+1)/2 = 15

1+2…+5+k = 5*(5+1)/2 + k =
Ayesha Rao
● Sum of numbers from 1.. n is n*(n+1)/2

Let n = 1

1 = 1(1+1)/2

This principle is true for this value of n. P(n) = true.

If the same is repeated for more numbers further. For 2, 3, 4, and so on. When the
same result of LHS = RHS holds true, then we can say P(n) it is true by principle
of mathematical induction.
Kaavya Rajasekar
Let P(n): 1+2...+n = n* (n+1)/ 2

For n=1,

1*(1+1)/2 = 1

LHS=RHS

P(n) is true for n=1


Gurpreet
1 + 2 + 3… = n*(n+1)/2

LHS = 1

RHS = n*(n+1)/2

= 1*(1+1)/2

=1
Neel Patel
n*(n+1)/2

Lhs = 1

Rhs = n*(n+1)/2

= 1*(1+1)/2

=1
Aadhya Dechamma

You might also like