Polytechnic Institute of NYU

CS3113 (1268A) 2008, Engineering Programming and Computing

 

 

Pre-requisite (with Min. Grades): Undergraduate Math sequence

 

Who may receive credit for this course: Required course for Chemical Engineering students

 

Date of first offering of course: Fall 2008

 

Textbook:

Essential MATLAB for Engineers and Scientists , B.D. Hahn and D.T. Valentine, 3rd edition,
(Newnes/Elsevier, 2007). ISBN-13 978-0750684170.

 

Course (catalog) description:

 

CS 3113 Engineering Programming and Computing 2.5 : 0 : 0.5 : 3

This is an introductory course in computer programming and engineering computing for third and fourth year undergraduate students in the Chemical Engineering program who have no prior experience in programming in any languages. The course covers the fundamentals of computer programming and its underlying principles using the Matlab programming language. Concepts and methods introduced in the course is illustrated by examples drawn from the Engineering discipline.

 

Lectures/recitation (lab): meets twice a week for a total of 3 hours including a 0.5 hour recitation (lab).

 

Course Objectives:

1) Knowledge of fundamental programming concepts and structures in MATLAB.

2) Ability to formulate solutions to problems and write programs to be run in MATLAB.

3) Numerical methods appied to engineering problems.

 

Topics covered (Tentative):

 

Week 1 Introduction to MATLAB

  • Variables and operators
  • The MATLAB User Interface
  • Interactive use of MATLAB
  • Writing MATLAB programming scripts

Week 2 Using Build-in Functions, Vectors and Arrays

  • Using built-in MATLAB functions
  • Creating and using vectors

Week 3 Program Execution Controls

  • Conditional execution: if and switch statements
  • Loops and Iteration: for and while statements

Week 4 User-Defined Functions

  • Creating and calling user-defined functions
  • Program abstraction and encapsulation
  • Black-box view of a functiion

Week 5 Cell Arrays and Structures

  • Collecting dissimilar objects
  • Creating and using cell arrays
  • Creating and using structures and structure arrays

Week 6 Matrices

  • Matrix operations
  • MATLAB implementation

Week 7 Solving Simultaneous Linear Equations and Midterm Examination

  • Solving a set of simultaneous linear equations
  • Midterm Examination

Week 8 Numerical Quadrature

  • Newton-Cotes quadrature
  • Gaussian quadrature
  • Composite quadrature
  • Adaptive quadrature

Week 9 Numerical Differentiation

  • Finite difference approximations
  • Richardson extrapolation
  • Romberg integration

Week 10 Linear Least Squares Problems

  • Solving linear least squares problems
  • Sensitivity and conditioning

Week 11 Interpolation

  • Polynomial interpolation
  • Piecewise polynomial interpolation
  • Interpolation in two dimensions

Week 12 Nonlinear Equations

  • Solving nonlinear equations
  • Sensitivity and conditioning
  • Convengence rates and stoping criteria

Week 13 Initial Value Problems for Ordinary Differential Equations

  • Ordinary differential equations
  • Conditioning issues
  • Numerical solution of ordinary differential equations

 

ABET Competencies: This course addresses the following ABET competencies :

a) Students learn fundamental computer programming concepts and structures.

e) Students identify, formulate, and solve engineering problems.

 

 

Instructor: Prof. K. Ming Leung

 

Personal Website: http://cis.poly.edu/~mleung/

 

Email: mleung@duke.poly.edu

 

Office: LC127

 

Phone: 718-260-3380

 

Office Hours:

  • Monday: 1:00 - 3:00 pm
  • Wednesday: 10:00 12:00 pm
  • Friday: 10:00 - 11:00 am, 12:00 pm 1:00 pm

Policy on Collaboration on Assignments: http://www.poly.edu/cis/policies/collaboration/index.php

 

