Integrating Mathematical Thinking into the Curriculum: Examples Dr. Christelle Scharff cscharff@pace.edu Assistant Professor Computer Science Department New York Presentation FRN NYU, June 2004 1 Outline • Introduction • Three examples – The Thinking through Computing Learning Community – Functional Programming in a Discrete Mathematics Course – WeBWorK for Discrete Mathematics • Workshop: Practice with WeBWorK 2 Integrating Mathematical Thinking into CS Curricula • Group created by D. Baldwin and P. Henderson in 1999 • Mathematical Thinking: “Applying mathematical techniques, concepts and processes, either explicitly or implicitly, in the solution of problems -- in other words, mathematical modes of thought that help us to solve problems in any domain. In its most general interpretation, every problem-solving activity requires mathematical thinking. For example, basic logic, be it used explicitly or implicitly is required for all problemsolving activities.” • http://cs.geneseo.edu/~baldwin/math-thinking 3 Highlighting the Connections between Maths and CS • Creation of a repository for instructors (and students) showing the connections between Maths and CS • Examples of connections: Pre- and post-conditions, invariants, recursion, symbolic computations, relational algebra, formal specification and verification… • http://blue.butler.edu/~phenders/iticse2002 4 Hackers Know Logic! • “SQL Injection is a technique which enables an attacker to execute unauthorized SQL commands by taking advantage of unsanitized input opportunities in Web applications building dynamic SQL queries” • SELECT * FROM users WHERE username = ‘bob' and PASSWORD =‘bobpassword' • SELECT * FROM users WHERE username = ‘bob' and PASSWORD = ‘x’ or 1 = 1 • Try it at: http://www.csis.pace.edu/~scharff/sqlinjection 5 Pace University and Mathematical Thinking • CAFME (Center for the Advancement of Formal Methods in Education) • Use of Z in diverse undergraduate and graduate courses • Master in Software Design and Development – Software Validation and Verification – Mathematical Modeling of Software Artifacts 6 The Thinking Through Computing Learning Community Pace University Fall 2002 7 Learning Communities • LCs: “Classes that are linked or clustered during an academic term, often around an interdisciplinary theme, and enroll a common cohort of students” • LCs as a way of solving problems linked with academic achievements and retention, and as models to import and export knowledge from one course to another • Interests of LCs for students: – Deeper understanding of materials by making connections – Learn to find similarities in disparate subject areas – Experience increased interaction with students and faculty – Participate in active and collaborative learning – Explore diverse perspectives • Interests of LCs for faculty • http://learningcommons.evergreen.edu 8 Courses and Connections • CIS 101: Introductory computing course for freshmen non-CS majors – Problem solving, algorithms, programming in Visual Basic, computer organization, data representation, networking, Excel, HTML, ethical issues in computing • PHI 253: Propositional Logic – Translate sentences from/to English to/from propositions, truth tables, formal proofs • Connections – Rigor in formal proofs and in programming – Transformation of English sentences to propositions, and then to Visual Basic statements – Truth tables in Excel – Advanced search in Google 9 Assignments • Programming in Visual Basic: The “Learn how to do truth tables” application that determines whether the user could construct truth tables for the OR, AND, IMPLIES and BICONDITIONAL connectives • Writing an essay on social and ethical issues in computing • Designing an E-portfolio using HTML • Autobiographical presentation , LC description, reflective logs, links to students’ work… 10 Functional Programming and Discrete Mathematics SUNY Stony Brook Fall 2000 and Spring 2001 11 SUNY Stony Brook Curriculum • ACM Computing Curriculum 2001 http://www.acm.org/sigcse/cc2001 • Sequence of courses: Discrete Structure 1 Programming 1 Prerequisite Discrete Structure 2 Programming 2 • Curriculum originally designed by Dr. Peter Henderson • Use of SML in Discrete Structure 1 12 Discrete Structure 1 • • • • • • • • • • Propositional logic Number theory Set theory Functions Recursion SML (Standard Meta Language) – http://www.smlnj.org/ and SML .NET Induction Automata (Trees Graphs) 13 Functional Programming Languages 14 Use of SML • Students do not have programming experience • It is not a programming class. SML is introduced as a tool. • Why SML? – Non verbose syntax – Quick start • Subset of SML – Types and inference of types – Function definitions – Pattern matching – Higher order functions 15 – Polymorphism Factorial fun fact(n) = Without Pattern Matching With Pattern Matching if n = 0 then 1 else n * fact(n-1); fun fact(0) = 1 | fact(n) = n * fact(n-1); 16 The reverse of a list Without Pattern Matching With Pattern Matching 17 Interests • Encourage mathematical thinking early in the curriculum • Convince students that the mathematics in discrete structures are relevant to their careers • Introduction to problem solving • Introduction to prototyping • Introduction to testing • Introduction to formal specification • Understanding of recursion 18 WeBWorK: An environment to Deliver Web-based Homeworks and More SUNY Stony Brook Spring 2001 Pace University Fall 2001 and after 19 What is WeBWorK? • More than an environment to deliver homeworks to students • Developed at the University of Rochester • Freely available to educational institutions • Mainly used in mathematics (algebra, calculus) and physics • Used by more than 50 institutions around the country including Columbia, Harvard, Stony Brook, Pace… • WeBWorK is extensible 20 • http://webwork.math.rochester.edu WeBWorK for Students • Easy of access (Internet) • Immediate feedback as to whether the answer is correct or not • Individualized version of the problems for each student • Each homework can be printed • Every problem has a Feedback button which sends an e-mail message directly to the instructor 21 The WeBWorK Professor • Management of the course – List of students, passwords – Add and remove students • Monitor the progress of the students • Create and manage an exam • Create and deliver homeworks – Starting date, due date – Automated grading – Automated delivery of the solution 22 Problem Sets • Create problem sets with solutions – Written in PG (Problem Generating) • Perl, html, latex – Individualized version of the problems for each student – Questions: matching, multiple-choice… – “Ask the question you should rather than the questions you can” 23 Use of WeBWorK • More than 1000 students used WeBWorK at SUNY Stony Brook in a Discrete Mathematics course – Problems on number theory, set theory, function, recursion and SML – WeBWorK is interfaced with Oliver to deliver propositional logic problems • http://www.csis.pace.edu/~scharff/SOFTWARE/OLIVER/o liver.html • 70 students used WeBWorK at Pace University for Functional Programming and Logic Programming problems, and in the Thinking Through Computing LC 24 An example of problem and the PG code 25 Question 1 – Source code # A question requiring a string answer. $string = 'world'; BEGIN_TEXT Complete the sentence: $BR \{ ans_rule(20) \} $string; $PAR END_TEXT ANS( str_cmp( "Hello") ); 26 Question 2 – Source code # A question requiring a numerical answer. #define the variables $a=random(1,9,1); $b=random(2,9,1); BEGIN_TEXT Enter the sum of these two numbers: $BR \($a + $b = \) \{ans_rule(10) \} $PAR END_TEXT $sum = $a + $b; ANS( num_cmp( $sum ) ); 27 Question 3 – Source code # A question requiring an expression as an answer BEGIN_TEXT Enter the derivative of \[ f(x) = x^{$b} \] $BR \(f '(x) = \) \{ ans_rule(30) \} $PAR END_TEXT $new_exponent = $b-1; $ans2 = "$b*x^($new_exponent)"; ANS( fun_cmp( $ans2 ) ); 28 Workshop: Practicing with WeBWorK 29 • URL: http://webwork.csis.pace.edu/webwork/cs361/ • Login: Username: practice1 to practice26 Practice1 to 4: The due date is passed. Practice 5 to 26: The due date is: 6/21/04. • Password: Choose your own password 30 • Please, discard the error messages that may appear in the bottom of the pages! • Examples of problem sets: – – – – – Set 1 – Exercises on Recursion Set 2 – Exercises on SML Set 3 – Exercises on Logic Programming Set 22 – Exercises on Number Theory Set 44 – Exercises on Functions and Recursion 31 • Interesting Problems: – Set 1 - Problem 1 – RecursionEval1.pg – Set 2 - Problem 2 – smltypes2.pg – Set 3 - Problem 1 – logic.pg – Set 22 - Problem 3 – decimalToRational.pg – Set 44 - Problem 4 - composition1.pg 32 33 References • • • • • http://learningcommons.evergreen.edu http://www.cs.geneseo.edu/~baldwin/math-thinking http://webwork.math.rochester.edu/ http://www.acm.org/sigcse/cc2001 A. Wildenberg and C. Scharff. Oliver: an OnLine Inference and VERification system. FIE 2002. • C. Scharff and A. Wildenberg. Teaching Discrete Structures with SML. FDPE 2002. • C. Scharff and A. Wildenberg. Supporting Discrete Structures Courses with a web-based tool. SIGCSE 2003. • C. Scharff and H. Brown. Thinking Through Computing: The Power of Learning Communities. 2004. 34