Docsity

CS1371 Week 3 Teaching Outlines: Matrices, Conditional Behavior, Functions, Exams of Computer Science

Toggle sidebar
bg1
CS1371 Teaching Outlines
Week 3
Wed January 26th, 2005
Objectives: Matrices
Review array operations
Slicing
Add, subtract, .*, ./, .^
Especially scalar product
Matrix operations
Transpose
Multiply – not symmetrical
Limit to square matrices – still not symmetrical
Simple simultaneous equations
Definition of the inverse
Solving by back dividing
Fri January 28th, 2005
Objectives: Conditional behavior
If – then - else
Develop the basics – the Powerpoint lecture is OK if I remember to take out the loop stuff
watch strings – in the earlier matlab, strings of unequal length throw an exception.
Focus: Take the grade calculations and return a letter grade
Switch case
Develop the basics – the Powerpoint lecture is OK
Focus: Convert a letter grade to a percentage
Strings of unequal length work fine.
Mon January 31st, 2005
Objective: Functions
Write a simple function
Perhaps return the discriminant for the quadratic equations
Talk about the documentation
Returning Multiple Solutions
Both roots of a quadratic
Discussion Question:
Given a discriminant function, the roots function and a script with some test data
Where is the right place to put the test for real roots?
Answer: in the script. Not all users care to worry about it.

Partial preview of the text

Download CS1371 Week 3 Teaching Outlines: Matrices, Conditional Behavior, Functions and more Exams Computer Science in PDF only on Docsity!

CS1371 Teaching Outlines

Week 3

Wed January 26th, 2005

Objectives: Matrices

Review array operations

 Slicing  Add, subtract, .*, ./, .^  Especially scalar product

Matrix operations

 Transpose  Multiply – not symmetrical  Limit to square matrices – still not symmetrical  Simple simultaneous equations  Definition of the inverse  Solving by back dividing

Fri January 28th, 2005

Objectives: Conditional behavior

If – then - else

 Develop the basics – the Powerpoint lecture is OK if I remember to take out the loop stuff  watch strings – in the earlier matlab, strings of unequal length throw an exception.  Focus: Take the grade calculations and return a letter grade

Switch case

 Develop the basics – the Powerpoint lecture is OK  Focus: Convert a letter grade to a percentage  Strings of unequal length work fine.

Mon January 31st, 2005

Objective: Functions

Write a simple function

 Perhaps return the discriminant for the quadratic equations  Talk about the documentation

Returning Multiple Solutions

 Both roots of a quadratic

Discussion Question:

 Given a discriminant function, the roots function and a script with some test data  Where is the right place to put the test for real roots?  Answer: in the script. Not all users care to worry about it.