Lecture Notes:

 

         Preface Hahn\Lectures\lect00_preface.ppt

         Introduction Hahn\Lectures\lect01_introduction.ppt

         MATLAB Fundamentals Hahn\Lectures\lect02_matlab_fundamentals.ppt

         Creating m-files Hahn\Lectures\lect03_creating_m-files.ppt

         Program Plan, Design, and Sturcture Hahn\Lectures\lect04_structure_plan.ppt

         Input and Output Hahn\Lectures\lect05_input_and_output.ppt

         MATLAB Built-in Functions Hahn\Lectures\lect06_matlab_functions.ppt

         Debugging and Data Import and Export Hahn\Lectures\lect07_debugging_code_&_data_import_export.ppt

         Logical Operations Hahn\Lectures\lect08_logical_operations.ppt

         2D Plotting Hahn\Lectures\lect09_plotting_in_2d.ppt

         Ploting and Curve Fitting Hahn\Lectures\lect10_2d_plotting_&_curve_fitting.ppt

         Loops for Repetivie Computations Hahn\Lectures\lect11_loops_for_repetitive_computations.ppt

         More Loops Hahn\Lectures\lect12_another_loop_for_repetition.ppt

         Decision/Branching Structures Hahn\Lectures\lect13_decision_structures.ppt

         User-Defined Functions Hahn\Lectures\lect14_user-defined_functions.ppt

         Practice and Exploration Hahn\Lectures\lect15_practice_&_exploration.ppt

         Symbolic Mathematics Hahn\Lectures\lect16_symbolic_mathematics.ppt

 

 

Lecture materials:

 

A list of MATLAB topics to be discussed: MATLAB_topics.docx

 

History file for September 3: history090308.m

 

History file for September 10: history091008.m

 

History file for September 15: history091508.m

 

History file for September 17: history091708.m

 

History file for September 22: history092208.m

 

History file for September 24: history092408.m

 

History file for October 1: history100108.m

 

Monte Carlo simulation to compute the value of pi: mc.m (code), MC.txt (explanation)

 

Program to check the precedence rule for * and .*: precedenceMultiply.m

 

Generating uniformly distributed random integers: RandIntegers.m

 

Logical Indexing: logicalIndexing.m

 

Reminder that most real numbers cannot be represented exactly on a computer: reciprocal.m

 

Example of using string variables: string1.m

 

Testing the If-structure: testIf.m

 

Example of a nested loop: computing the exponential function (using a dumber way): computeExpDumber.m

 

Example of a nested loop: computing the exponential function (using a dumb way): computeExpDumb.m

 

Example of a nested loop: computing the exponential function (using a better way): computeExp.m

 

User-defined functions: functions.pdf

 

Using the bisection method to find a root of a function: bisectionF.m bisectionFtest.m

 

Solving and ODE, a catalytic reaction: CatalyticReaction.m WalterIvp_s_ming.doc

 

Example of a stiff ODE in Chemical Engineering: stiffFcn.m StiffFcnTest.m WalterIvp_s_ming.doc

 

Another example of a stiff ODE: stiffFcn2.m testStiff2.m

 

String variables and string functions: strings.m

 

Multidimensional arrays: multiDimensionArrays.m

 

Numerical differentiation (forward differencing): derivative1f.m forwardDiffF.m

 

Producing publication quality graphs: PublicationGraphics.m

Save the resulting graph as a pdf file to get: PublicationGraphics.pdf

 

DNA pattern match with allowed errors: DnaPatternMatching.m

A function read a gene sequence from a text file: readStringFromTextFile.m

4 DNA samples: sd1.dna sd2.dna sd3.dna sd4.dna

Dozer gene: dozer.dna

 

 

Grading Scheme: HW (20%) + 1st Midterm (20%) + 2nd Midterm (20%) + Final (40%)

 

 

Exam Schedule:

 

         1st Midterm: October 22

         2nd Midterm: November 19

 

 

Exam 1 solutions:

cubeRoot.m

nDiceSum.m

 

Exam 2 solution:

Main program - onePointCrossOver.m

Functions - randomDNA_.m RandIntegers_.m onePointCrossOver_.m

 

 

Our 11/24 lecture will be moved to 12/8 (reading day)

 

Topics for the Final Examination:

TopicsFinal.docx

 

 

Homework Assignments:

 

o  HW01 (due September 15) CS3113f08HW01.pdf

o  Solutions: cs3113f08HW01P01.m, cs3113f08HW01P02.m, cs3113f08HW01P03.m, cs3113f08HW01P04.m

 

o  HW02 (due October 1) CS3113f08HW02.pdf

o  Solutions: cs3113f08HW02P01.m, cs3113f08HW02P02.m, cs3113f08HW02P03.m

 

o  HW03 (due October 6) CS3113f08HW03.pdf

o  Solution: Cartesian2Polar.m

 

o  HW04 (due October 15) CS3113f08HW04.pdf

o  Solution: computeSin3.m

 

o  HW05 (due November 5) CS3113f08HW05.pdf

o  Solution: cs3113f08HW05.m GoldenSectionF.m fcnFile.m