Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

DISCRETE MATH IS COMPUTATIONAL

Slide 3

Slide 3 text

HOW MANY SUBSETS DOES AN -ELEMENT SET HAVE? ; ; , ... Conjecture: For all , a set with elements has subsets. WHY? (Induction) The empty set has 1 subset. If a -element set has subsets for some , then a -element set has subsets with and subsets without . Hence there are subsets with elements.

Slide 4

Slide 4 text

COMPUTATIONAL THINKING DECOMPOSITION PATTERN FINDING ABSTRACTION ALGORITHM DESIGN ALGORITHM SOLUTION EXPLANATION PROOF

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

PYTHON http://python.org

Slide 7

Slide 7 text

JUPYTER http://jupyter.org

Slide 8

Slide 8 text

USING PYTHON AND JUPYTER IN DISCRETE MATHEMATICS http://bit.ly/ctdiscrete

Slide 9

Slide 9 text

Example: Linear recurrence relation solver MTH 225: Discrete Structures for Computer Science 1 Sequences and Induction Programming Problem 1: Linear homogeneous recurrence relation solver Goal of this problem In this miniproject, you will write a function in Python called rrsolver that does the following: The function rrsolver accepts four numbers, which are the coefficients and initial conditions of a linear second-order homogeneous recurrence relation written in the form and the input would look like rrsolver(c1, c2, A, B). For example, if the recurrence relation were then the input would be rrsolver(1, 6, 3, 6). In other words there are four inputs, in this order: The coefficient on , the coefficient on , the value of , and the value of . We assume that the recurrence relation has been written as above, with on the left side and everything else on the right side. We are also assuming for this problem that we are only dealing with second-order equations, not third-order or higher. As you know from class work, linear homogeneous recurrence relations can be solved using the characteristic root method. What the rrsolver does with its input depends on how many real-number characteristic roots the recurrence relation has: http://bit.ly/ctdiscrete

Slide 10

Slide 10 text

Exemplary student solution The function takes in 2 constants from a recurrence relation, its initial conditions, and prints out an exponential equation that results in the same sequence. Find the roots of and check to see if is negative. If so, print that there are no real roots. Otherwise construct the roots. The resulting linear system (after plugging in the initial conditions) would look like: Then use numpy to solve the system using a matrix. if the roots are the same, we end up with a slightly different system: In [1]: from math import sqrt import numpy def rrsolver(C1, C2, initial1, initial2): #Based on r^2 - c1r - c2 = 0 #Check if the sqrt ends up being negative. if (((-C1)*(-C1)) - (4*(-C2))) < 0: print('There are no real roots.') else: radican = sqrt(((-C1)*(-C1)) - (4*(-C2))) root1 = ((C1 + radican)/(2)) http://bit.ly/ctdiscrete

Slide 11

Slide 11 text

Diameters of complete bipartite graphs http://bit.ly/ctdiscrete

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

OTHER USES WRITING CODE TO IMPLEMENT SET OPERATIONS TESTING RELATIONS FOR PROPERTIES CLUSTERING COEFFICIENTS AND CENTRALITY MEASURES OF LARGE GRAPHS http://bit.ly/ctdiscrete

Slide 14

Slide 14 text

THANK YOU http://bit.ly/ctdiscrete [email protected] rtalbert.org