math36032 problem solving by computer introductionmath36032 problem solving by computer introduction...

32
MATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email: [email protected] Alan Turing 1.108 School of Mathematics The University of Manchester

Upload: others

Post on 09-Oct-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

MATH36032 Problem Solving by Computer

Introduction

Dr. Yanghong HuangEmail: [email protected]

Alan Turing 1.108School of Mathematics

The University of Manchester

Page 2: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Some housekeeping staff first

I All course materials are available on Blackboard (check itfrequently)

I Office Hour: Monday 10:00-11:00, or appointment or dropby the office (check my weekly grid)

I Lecture and tutorial location:

I Monday 9:00-10:00 in Alan Turing G207I Tuesday 13:00-14:00 in Alan Turing G207I Tuesday 14:00-15:00 in Alan Turing G105 (Computer Cluster)

I NO lectures on the following dates (prior to the deadlines ofthe projects):

I Tuesday, March 3st (Week 6) 13:00-14:00I Tuesday, March 24th (Week 9) 13:00-14:00I Monday, May 4th (Week 12) 9:00-10:00I Tuesday, May 5th (Week 12) 13:00-14:00

Page 3: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Some housekeeping staff first

I All course materials are available on Blackboard (check itfrequently)

I Office Hour: Monday 10:00-11:00, or appointment or dropby the office (check my weekly grid)

I Lecture and tutorial location:

I Monday 9:00-10:00 in Alan Turing G207I Tuesday 13:00-14:00 in Alan Turing G207I Tuesday 14:00-15:00 in Alan Turing G105 (Computer Cluster)

I NO lectures on the following dates (prior to the deadlines ofthe projects):

I Tuesday, March 3st (Week 6) 13:00-14:00I Tuesday, March 24th (Week 9) 13:00-14:00I Monday, May 4th (Week 12) 9:00-10:00I Tuesday, May 5th (Week 12) 13:00-14:00

Page 4: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Some housekeeping staff first

I All course materials are available on Blackboard (check itfrequently)

I Office Hour: Monday 10:00-11:00, or appointment or dropby the office (check my weekly grid)

I Lecture and tutorial location:I Monday 9:00-10:00 in Alan Turing G207I Tuesday 13:00-14:00 in Alan Turing G207I Tuesday 14:00-15:00 in Alan Turing G105 (Computer Cluster)

I NO lectures on the following dates (prior to the deadlines ofthe projects):

I Tuesday, March 3st (Week 6) 13:00-14:00I Tuesday, March 24th (Week 9) 13:00-14:00I Monday, May 4th (Week 12) 9:00-10:00I Tuesday, May 5th (Week 12) 13:00-14:00

Page 5: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Some housekeeping staff first

I All course materials are available on Blackboard (check itfrequently)

I Office Hour: Monday 10:00-11:00, or appointment or dropby the office (check my weekly grid)

I Lecture and tutorial location:I Monday 9:00-10:00 in Alan Turing G207I Tuesday 13:00-14:00 in Alan Turing G207I Tuesday 14:00-15:00 in Alan Turing G105 (Computer Cluster)

I NO lectures on the following dates (prior to the deadlines ofthe projects):I Tuesday, March 3st (Week 6) 13:00-14:00I Tuesday, March 24th (Week 9) 13:00-14:00I Monday, May 4th (Week 12) 9:00-10:00I Tuesday, May 5th (Week 12) 13:00-14:00

Page 6: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

The programming language: MATLAB

Advantages:

I quick and easy coding

I flexible data structure

I interactive interface

I high-quality graphics and visualization

I many built-in functions

I...

Page 7: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

The programming language: MATLAB

Advantages:

I quick and easy coding

I flexible data structure

I interactive interface

I high-quality graphics and visualization

I many built-in functions

I...

Page 8: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Free alternative: GNU Octavehttps://www.gnu.org/software/octave/

GNU Octave is free and light-weighted. The same code shouldwork on both MATLAB and Octave, except some advancedfeatures or toolboxes (check with me if you have doubts).

