Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 14.
Polynomials
Polynomials are used extensively in science
and engineering
Graphics
Signal Processing
Computer Vision and Image Processing
Cryptography
Statistics
Polynomials
f ( x)=an x n +an1 x n1 +.+a1 x +a0
n
f (
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Statistics
Intro
Matlab
Numerical computing environment
Programming language
Proprietary system
Extensible
Easy to start using
Main strength: Linear Algebra (matrices),
numerical analysis
Matlab
Can be used as calculator
Or as a cal
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 3
Working directory
Matlab, like most other software has a current
working directory, aka current folder
Most operations on files (read, write) assume
that the file is in the working directory
Can be changed easily usi
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 4
Creating Matrices
Matrices can be created like arrays.
We can specify all the elements explicitly arranged
in rows
A = [1 2 3; 4 5 6; 7 8 9]
We can specify them implicitly
A = [1:3; 4:6; 7:9]
(colons can be replaced
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 5
Matrix Operations
Most regular arithmetics operations work for
matrices and vector same way
You can add two matrices (or vectors)
You can multiply them, too
As long as they can be added
Matrix and vector multiplicati
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 6.
Input Output
All programs need some form of input output
We have seen some rudimentary kinds of both
Need to input data
From the keyboard (mainly for testing/debugging)
From files
Spreasheet files
Other programs
Mat
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 7.
Plotting
Matlab has many plotting commands
The vanila version (plot) accepts 2 arguments: the X
coordinate and the Y coordinate
Accepts a string of specifiers:
rgb for red, green, blue
cmyk for cyan, magenda, yellow
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 9.
Conditional execution
We often want our program to decide whether to
execute one command or another (or none)
The absolute value of a real number x is x if positive
and x if negative
Matlab (like any other language
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 2
Using Variables
The simplest use for Matlab is to play with
formulas
We can use it as a very advanced calculator
No input, no output, just a simple program
Mainly need variables, assignments, builtin
function calls,
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 7.
The save and load Commands
Matlab allows one to save matrices and retrieve
them
Typically used to load data collected and save
the result of a computation to publish, or use
elsewhere
Can be saved in either machine
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Electrical Engineering and Computer Science
CSE 1560
Sample Midterm
Mon. Feb 8, 2016
Answer all questions in the space provided
Make sure that you have 4 pages
Student Last Name: _
Student Given Name: _
Student Id. No: _
Question
A
B
Value
40
60
1
Score
Q
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2014
6.1
Which of the following is an example of a price celling or price cap? A regulation requires
cable service to be provided for no more than $30 a month. Price cap is a government
regulation that places an upper limit on the price at which a particular g
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 11.
Computing with Loops
Loops are used to do repetitive things
Some of them involve doing the same thing on
many different elements of an array
Often these can be done with Matlab's array
operations
Some of them invol
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 16.
Fitting Polynomials
One can find a polynomial that approximates given data
Data is in the form of pairs
xi, yi
We can have many such pairs.
If the number of pairs is the same as the number of
unknowns (the coeefici
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 15.
Multiplying Polynomials
M+N
(
M
)(
N
c k x = ai x b j x
k=0
k
i=0
i
j= 0
min(k , N)
ck =
i= max(0, k M )
a i b ki
j
)
Multiplying Polynomials
We now have to translate this to Matlab
Vectors in Matlab start at 1
Po
CS 310 Spring 2016
2016 Beck Hasti
Sample Questions for Exam 1
The following are meant to give you some examples of questions that might be asked on the first
exam. The sample exam questions do not represent the length or difficulty of the actual exam. T
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2015
Name: _
Student #: _ Section: _
York University
Faculty of Science and Engineering
Department of Computer Science and Engineering
CSE1520.03  Computer Use: Fundamentals
Fall 2005 Final Examination
Tuesday, December 20, 2005
Instructions:
1.
York Universi
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2015
Summer 2009 CSE 1520A
Test #2
SOLUTIONS
Part A: True/False  WRITE the entire word for full marks. [10 Marks]
Blue = TRUE and Black = FALSE
1. _ A cell in a spreadsheet can contain only raw data.
2. _ The sum of two binary digits (ignoring the carry) is e
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 10.
Other forms of ifelseend
Ifelseif.elseifelseend
Switchcase
Not necessary but convenient
The for loop
One of the most common loops
Especially for numerical computations
There similar thing in practically eve
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Final exam 5/11/2011
Name: _
Sample: CDS130 Final exam (PART I)
The final exam consists of two sections. The first section is a closedbook paper exam
(60 minutes); and the second section involves use of Matlab on the computer (75
minutes). The following
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 18
3D Surfaces
To plot a surface we have to
Create the 2D structure
Map the 2D structure to 3D
We can plot with
Mesh
Surf
Meshz (create a curtain around the plot)
Surfc, meshc (with contours under it)
Surfl (with l
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 13.
Remember, Remember
th
the 5 of November
Matlab also has anonymous functions
Nothing to do with the Anonymous group
These are simple functions defined on the fly
Usually for one time use or for passing as
arguments
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 12.
Computing with Loops
Loops are used to do repetitive things
Some of them involve doing the same thing on
many different elements of an array
Often these can be done with Matlab's array
operations
Some of them invol
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
MATH2022 Linear Algebra II
Lecture 2021
Topics
Linear Transformations
The Matrix of a Linear Transformation
Properties of Linear Transformations
MATH2022 W16 Lecture 2021
2
Linear Transformations
A transformation (or function or mapping) T from Rn
t
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2016
Computing for Math and Stats
Lecture 17
A Note about Least Squares
Most (simple) implementations of least squares involve the
operation AT A
This can be blamed for numerical instabilities (large effects of
roundoff error)
There are methods that avoid the
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2014
EECS3311 Software Design
Tuples and Agents
EECS, York University
20160309 11:32 AM
0
Why agents?
Iteration:
b
my_function (x) dx
a
c: CITIZEN p: CITIZEN 
p c.parents c p.children
GUI Callback:
button. click_actions.extend(agent routine)
EECS, York Univ
Introduction to Computing for Mathematics and Statistics
EECS 1560

Winter 2014
Software Development
EECS3311
Composite Pattern
some more UML
Dept. of Computer Science & Engineering, York University, Toronto
1
Tree structures
with partwhole
hierarchies
CABINET
CHASSIS
CARD
POWER_
SUPPLY
HARD_DRIVE
DVDCDROM
2
price
power_consumption