Try with COLAB Python ProgramingΒ πΒ pdf1Β Β pdf2 Β Β pdf3
1) αααα»α αααα ααααΆααααααΆαα ααααΆαααααα α’αα»αααα ααααΆααααααααααΎα αα·ααααααΈα
2) αα·ααΆαααααα ααααΌααΆαααΈααΈαα
3) Algorithms (αα·ααΈααΆαααααααΌα) αα·ααααααα·ααΈαα»ααααα½αααα(Scilab/Python)
4) Number theory andΒ group theory
5) CryptographyΒ
6) Applied Graph Theory
quiz1 π ααααΎ
quiz2 π ααααΎ
quiz3 π ααααΎ
quiz4 π ααααΎ
quiz5 π ααααΎ
quiz6 π ααααΎ
-ααααααΆααα·αααΆαα αΌααα½ααααααααΆααα·ααααΆαααα»αααααΆαα(Attendent) 10%
-ααΆααααα‘ααααα½ααα·αα·αααααΆαααααααΆααααΆα(Mid-term) 20%
-ααΆαααααΎαα·α αα ααΆαααααΆαααααΆα(Assignment) 20%
-ααΆααααα‘ααααα αααααΆα(Final Term) 50%
print(3 < 5 and 7 < 5)
print(3 < 5 and not(7 < 5))
print(2+2 == 5 or 2+2 == 4)
.......................................................................
def foo():
Β Β Β Β print('Foo!')
Β Β Β Β return True
if 2 + 2 == 5 and foo():
Β Β Β Β print('True')
else:
Β Β Β Β print('False')
.................................................................
a = (6, 2, 4)
print(all((i % 2 == 0) for i in a))
a = (2, 7, 6)
print(all((i % 2 == 0) for i in a))Β
.................................................
def is_divisible_by_3(x):
Β Β Β Β return x % 3 == 0
lst = [5, 17, 6, 10]
print(not any([is_divisible_by_3(x) for x in lst]))
print(all([not is_divisible_by_3(x) for x in lst]))Β
.........................................................
αααααααααΆααααΈα
def length(lst):
Β Β Β Β if not lst:
Β Β Β Β Β Β Β Β return 0
Β Β Β Β else:
Β Β Β Β Β Β Β Β return 1 + length(lst[1:])
print(length([5, 3, 2, 1, 7]))
...............................................................
α αααΆααααΌααααα
def factorial(n):
Β Β Β Β assert n > 0
Β Β Β Β result = 1
Β Β Β Β for i in range(1, n + 1):
Β Β Β Β Β Β Β Β result *= iΒ #result = result * iΒ
Β Β Β Β return result
print(factorial(10))
................................................................
#Find maximum number of a, b, c
a=9
b=5
c=30
large=a
if b>large:
Β Β large=b
if c>large:
Β Β large=c
print(large)
#Find maximun element of Matrix A/ List A
A=[1, 3, 4, 8, 2, 4, 6, 1]
large=A[0]
for i in range(6):
Β Β if A[i+1]>large:
Β Β Β large=A[i+1]
print(large)
......................................................................
Multiple Matrix
# take a 3x3 matrix
A = [[12, 7, 3],
Β Β Β Β [4, 5, 6],
Β Β Β Β [7, 8, 9]]
# take a 3x4 matrixΒ Β Β Β
B = [[5, 8, 1, 2],
Β Β Β Β [6, 7, 3, 0],
Β Β Β Β [4, 5, 9, 1]]
Β Β Β
result = [[0, 0, 0, 0],
Β Β Β Β Β Β Β Β [0, 0, 0, 0],
Β Β Β Β Β Β Β Β [0, 0, 0, 0]]
# iterating by row of A
for i in range(len(A)):
Β Β Β Β # iterating by column by B
Β Β Β Β for j in range(len(B[0])):
Β Β Β Β Β Β Β Β # iterating by rows of B
Β Β Β Β Β Β Β Β for k in range(len(B)):
Β Β Β Β Β Β Β Β Β Β Β Β result[i][j] += A[i][k] * B[k][j]
for r in result:
Β Β Β Β print(r)
αα gcd, lcm
a = int(input('a= '))
b = int(input('b= '))
c=a*b
while b > 0:
Β Β Β Β r = a % b
Β Β Β Β a, b = b, r
print('gcd(a,b)=',a)
print('lcm(a,b)=',c/a)
.....................................
αααααααΆααααΈααΆαααΈα’αΌα ααααααΆα
ααααΎ Euclidean Algorithm https://www.math.uwaterloo.ca/~snburris/htdocs/linear.html
from sympy import gcdex
def solve_equation(a, b, c):
Β Β Β Β p, q, d = gcdex(a, b)
Β Β Β Β return (p * c // d, q * c // d) if c % d == 0 \
Β Β Β Β Β Β Β Β else 'no solution'
for a, b, c in ((391, 299, -69), (10, 6, 14), (10, 6, 15)):
Β Β Β Β print(f'Solution to {a}x+{b}y={c}:',solve_equation(a, b, c))
........................................
https://colab.research.google.com/drive/1r9irwlMJkllbLBeeEMp7U2M6XQF3TusU?usp=sharing
#RSA system :
# Public Key: (e,n)=(169, 23*31)=(169,713) ---> share to people
# Private Key: (d,n)=(289,713)---> Keep in secrete
..........................................
#find e for gcd(n=713,e)=1
import math
for e in range(660):
Β if math.gcd(660,e)==1:
Β Β Β print('e=',e)
................
#find d such that ed=1(mon phi(n))
import math
for d in range(660):
Β if (169*d)%660==1:#169d=1(mod phi(n)), with e=169
Β Β Β print('d=',d)
...........................
#C=m**e=144 find m, c^d=(m^e)^d=144^d (mod n)
m=(144**289)%713
print('m=',m)
.................
#CORRECT convert string into number
substr=str(input('LETTER:'))#substr='Hello My Friends'
alpha=' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*()+-=_?<>~[]{}'
l=len(alpha)
sl=len(substr)
M=0
for i in range(sl):
Β k=alpha.rfind(substr[i])
Β M+=k*(10**(2*(sl-i-1)))
print(M)
...................
#COORECTconvert from number to string
n=int(input('Number:'))#12344600246707989098690
alpha=' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*()+-=_?<>~[]{}'
str1=str(n)
l=len(str1)
for i in range(2,l+1,2):
Β if l%2==0:
Β Β Β d=n//(10**(l-i))
Β Β Β di=(d%(100))%(len(alpha)+1)
Β else:
Β Β Β d=n//(10**(l-i+1))
Β Β Β di=(d%(100))%(len(alpha)+1)
Β print(alpha[di])
Related Course: Discrete Applied Mathematics
Textbook: Diestel, Graph Theory, 4th edition, is available at http://diestel-graph-theory.com/, including a free online version. You are expected to read the appropriate sections from this textbook corresponding to topics we discuss in lectures. Book Read Online" Graph Theory"
2. Matching, covering and packing
https://www.prip.tuwien.ac.at/staffpages/yll/docs/graph_theory_book_diestel.pdf
https://diestel-graph-theory.com/basic.html
https://www.emis.de/monographs/Diestel/en/GraphTheoryII.pdf
Examinations:
Mid-term Exam I: October 11th, Thursday. Topics: All topics corresponding to HWs#1,2,3.
Mid-term Exam II: November 15th, Thursday. Topics: All topics corresponding to HWs#4,5.
Final Exam : December 5th, Wednesday, 10:30am. Topics: All topics studied during the semester.
Homework Assignments:
Homework #1 [Double HW]: Due Thursday, 9/6 Solutions distributed on Thursday, 9/6.
Homework #2: Due Thursday, 9/20 Solutions distributed on Thursday, 9/20.
Homework #3 [Long HW]: Due Thursday, 10/4 Solutions distributed on Thursday, 10/4.
Homework #4: Due Tuesday, 10/23 Solutions distributed on Thursday, 10/25.
Homework #5 [Double HW]: Due Thursday, 11/8 Solutions distributed on Thursday, 11/8.
Homework #6 [Double HW]: Due Thursday, 11/29 Solutions to be distributed on Thursday, 11/29.
Links for Additional Information:
Mathworld : Graph Theory Dictionary
Glossary of terms in combinatorics
Dynamic Surveys in Combinatorics
Combinatorial Software and Databases
Textbooks for alternative points of view and for additional applications:
Graph Theory with Applications by Bondy and Murty
Introduction to Graph Theory, 2nd edition, D. West.
Modern Graph Theory, B. Bollobas.
Graph Theory (2008 edition), Bondy & Murty.
Algorithmic graph theory and perfect graphs, 2nd edition Martin Golumbic.
Graphs and Applications: An Introductory Approach, J.M.Aldous & R.J.Wilson.
Graph Theory Applications, L.R.Foulds.
Topics in Intersection Graph Theory, T.A.McKee & F.R.McMorris
Bipartite Graphs and their Applications, A.S.Asratian, T.MJ Denley, R.Haggkvist