Page 9: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Recommended textbookI Desmond J. Higham and Nicholas J. Higham. MATLAB Guide. Society for

Industrial and Applied Mathematics, Philadelphia, PA, USA, 2005. ISBN0-89871-578-4.

I Nicholas J. Higham. Handbook of Writing for the Mathematical Sciences.Second edition, Society for Industrial and Applied Mathematics, Philadelphia,PA, USA, 1998. ISBN 0-89871-420-6.

Both hard copy and electronic copy are available in the library, as well as many

other excellent ones (search “MATLAB” in library catalogue).

Page 10: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Assessment

I Three Projects weighted equally:I Project 1 (three short questions), due Tue March 3th, 5pmI Project 2 (differential equations), due Friday March 27 , 5pmI Project 3 (data related), due Friday May 8, 5pm

I More information

I Electronic copy submitted via Turnitin on BlackboardI Problems are usually open-endedI Only the last submission before the deadline will be markedI All reports will be checked for potential plagiarism (though you

can use any information available).I Check the FAQs, rubric, and sample past reports on

Blackboard.I Besides getting a reasonable answer with a working code,

writing (including punctuations, grammar) is important too.I All projects are marked anonymously. Any extension has to be

applied from the Office, with any penalty marks deducted inthe Exam period in June.

Page 11: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Assessment

I Three Projects weighted equally:I Project 1 (three short questions), due Tue March 3th, 5pmI Project 2 (differential equations), due Friday March 27 , 5pmI Project 3 (data related), due Friday May 8, 5pm

I More informationI Electronic copy submitted via Turnitin on BlackboardI Problems are usually open-endedI Only the last submission before the deadline will be markedI All reports will be checked for potential plagiarism (though you

can use any information available).I Check the FAQs, rubric, and sample past reports on

Blackboard.I Besides getting a reasonable answer with a working code,

writing (including punctuations, grammar) is important too.I All projects are marked anonymously. Any extension has to be

applied from the Office, with any penalty marks deducted inthe Exam period in June.

Page 12: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Intended learning outcomes

On successful completion of this course unit you will be able to

I apply and extend built-in functions in MATLAB to solvemathematical problems in numerically or symbolically

I formulate practical problems given in the project descriptioninto mathematical ones and analyse them using basic toolsfrom calculus, linear algebra, probability and differentialequations

I construct algorithms to solve the mathematical problemsefficiently and effectively

I present the results returned from MATLAB graphically (ifapplicable) and interpret the results

I apply typesetting packages (ideally Latex) to express his/heridea and report the results in precise and concise language

Page 13: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Content of this course

I Basic MATLAB Programming: arithmetic, vectors andmatrices, logical operators and flow control, functions,graphics, symbolic computation, advanced data structures(character, cell array, table), ...

I Special topics and case studies: data classification anddimensional reduction, green screen special effects,synchronization of the Millennium bridge, Google PageRankalgorithm, ...

I Writing skills: mathematical writing, and high-qualitygraphics

The order of the course materials will be slightly different (so that youwill learn the skills for the relevant projects). The lectures will bedelivered with a combination of slides and in-class demonstrations.

Page 14: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Content of this course

I Basic MATLAB Programming: arithmetic, vectors andmatrices, logical operators and flow control, functions,graphics, symbolic computation, advanced data structures(character, cell array, table), ...

I Special topics and case studies: data classification anddimensional reduction, green screen special effects,synchronization of the Millennium bridge, Google PageRankalgorithm, ...

I Writing skills: mathematical writing, and high-qualitygraphics

The order of the course materials will be slightly different (so that youwill learn the skills for the relevant projects). The lectures will bedelivered with a combination of slides and in-class demonstrations.

Page 15: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Content of this course

I Basic MATLAB Programming: arithmetic, vectors andmatrices, logical operators and flow control, functions,graphics, symbolic computation, advanced data structures(character, cell array, table), ...

I Special topics and case studies: data classification anddimensional reduction, green screen special effects,synchronization of the Millennium bridge, Google PageRankalgorithm, ...

I Writing skills: mathematical writing, and high-qualitygraphics

The order of the course materials will be slightly different (so that youwill learn the skills for the relevant projects). The lectures will bedelivered with a combination of slides and in-class demonstrations.

Page 16: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Content of this course

I Basic MATLAB Programming: arithmetic, vectors andmatrices, logical operators and flow control, functions,graphics, symbolic computation, advanced data structures(character, cell array, table), ...

I Special topics and case studies: data classification anddimensional reduction, green screen special effects,synchronization of the Millennium bridge, Google PageRankalgorithm, ...

I Writing skills: mathematical writing, and high-qualitygraphics

The order of the course materials will be slightly different (so that youwill learn the skills for the relevant projects). The lectures will bedelivered with a combination of slides and in-class demonstrations.

Page 17: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Tentative Schedule

Weeks Content

1 introduction, basic MATLAB commands2 vectors and matrices, functions, flow control3 applications to numbers4 symbolic Math, graphics5 math writing, publishable quality graphics

6 green screen effects (case study), ODEs7 ODEs, synchronization (case study)8 introduction to data science, basic data structures

‘ 9 Classification and Regression10 Dimension reduction , Page rank algorithm

(Easter break for three weeks)11 Playing Dice on Computer12 (no lectures)

Note: many topics (not just those related to the projects) are covered to

show how problems can be approached and solved!

Page 18: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Simple sample problems solved with MATLABI Arithmetic (floating point) computation: numerical

solutions of algebraic equations like x5 + x2 + 1 = 0 ordifferential equations like d2

dt2x(t) + x(t)3 = 0

I Symbolic computation: Verify solutions to ut = 32uux + 1

4uxxx :

u(x , t) =∂2

∂x2log[1 + exp(kx + k3t) + exp(−kx − k3t)

]I Graphics: the Gamma function Γ(z) =

∫∞0 z t−1e−tdt on the

complex plane

Page 19: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

More complicated and open-ended ones for projects

I For any integer k , find three integers (no need to be positive)x , y and z such that k = x3 + y3 + z3. Among all integers kbelow 100, can you guess which one is the most ”difficult”?

I What is the best answer you can get for the following infinitysum?

S = 1− 1√3

+1√5− 1√

7+ · · ·

I Find positive integer solutions toa

b + c+

b

c + a+

c

a + b= 4

I Data science problem: determine the signal timing (how longthe traffic lights stay green in each direction), given a set ofmonitored traffic data

Page 20: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

More complicated and open-ended ones for projects

I For any integer k , find three integers (no need to be positive)x , y and z such that k = x3 + y3 + z3. Among all integers kbelow 100, can you guess which one is the most ”difficult”?

I What is the best answer you can get for the following infinitysum?

S = 1− 1√3

+1√5− 1√

7+ · · ·

I Find positive integer solutions toa

b + c+

b

c + a+

c

a + b= 4

I Data science problem: determine the signal timing (how longthe traffic lights stay green in each direction), given a set ofmonitored traffic data

Page 21: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

More complicated and open-ended ones for projects

I For any integer k , find three integers (no need to be positive)x , y and z such that k = x3 + y3 + z3. Among all integers kbelow 100, can you guess which one is the most ”difficult”?

I What is the best answer you can get for the following infinitysum?

S = 1− 1√3

+1√5− 1√

7+ · · ·

I Find positive integer solutions toa

b + c+

b

c + a+

c

a + b= 4

I Data science problem: determine the signal timing (how longthe traffic lights stay green in each direction), given a set ofmonitored traffic data

Page 22: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

More complicated and open-ended ones for projects

I For any integer k , find three integers (no need to be positive)x , y and z such that k = x3 + y3 + z3. Among all integers kbelow 100, can you guess which one is the most ”difficult”?

I What is the best answer you can get for the following infinitysum?

S = 1− 1√3

+1√5− 1√

7+ · · ·

I Find positive integer solutions toa

b + c+

b

c + a+

c

a + b= 4

I Data science problem: determine the signal timing (how longthe traffic lights stay green in each direction), given a set ofmonitored traffic data

Page 23: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

The mathematical landscape changed by computer

At a meeting of the American Mathematical Society in October 1903, Cole gave a

silent lecture to verify that

267 − 1 = 193, 707, 721× 761, 838, 257, 287

· · · his audience greeted the presentation with a standing ovation. Cole later admitted

that finding the factors had taken “three years of Sundays.” (from Wiki)

You can verify this in a few seconds on matlab!

Page 24: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

The mathematical landscape changed by computer

At a meeting of the American Mathematical Society in October 1903, Cole gave a

silent lecture to verify that

267 − 1 = 193, 707, 721× 761, 838, 257, 287

· · · his audience greeted the presentation with a standing ovation. Cole later admitted

that finding the factors had taken “three years of Sundays.” (from Wiki)

You can verify this in a few seconds on matlab!

Page 25: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

The mathematical landscape changed by computer

At a meeting of the American Mathematical Society in October 1903, Cole gave a

silent lecture to verify that

267 − 1 = 193, 707, 721× 761, 838, 257, 287

· · · his audience greeted the presentation with a standing ovation. Cole later admitted

that finding the factors had taken “three years of Sundays.” (from Wiki)

You can verify this in a few seconds on matlab!

Page 26: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Computer v.s. Human Brain

The computer is incredibly fast, accurate,and stupid. Man is incredibly slow,inaccurate, and brilliant. The marriage ofthe two is a force beyond calculation.

— Leo Cherne

Page 27: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Computer chip could be flawed

Pentium FDIV (CPU) bug in 1994:

Correct4195835

3145727= 1.333820449136241

Flawed chip4195835

3145727= 1.333739068902037

Another massive recall in Year 2011:

Page 28: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Whose fault is it?

Page 29: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

More examples

I On February 25, 1991 an Iraqi Scud missile hit an AmericanArmy barracks and killed 28 soldiers. The Patriot MissileSystem that was supposed to intercept and destroy the Scudfailed. The General Accounting Office report,GAO/IMTEC-92-26, Patriot Missile Defense: SoftwareProblem Led to System Failure at Dhahran, Saudi Arabiagave the reason as round-off error.

I On June 4, 1996 the French Ariane rocket self destructedshortly after takeoff. The inquiry board found the cause of thefailure to be overflow error.

Page 30: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Skills you are expected to develop ...

I Basic programming skills (more on finding the right functionsor commands than remembering the syntax)

I Problem solving skills (translating mathematical ideas intocomputer language)

I Technical writing skills

I Get most out of the course: use the skills in yourundergraduate project (if applicable), or feature jobs?

And topics will not not covered:

I Black-box type toolboxes (Statistics and Machine Learning, CurveFitting, Control System, Signal/Image Processing, ... )

I Features common in other lower level languages like C/C++ (Class,Object-Oriented Programming)

Page 31: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Skills you are expected to develop ...

I Basic programming skills (more on finding the right functionsor commands than remembering the syntax)

I Problem solving skills (translating mathematical ideas intocomputer language)

I Technical writing skills

I Get most out of the course: use the skills in yourundergraduate project (if applicable), or feature jobs?

And topics will not not covered:

I Black-box type toolboxes (Statistics and Machine Learning, CurveFitting, Control System, Signal/Image Processing, ... )

I Features common in other lower level languages like C/C++ (Class,Object-Oriented Programming)

Page 32: MATH36032 Problem Solving by Computer IntroductionMATH36032 Problem Solving by Computer Introduction Dr. Yanghong Huang Email:yanghong.huang@manchester.ac.uk Alan Turing 1.108 School

Data Scientist, the Sexiest Job of the 21st Century?

Demand for data scientists increased about 20% since last year(compared to about 5% for MATLAB).