ENCM 339 Fall 2017 Lecture Section 01 Lab 9 for the Week of November 20

Size: px
Start display at page:

Download "ENCM 339 Fall 2017 Lecture Section 01 Lab 9 for the Week of November 20"

Transcription

1 page 1 of 9 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 for the Week of November 20 Steve Norman Department of Electrical & Computer Engineering University of Calgary November 2017 Lab instructions and other documents for Section 01 of ENCM 339 can be found at Administrative details You may work individually or in pairs If you choose to work with a partner, it must be a student in the same lab section as you. Teams of two should hand in a single assignment, with both names printed clearly on the cover page. Important: Partners must make sure they both understand everything they hand in. You won t be allowed to work with a partner on Quiz 4 or the final exam! Lab 9 has the same Due Date pattern as Labs 1, 2, 4, 5 and 8 The Due Date for this assignment is 3:30pm Friday, November 24. The Late Due Date is 3:30pm Monday, November 27. The penalty for handing in an assignment after the Due Date but before the Late Due Date is 3 marks. In other words, X/Y becomes (X 3)/Y if the assignment is late. There will be no credit for assignments turned in after the Late Due Date; they will be returned unmarked. Marking scheme A B C D E total 6 marks 4 marks 2 marks 6 marks 10 marks 28 marks How to package and hand in your assignments Please see the information in the Lab 1 instructions, but also note that teams of two must put both names on the cover page.

2 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 page 2 of 9 Exercise A: Repeating Lab 5 Exercise D in Python Read This First: The format method of the str type Important note! Getting the appearance of numbers in program output exactly the way you want is satisfying and can often be an important factor in the usability of software you produce. However, with most languages and libraries, the rules for displaying numbers are complicated and huge in number. It doesn t make sense to commit such rules to memory unless it s part of your job to use knowledge of those rules many times every day. Quiz 4 and the Final Exam for Section 01 of ENCM 339 will NOT test you on the details of number formatting in C or Python! Some details You may have wondered whether it s possible to have Python insert values of variables into output in a way that s similar to use of printf or fprintf in C. In fact, there (at least) two different ways to do that, both of which create strings rather than directly doing output... Set up a string that looks very much like a control string for the C printf function, and then apply that to a tuple of numbers and/or strings using the % operator. Use the format method of the str type. In this course, we ll look only at the second approach, use of the format method. Here is a very simple example use of format that explains the basics: f = This course is {} {}: {}. s = f.format( ENCM, 339, Programming Fundamentals ) print(s) Each use of {} matches an argument in the method call. The program output is This course is ENCM 339: Programming Fundamentals. You can put numbers between { and } if you need to access arguments out of order, or access arguments more than once, as this silly example demonstrates: f = {0}, {1}.\nI repeat, {0}! print(f.format( Indentation must be perfect, students )) print() print(f.format( Know how a DFF behaves, digital designers )) The output is Indentation must be perfect, students. I repeat, Indentation must be perfect! Know how a DFF behaves, digital designers. I repeat, Know how a DFF behaves! You can also put information between { and } to control things like

3 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 page 3 of 9 minimum number of characters to use for a value; left-justification, right-justification, or centering; number of decimal places to use when displaying a float value; whether or not to use scientific notation when displaying a float value. Here s a little example: # right-justify, minimum width 20 f1 = The int value is {:>20}. # force scientfic notation, 4 digits after decimal point f2 = The float value is {:.4e}. # avoid scientfic notation, 25 digits after decimal point f3 = The float value is {:.25f}. my_int = 42 print(f1.format(my_int)) electron_charge = e-19 print(f2.format(electron_charge)) print(f3.format(electron_charge)) The output is The int value is 42. The float value is e-19. The float value is For more information see Format Specification Mini-Language in the online Python Standard Library Reference. Read This Second For convenience, here is some text copied and pasted from the Lab 5 instructions: The fake course we ll consider has ten assignments, numbered 0 through 9. Maximum marks for the assignments are as follows: assignment maximum marks The sum of the maximum marks is 105. Normally, a student s overall assignment mark would therefore be the sum of their own assignment marks divided by 105, then multiplied by 100 to get a percentage. However, a student may have been excused from one or more assignments. In that case, it s not appropriate to divide by 105. For example, if a student were excused from Assignment 8, the overall assignment mark would be calculated as (sum of student s marks)/(105 13) 100%. A fake mark of 1.0 in the class record indicates that a student has been excused from an assignment. [... ] Here s an example of the expected format for a line of output, for a student who was excused from Assignments 5 and 6:

4 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 page 4 of 9 Jones, JJ / 82.0, 87.20% Download the file grades9a.py, read it, and run it. Then edit it as instructed in a comment near the end of the file. Hint: The split method of the str type will be helpful. Hand in printouts of your completed program and its output. Exercise B: A variation on Exercise A Repeat Exercise A, starting with the file grades9b.py. Hand in printouts of your completed program and its output. Exercise C: Functions as function arguments Read This First In Python it s easy to use the name of a function as an argument in a call to another function. Here s a very short demonstration: def triple(a): return 3 * a def quadruple(b): return 4 * b def foo(f, x): print( f of, x, is, f(x)) foo(triple, 5) foo(quadruple, 6) The program s output is f of 5 is 15 f of 6 is 24 In the first call to foo, the parameter f refers to triple, but in the second call to foo, f refers to quadruple. This exercise and Exercise D will present some practical uses for using function as function arguments. (By the way, it s possible to do similar things in C, but that requires learning the awkward syntax related to C pointer-to-function types)

5 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 page 5 of 9 Read This Second: The math module Some parts of the Python Standard Library, such as the print and len functions, are builtin they are always available, and you don t have to tell the interpreter where to find them. But most of the Python Standard Library is organized as a collection of modules. An important and useful library module for engineers is the math module, which provides mathematical functions such as sin, cos, tan, log (base e logarithm, usually written as ln in math textbooks) and log10 (base 10 logarithm); the best float approximations to some mathematical constants such as π and e, as variables. To use a module in a Python program, you must tell the interpreter to find it using an import statement. Here s how to import the math module: import math Once your program has imported a module, your program can access functions and variables from the module using the name of the module and a dot: import math print( cosine of pi/6 is, math.cos(math.pi / 6)) The output of the above program is cosine of pi/6 is Download the file tables9c.py, read it, and run it. Then add code to the program so that in addition to printing a table of the sine function, it prints tables of the cosine and tangent functions. You should not have to modify the make_table function in any way just add two new very simple function definitions and a few other simple lines of code. Hand in printouts of your completed program and its output. Exercise D: Approximate maximum of a math function Read This First Consider the problem of finding the maximum value of a mathematical function f(x), for all values of x in the interval described by a x b. If f is differentiable, it s often possible to find local minima and maxima of x by solving for x in f (x) = 0, where f is the derivative of f. However, sometimes the calculus for finding f and/or the algebra for solving f (x) = 0 can be messy! If only an approximate maximum is needed, it s often effective to look for the maximum among samples of f(x) taken at a finite number of values of x. This is illustrated in Figure 1 on page 6. Of course to get a better approximation to the maximum of f(x), you could take a number of samples that is much larger than 5!

6 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 page 6 of 9 Figure 1: Finding the approximate maximum of a function by sampling. In this example, samples of f(x) are taken at x = a, x = b, and 3 evenly-spaced values of x in between: x = a (b a), x = a (b a), and x = a (b a). The approximate maximum would in this case occur at x = a (b a), because f(a (b a)) is the largest sample. f(x) a b x Figure 2: Functions, intervals, and numbers of samples for Exercise D. n specifies the number of samples for values of x with a < x < b. Samples of f(x) with x = a and x = b should also be considered. So, for example, for the first row of the table, 101 samples should be taken. function a b n f(x) = x x , f(x) = 1 e 0.5x cos 2x , ,191 f(x) = 0.25x + sin 2x , ,999

7 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 page 7 of 9 Figure 3: Exercise E involves a simple electronic circuit with a voltage source, a resistor and a diode. V S + R V D + I Download the file approxmax9d.py, read it, and run it. Then edit the definition of approx_max so that it does what it is supposed to do; add code corresponding to the cases in the last six rows of the table in Figure 2 on page 6. (There is already code in place for the case given in the first row of the table.) For each case in the table, make sure that your program output is clear about which version of f is being considered, what the values of a and b are, and how many samples are to be taken. Hand in printouts of your completed program and its output. Exercise E: Fixed-point iteration Read This First In mathematics, a value of x that satifies the equation f(x) = x is called a fixed point of the function f. Fixed-point iteration is an algorithm that sometimes works well for finding fixedpoints. It s very simple: Start with x 0, an initial guess at the fixed point, and then do the following sequence of updates: x 1 = f(x 0 ), x 2 = f(x 1 ), x 3 = f(x 2 ),... If the iteration works, the sequence x 0, x 1, x 2,... will converge to a solution of f(x) = x. (Whether or not the sequence converges depends on how close x 0 is to the fixed-point and some mathematical properties of the function f.) Read This Second Figure 3 is a diagram for a circuit involving two things you should recognize from ENGG 225 and a device called a diode. A diode has this important and useful behaviour: If the voltage V D is positive, the current I will be positive and significant in magnitude. If V D is negative, I will be negative but extremely close to zero.

8 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 page 8 of 9 For some calculations, the Shockley diode equation is a reasonable model for a diode: ( ) I = I S e V D nv T 1 (1) I S, the reverse-bias saturation current and n, the ideality factor, are properties that vary from one diode to another. V T, the thermal voltage, is independent of diode design and construction but is temperature-dependent. At room temperature, V T mv. Suppose that for the circuit of Figure 3, V S, R, I S and n are all known, and we want to solve for I and V D. Ohm s law and Kirchoff s voltage law together say that I = V S V D R Together equations (1) and (2) give us two equations in two unknowns. solve (1) for V D. First let s rearrange it: (2) Let s e V D nv T = I + I S I S Next, take logarithms on both sides: ( ) V D I + IS = ln nv T Rearrange again: I S ( ) I + IS V D = nv T ln If we plug that expression for V D into (2), we get: ( ) I+I V S nv T ln S I S I = R That looks scary algebraically is it even possible to solve for I? But notice that the equation is of the form I = f(i) maybe fixed-point iteration with a computer can give us a numerical solution! It turns out that it s essentially impossible to get a voltage of more than about V D = +0.7 V across a typical silicon diode, so if V D is significantly larger than 0.7 V, a good initial guess at I for fixed-point iteration is simply I V S /R. Write a Python program that uses fixed-point iteration to solve for I and V D in the circuit of Figure 3, operating at room temperature. With the initial guess suggestion given above, ten iterations of I n+1 = f(i n ) are more than enough to get numbers that are accurate to many significant digits. Your program should solve for I and V D for all the variations of the problem given in this table: V S R I S n 10.0 V 1.0 kω 20 na V 2.2 kω 20 na V 2.2 kω 20 na V 10.0 kω 35 na V 10.0 kω 35 na 1.95 You are free to organize your program however you like, but please try hard I S (3)

9 ENCM 339 Fall 2017 Lecture Section 01 Lab 9 page 9 of 9 to make the code as easy-to-read as possible for the TA s who will be marking it; to make the output of your program easy-to-read for an electrical engineer who has no idea how to read Python code. Hand in printouts of your program and its output.

ENCM 339 Fall 2017 Lecture Section 01 Lab 5 for the Week of October 16

ENCM 339 Fall 2017 Lecture Section 01 Lab 5 for the Week of October 16 page 1 of 5 ENCM 339 Fall 2017 Lecture Section 01 Lab 5 for the Week of October 16 Steve Norman Department of Electrical & Computer Engineering University of Calgary October 2017 Lab instructions and other

More information

ENCM 369 Winter 2019 Lab 6 for the Week of February 25

ENCM 369 Winter 2019 Lab 6 for the Week of February 25 page of ENCM 369 Winter 29 Lab 6 for the Week of February 25 Steve Norman Department of Electrical & Computer Engineering University of Calgary February 29 Lab instructions and other documents for ENCM

More information

ENCM 335 Fall 2018 Lab 6 for the Week of October 22 Complete Instructions

ENCM 335 Fall 2018 Lab 6 for the Week of October 22 Complete Instructions page 1 of 5 ENCM 335 Fall 2018 Lab 6 for the Week of October 22 Complete Instructions Steve Norman Department of Electrical & Computer Engineering University of Calgary October 2018 Lab instructions and

More information

ENCM 335 Fall 2018 Lab 2 for the Week of September 24

ENCM 335 Fall 2018 Lab 2 for the Week of September 24 page 1 of 8 ENCM 335 Fall 2018 Lab 2 for the Week of September 24 Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2018 Lab instructions and other documents

More information

ENCM 501 Winter 2016 Assignment 1 for the Week of January 25

ENCM 501 Winter 2016 Assignment 1 for the Week of January 25 page 1 of 5 ENCM 501 Winter 2016 Assignment 1 for the Week of January 25 Steve Norman Department of Electrical & Computer Engineering University of Calgary January 2016 Assignment instructions and other

More information

ENCM 501 Winter 2017 Assignment 3 for the Week of January 30

ENCM 501 Winter 2017 Assignment 3 for the Week of January 30 page 1 of 7 ENCM 501 Winter 2017 Assignment 3 for the Week of January 30 Steve Norman Department of Electrical & Computer Engineering University of Calgary January 2017 Assignment instructions and other

More information

ENCM 369 Winter 2017 Lab 3 for the Week of January 30

ENCM 369 Winter 2017 Lab 3 for the Week of January 30 page 1 of 11 ENCM 369 Winter 2017 Lab 3 for the Week of January 30 Steve Norman Department of Electrical & Computer Engineering University of Calgary January 2017 Lab instructions and other documents for

More information

ENCM 501 Winter 2018 Assignment 2 for the Week of January 22 (with corrections)

ENCM 501 Winter 2018 Assignment 2 for the Week of January 22 (with corrections) page 1 of 5 ENCM 501 Winter 2018 Assignment 2 for the Week of January 22 (with corrections) Steve Norman Department of Electrical & Computer Engineering University of Calgary January 2018 Assignment instructions

More information

Integer Multiplication and Division

Integer Multiplication and Division Integer Multiplication and Division for ENCM 369: Computer Organization Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Winter Term, 208 Integer

More information

ENCM 369 Winter 2015 Lab 6 for the Week of March 2

ENCM 369 Winter 2015 Lab 6 for the Week of March 2 page of 2 ENCM 369 Winter 25 Lab 6 for the Week of March 2 Steve Norman Department of Electrical & Computer Engineering University of Calgary February 25 Lab instructions and other documents for ENCM 369

More information

ENCM 501 Winter 2015 Assignment 3 for the Week of February 2

ENCM 501 Winter 2015 Assignment 3 for the Week of February 2 page 1 of 6 ENCM 501 Winter 2015 Assignment 3 for the Week of February 2 Steve Norman Department of Electrical & Computer Engineering University of Calgary January 2015 Assignment instructions and other

More information

Slide Set 1. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 1. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 1 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2016 ENCM 339 Fall 2016 Slide Set 1 slide 2/43

More information

Slide Set 2. for ENCM 335 in Fall Steve Norman, PhD, PEng

Slide Set 2. for ENCM 335 in Fall Steve Norman, PhD, PEng Slide Set 2 for ENCM 335 in Fall 2018 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2018 ENCM 335 Fall 2018 Slide Set 2 slide

More information

Slide Set 15 (Complete)

Slide Set 15 (Complete) Slide Set 15 (Complete) for ENCM 339 Fall 2017 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary November 2017 ENCM 339 Fall 2017

More information

The following information is for reviewing the material since Exam 3:

The following information is for reviewing the material since Exam 3: Outcomes List for Math 121 Calculus I Fall 2010-2011 General Information: The purpose of this Outcomes List is to give you a concrete summary of the material you should know, and the skills you should

More information

Slide Set 11. for ENCM 369 Winter 2015 Lecture Section 01. Steve Norman, PhD, PEng

Slide Set 11. for ENCM 369 Winter 2015 Lecture Section 01. Steve Norman, PhD, PEng Slide Set 11 for ENCM 369 Winter 2015 Lecture Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Winter Term, 2015 ENCM 369 W15 Section

More information

6.01, Spring Semester, 2008 Assignment 3, Issued: Tuesday, February 19 1

6.01, Spring Semester, 2008 Assignment 3, Issued: Tuesday, February 19 1 6.01, Spring Semester, 2008 Assignment 3, Issued: Tuesday, February 19 1 MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.01 Introduction to EECS I Spring

More information

Administrivia. Next Monday is Thanksgiving holiday. Tuesday and Wednesday the lab will be open for make-up labs. Lecture as usual on Thursday.

Administrivia. Next Monday is Thanksgiving holiday. Tuesday and Wednesday the lab will be open for make-up labs. Lecture as usual on Thursday. Administrivia Next Monday is Thanksgiving holiday. Tuesday and Wednesday the lab will be open for make-up labs. Lecture as usual on Thursday. Lab notebooks will be due the week after Thanksgiving, when

More information

Trigonometric Functions of Any Angle

Trigonometric Functions of Any Angle Trigonometric Functions of Any Angle MATH 160, Precalculus J. Robert Buchanan Department of Mathematics Fall 2011 Objectives In this lesson we will learn to: evaluate trigonometric functions of any angle,

More information

Math 2250 Lab #3: Landing on Target

Math 2250 Lab #3: Landing on Target Math 2250 Lab #3: Landing on Target 1. INTRODUCTION TO THE LAB PROGRAM. Here are some general notes and ideas which will help you with the lab. The purpose of the lab program is to expose you to problems

More information

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section

More information

Contents. Slide Set 1. About these slides. Outline of Slide Set 1. Typographical conventions: Italics. Typographical conventions. About these slides

Contents. Slide Set 1. About these slides. Outline of Slide Set 1. Typographical conventions: Italics. Typographical conventions. About these slides Slide Set 1 for ENCM 369 Winter 2014 Lecture Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Winter Term, 2014 ENCM 369 W14 Section

More information

Problem Possible Points Points Earned Problem Possible Points Points Earned Test Total 100

Problem Possible Points Points Earned Problem Possible Points Points Earned Test Total 100 MATH 1080 Test 2-Version A Fall 2015 Student s Printed Name: Instructor: Section # : You are not allowed to use any textbook, notes, cell phone, laptop, PDA, or any technology on any portion of this test.

More information

Slide Set 1 (corrected)

Slide Set 1 (corrected) Slide Set 1 (corrected) for ENCM 369 Winter 2018 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary January 2018 ENCM 369 Winter 2018

More information

Math 126 Winter CHECK that your exam contains 8 problems.

Math 126 Winter CHECK that your exam contains 8 problems. Math 126 Winter 2016 Your Name Your Signature Student ID # Quiz Section Professor s Name TA s Name CHECK that your exam contains 8 problems. This exam is closed book. You may use one 8 1 11 sheet of hand-written

More information

ENCM 369 Winter 2018 Lab 9 for the Week of March 19

ENCM 369 Winter 2018 Lab 9 for the Week of March 19 page 1 of 9 ENCM 369 Winter 2018 Lab 9 for the Week of March 19 Steve Norman Department of Electrical & Computer Engineering University of Calgary March 2018 Lab instructions and other documents for ENCM

More information

Introduction to Scientific Computing Lecture 1

Introduction to Scientific Computing Lecture 1 Introduction to Scientific Computing Lecture 1 Professor Hanno Rein Last updated: September 10, 2017 1 Number Representations In this lecture, we will cover two concept that are important to understand

More information

9 abcd = dcba b + 90c = c + 10b b = 10c.

9 abcd = dcba b + 90c = c + 10b b = 10c. In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

More information

Introduction to: Computers & Programming: Review prior to 1 st Midterm

Introduction to: Computers & Programming: Review prior to 1 st Midterm Introduction to: Computers & Programming: Review prior to 1 st Midterm Adam Meyers New York University Summary Some Procedural Matters Summary of what you need to Know For the Test and To Go Further in

More information

Slide Set 3. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng

Slide Set 3. for ENCM 339 Fall 2017 Section 01. Steve Norman, PhD, PEng Slide Set 3 for ENCM 339 Fall 2017 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2017 ENCM 339 Fall 2017 Section 01

More information

Downloaded from Chapter 2. Functions

Downloaded from   Chapter 2. Functions Chapter 2 Functions After studying this lesson, students will be able to: Understand and apply the concept of module programming Write functions Identify and invoke appropriate predefined functions Create

More information

Computational Mathematics/Information Technology. Worksheet 2 Iteration and Excel

Computational Mathematics/Information Technology. Worksheet 2 Iteration and Excel Computational Mathematics/Information Technology Worksheet 2 Iteration and Excel This sheet uses Excel and the method of iteration to solve the problem f(x) = 0. It introduces user functions and self referencing

More information

Limits and Derivatives (Review of Math 249 or 251)

Limits and Derivatives (Review of Math 249 or 251) Chapter 3 Limits and Derivatives (Review of Math 249 or 251) 3.1 Overview This is the first of two chapters reviewing material from calculus; its and derivatives are discussed in this chapter, and integrals

More information

Types, lists & functions

Types, lists & functions Week 2 Types, lists & functions Data types If you want to write a program that allows the user to input something, you can use the command input: name = input (" What is your name? ") print (" Hello "+

More information

ENCM 335 Fall 2018 Tutorial for Week 13

ENCM 335 Fall 2018 Tutorial for Week 13 ENCM 335 Fall 2018 Tutorial for Week 13 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary 06 December, 2018 ENCM 335 Tutorial 06 Dec 2018 slide

More information

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab

MATH (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab MATH 495.3 (CRN 13695) Lab 1: Basics for Linear Algebra and Matlab Below is a screen similar to what you should see when you open Matlab. The command window is the large box to the right containing the

More information

(Refer Slide Time: 02:59)

(Refer Slide Time: 02:59) Numerical Methods and Programming P. B. Sunil Kumar Department of Physics Indian Institute of Technology, Madras Lecture - 7 Error propagation and stability Last class we discussed about the representation

More information

Python Programming: An Introduction to Computer Science

Python Programming: An Introduction to Computer Science Python Programming: An Introduction to Computer Science Chapter 3 Computing with Numbers Python Programming, 3/e 1 Objectives n To understand the concept of data types. n To be familiar with the basic

More information

Lecture Numbers. Richard E Sarkis CSC 161: The Art of Programming

Lecture Numbers. Richard E Sarkis CSC 161: The Art of Programming Lecture Numbers Richard E Sarkis CSC 161: The Art of Programming Class Administrivia Agenda To understand the concept of data types To be familiar with the basic numeric data types in Python To be able

More information

Slide Set 5. for ENCM 369 Winter 2014 Lecture Section 01. Steve Norman, PhD, PEng

Slide Set 5. for ENCM 369 Winter 2014 Lecture Section 01. Steve Norman, PhD, PEng Slide Set 5 for ENCM 369 Winter 2014 Lecture Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Winter Term, 2014 ENCM 369 W14 Section

More information

Unit 2: Data Storage CS 101, Fall 2018

Unit 2: Data Storage CS 101, Fall 2018 Unit 2: Data Storage CS 101, Fall 2018 Learning Objectives After completing this unit, you should be able to: Evaluate digital circuits that use AND, OR, XOR, and NOT. Convert binary integers to/from decimal,

More information

Mark Important Points in Margin. Significant Figures. Determine which digits in a number are significant.

Mark Important Points in Margin. Significant Figures. Determine which digits in a number are significant. Knowledge/Understanding: How and why measurements are rounded. Date: How rounding and significant figures relate to precision and uncertainty. When significant figures do not apply. Skills: Determine which

More information

ENCM 501 Winter 2017 Assignment 6 for the Week of February 27

ENCM 501 Winter 2017 Assignment 6 for the Week of February 27 page of 8 ENCM 5 Winter 27 Assignment 6 for the Week of February 27 Steve Norman Department of Electrical & Computer Engineering University of Calgary February 27 Assignment instructions and other documents

More information

Interactive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple

Interactive MATLAB use. Often, many steps are needed. Automated data processing is common in Earth science! only good if problem is simple Chapter 2 Interactive MATLAB use only good if problem is simple Often, many steps are needed We also want to be able to automate repeated tasks Automated data processing is common in Earth science! Automated

More information

Objectives. Materials. Teaching Time

Objectives. Materials. Teaching Time Teacher Notes Activity 6 Local Linearity, Differentiability, and Limits of Difference Quotients Objectives Connect the concept of local linearity to differentiability through numerical explorations of

More information

2.9 Linear Approximations and Differentials

2.9 Linear Approximations and Differentials 2.9 Linear Approximations and Differentials 2.9.1 Linear Approximation Consider the following graph, Recall that this is the tangent line at x = a. We had the following definition, f (a) = lim x a f(x)

More information

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

ENCM 339 Fall 2017: Editing and Running Programs in the Lab page 1 of 8 ENCM 339 Fall 2017: Editing and Running Programs in the Lab Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2017 Introduction This document is a

More information

Exam 1 Format, Concepts, What you should be able to do, and Sample Problems

Exam 1 Format, Concepts, What you should be able to do, and Sample Problems CSSE 120 Introduction to Software Development Exam 1 Format, Concepts, What you should be able to do, and Sample Problems Page 1 of 6 Format: The exam will have two sections: Part 1: Paper-and-Pencil o

More information

Slide Set 3. for ENCM 369 Winter 2018 Section 01. Steve Norman, PhD, PEng

Slide Set 3. for ENCM 369 Winter 2018 Section 01. Steve Norman, PhD, PEng Slide Set 3 for ENCM 369 Winter 2018 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary January 2018 ENCM 369 Winter 2018 Section

More information

Math 2250 Lab #3: Landing on Target

Math 2250 Lab #3: Landing on Target Math 2250 Lab #3: Landing on Target 1. INTRODUCTION TO THE LAB PROGRAM. Here are some general notes and ideas which will help you with the lab. The purpose of the lab program is to expose you to problems

More information

ENCM 339 Fall 2017 Lecture Section 01 Lab 3 for the Week of October 2

ENCM 339 Fall 2017 Lecture Section 01 Lab 3 for the Week of October 2 page 1 of 11 ENCM 339 Fall 2017 Lecture Section 01 Lab 3 for the Week of October 2 Steve Norman Department of Electrical & Computer Engineering University of Calgary September 2017 Lab instructions and

More information

Math 180 Written Homework Solutions Assignment #1 Due Thursday, September 4th at the beginning of your discussion class.

Math 180 Written Homework Solutions Assignment #1 Due Thursday, September 4th at the beginning of your discussion class. Math 180 Written Homework Solutions Assignment #1 Due Thursday, September 4th at the beginning of your discussion class. Directions. You are welcome to work on the following problems with other MATH 180

More information

NAME: Section # SSN: X X X X

NAME: Section # SSN: X X X X Math 155 FINAL EXAM A May 5, 2003 NAME: Section # SSN: X X X X Question Grade 1 5 (out of 25) 6 10 (out of 25) 11 (out of 20) 12 (out of 20) 13 (out of 10) 14 (out of 10) 15 (out of 16) 16 (out of 24)

More information

Increasing and Decreasing Functions. MATH 1003 Calculus and Linear Algebra (Lecture 20) Increasing and Decreasing Functions

Increasing and Decreasing Functions. MATH 1003 Calculus and Linear Algebra (Lecture 20) Increasing and Decreasing Functions Increasing and Decreasing Functions MATH 1003 Calculus and Linear Algebra (Lecture 20) Maosheng Xiong Department of Mathematics, HKUST Suppose y = f (x). 1. f (x) is increasing on an interval a < x < b,

More information

Class #15: Experiment Introduction to Matlab

Class #15: Experiment Introduction to Matlab Class #15: Experiment Introduction to Matlab Purpose: The objective of this experiment is to begin to use Matlab in our analysis of signals, circuits, etc. Background: Before doing this experiment, students

More information

AP Calculus BC Summer Assignment

AP Calculus BC Summer Assignment AP Calculus BC Summer Assignment Name Due Date: First Day of School Welcome to AP Calculus BC! This is an exciting, challenging, fast paced course that is taught at the college level. We have a lot of

More information

Linear and quadratic Taylor polynomials for functions of several variables.

Linear and quadratic Taylor polynomials for functions of several variables. ams/econ 11b supplementary notes ucsc Linear quadratic Taylor polynomials for functions of several variables. c 016, Yonatan Katznelson Finding the extreme (minimum or maximum) values of a function, is

More information

Slide Set 9. for ENCM 369 Winter 2018 Section 01. Steve Norman, PhD, PEng

Slide Set 9. for ENCM 369 Winter 2018 Section 01. Steve Norman, PhD, PEng Slide Set 9 for ENCM 369 Winter 2018 Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary March 2018 ENCM 369 Winter 2018 Section 01

More information

TEAMS National Competition High School Version Photometry Solution Manual 25 Questions

TEAMS National Competition High School Version Photometry Solution Manual 25 Questions TEAMS National Competition High School Version Photometry Solution Manual 25 Questions Page 1 of 15 Photometry Questions 1. When an upright object is placed between the focal point of a lens and a converging

More information

CS1 Lecture 3 Jan. 18, 2019

CS1 Lecture 3 Jan. 18, 2019 CS1 Lecture 3 Jan. 18, 2019 Office hours for Prof. Cremer and for TAs have been posted. Locations will change check class website regularly First homework assignment will be available Monday evening, due

More information

Maths: Phase 5 (Y12-13) Outcomes

Maths: Phase 5 (Y12-13) Outcomes Maths: Phase 5 (Y12-13) Outcomes I know numbers are beautiful. If they aren t beautiful nothing is. Paul Erdose Maths is discovered it doesn t just exist. Maths is a tool to understand, question and criticise

More information

Carleton University Department of Systems and Computer Engineering SYSC Foundations of Imperative Programming - Winter 2012

Carleton University Department of Systems and Computer Engineering SYSC Foundations of Imperative Programming - Winter 2012 Carleton University Department of Systems and Computer Engineering SYSC 2006 - Foundations of Imperative Programming - Winter 2012 Lab 2 - C Functions Objective The objective of this lab is to write some

More information

1. Fill in the right hand side of the following equation by taking the derivative: (x sin x) =

1. Fill in the right hand side of the following equation by taking the derivative: (x sin x) = 7.1 What is x cos x? 1. Fill in the right hand side of the following equation by taking the derivative: (x sin x = 2. Integrate both sides of the equation. Instructor: When instructing students to integrate

More information

LECTURE 18 - OPTIMIZATION

LECTURE 18 - OPTIMIZATION LECTURE 18 - OPTIMIZATION CHRIS JOHNSON Abstract. In this lecture we ll describe extend the optimization techniques you learned in your first semester calculus class to optimize functions of multiple variables.

More information

Chapter 1. Math review. 1.1 Some sets

Chapter 1. Math review. 1.1 Some sets Chapter 1 Math review This book assumes that you understood precalculus when you took it. So you used to know how to do things like factoring polynomials, solving high school geometry problems, using trigonometric

More information

CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, Good Luck!

CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, Good Luck! CS 303E Fall 2011 Exam 2 Solutions and Criteria November 2, 2011 Name: EID: Section Number: Friday discussion time (circle one): 9-10 10-11 11-12 12-1 2-3 Friday discussion TA(circle one): Wei Ashley Answer

More information

Com S 127 Lab 2. For the first two parts of the lab, start up Wing 101 and use the Python shell window to try everything out.

Com S 127 Lab 2. For the first two parts of the lab, start up Wing 101 and use the Python shell window to try everything out. Com S 127 Lab 2 Checkpoint 0 Please open the CS 127 Blackboard page and click on Groups in the menu at left. Sign up for the group corresponding to the lab section you are attending. Also, if you haven't

More information

Slide Set 9. for ENCM 335 in Fall Steve Norman, PhD, PEng

Slide Set 9. for ENCM 335 in Fall Steve Norman, PhD, PEng Slide Set 9 for ENCM 335 in Fall 2018 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary October 2018 ENCM 335 Fall 2018 Slide Set 9 slide 2/32

More information

Math 4410 Fall 2010 Exam 3. Show your work. A correct answer without any scratch work or justification may not receive much credit.

Math 4410 Fall 2010 Exam 3. Show your work. A correct answer without any scratch work or justification may not receive much credit. Math 4410 Fall 2010 Exam 3 Name: Directions: Complete all six questions. Show your work. A correct answer without any scratch work or justification may not receive much credit. You may not use any notes,

More information

CS1 Lecture 3 Jan. 22, 2018

CS1 Lecture 3 Jan. 22, 2018 CS1 Lecture 3 Jan. 22, 2018 Office hours for me and for TAs have been posted, locations will change check class website regularly First homework available, due Mon., 9:00am. Discussion sections tomorrow

More information

Objectives. Materials

Objectives. Materials Activity 6 Local Linearity, Differentiability, and Limits of Difference Quotients Objectives Connect the concept of local linearity to differentiability through numerical explorations of limits of difference

More information

The Bisection Method versus Newton s Method in Maple (Classic Version for Windows)

The Bisection Method versus Newton s Method in Maple (Classic Version for Windows) The Bisection Method versus (Classic Version for Windows) Author: Barbara Forrest Contact: baforres@uwaterloo.ca Copyrighted/NOT FOR RESALE version 1.1 Contents 1 Objectives for this Lab i 2 Approximate

More information

Introduction to numerical algorithms

Introduction to numerical algorithms Introduction to numerical algorithms Given an algebraic equation or formula, we may want to approximate the value, and while in calculus, we deal with equations or formulas that are well defined at each

More information

CCSSM Curriculum Analysis Project Tool 1 Interpreting Functions in Grades 9-12

CCSSM Curriculum Analysis Project Tool 1 Interpreting Functions in Grades 9-12 Tool 1: Standards for Mathematical ent: Interpreting Functions CCSSM Curriculum Analysis Project Tool 1 Interpreting Functions in Grades 9-12 Name of Reviewer School/District Date Name of Curriculum Materials:

More information

Slide Set 5. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 5. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 5 for ENEL 353 Fall 207 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 207 SN s ENEL 353 Fall 207 Slide Set 5 slide

More information

10.4 Linear interpolation method Newton s method

10.4 Linear interpolation method Newton s method 10.4 Linear interpolation method The next best thing one can do is the linear interpolation method, also known as the double false position method. This method works similarly to the bisection method by

More information

Ch.3: Functions and branching

Ch.3: Functions and branching Ch.3: Functions and branching Ole Christian Lingjærde, Dept of Informatics, UiO September 4-8, 2017 Today s agenda A small quiz to test understanding of lists Live-programming of exercises 2.7, 2.14, 2.15

More information

Structure and Interpretation of Computer Programs

Structure and Interpretation of Computer Programs CS 61A Fall 2018 Structure and Interpretation of Computer Programs Final INSTRUCTIONS You have 3 hours to complete the exam. The exam is closed book, closed notes, closed computer, closed calculator, except

More information

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers

Unit 7 Number System and Bases. 7.1 Number System. 7.2 Binary Numbers. 7.3 Adding and Subtracting Binary Numbers. 7.4 Multiplying Binary Numbers Contents STRAND B: Number Theory Unit 7 Number System and Bases Student Text Contents Section 7. Number System 7.2 Binary Numbers 7.3 Adding and Subtracting Binary Numbers 7.4 Multiplying Binary Numbers

More information

Classes of Real Numbers 1/2. The Real Line

Classes of Real Numbers 1/2. The Real Line Classes of Real Numbers All real numbers can be represented by a line: 1/2 π 1 0 1 2 3 4 real numbers The Real Line { integers rational numbers non-integral fractions irrational numbers Rational numbers

More information

6.S189 Homework 2. What to turn in. Exercise 3.1 Defining A Function. Exercise 3.2 Math Module.

6.S189 Homework 2. What to turn in. Exercise 3.1 Defining A Function. Exercise 3.2 Math Module. 6.S189 Homework 2 http://web.mit.edu/6.s189/www/materials.html What to turn in Checkoffs 3, 4 and 5 are due by 5 PM on Monday, January 15th. Checkoff 3 is over Exercises 3.1-3.2, Checkoff 4 is over Exercises

More information

4.7 Approximate Integration

4.7 Approximate Integration 4.7 Approximate Integration Some anti-derivatives are difficult to impossible to find. For example, 1 0 e x2 dx or 1 1 1 + x3 dx We came across this situation back in calculus I when we introduced the

More information

MAT128A: Numerical Analysis Lecture One: Course Logistics and What is Numerical Analysis?

MAT128A: Numerical Analysis Lecture One: Course Logistics and What is Numerical Analysis? MAT128A: Numerical Analysis Lecture One: Course Logistics and What is Numerical Analysis? September 26, 2018 Lecture 1 September 26, 2018 1 / 19 Course Logistics My contact information: James Bremer Email:

More information

Slide Set 4. for ENCM 335 in Fall Steve Norman, PhD, PEng

Slide Set 4. for ENCM 335 in Fall Steve Norman, PhD, PEng Slide Set 4 for ENCM 335 in Fall 2018 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2018 ENCM 335 Fall 2018 Slide Set 4 slide

More information

MEI GeoGebra Tasks for A2 Core

MEI GeoGebra Tasks for A2 Core Task 1: Functions The Modulus Function 1. Plot the graph of y = x : use y = x or y = abs(x) 2. Plot the graph of y = ax+b : use y = ax + b or y = abs(ax+b) If prompted click Create Sliders. What combination

More information

ENCM 369 Winter 2016 Lab 11 for the Week of April 4

ENCM 369 Winter 2016 Lab 11 for the Week of April 4 page 1 of 13 ENCM 369 Winter 2016 Lab 11 for the Week of April 4 Steve Norman Department of Electrical & Computer Engineering University of Calgary April 2016 Lab instructions and other documents for ENCM

More information

Introduction to Computer Programming with MATLAB Calculation and Programming Errors. Selis Önel, PhD

Introduction to Computer Programming with MATLAB Calculation and Programming Errors. Selis Önel, PhD Introduction to Computer Programming with MATLAB Calculation and Programming Errors Selis Önel, PhD Today you will learn Numbers, Significant figures Error analysis Absolute error Relative error Chopping

More information

Scientific Computing: Lecture 1

Scientific Computing: Lecture 1 Scientific Computing: Lecture 1 Introduction to course, syllabus, software Getting started Enthought Canopy, TextWrangler editor, python environment, ipython, unix shell Data structures in Python Integers,

More information

ENGR 102 Engineering Lab I - Computation

ENGR 102 Engineering Lab I - Computation ENGR 102 Engineering Lab I - Computation Learning Objectives by Week 1 ENGR 102 Engineering Lab I Computation 2 Credits 2. Introduction to the design and development of computer applications for engineers;

More information

Math 126 Final Examination SPR CHECK that your exam contains 8 problems on 8 pages.

Math 126 Final Examination SPR CHECK that your exam contains 8 problems on 8 pages. Math 126 Final Examination SPR 2018 Your Name Your Signature Student ID # Quiz Section Professor s Name TA s Name CHECK that your exam contains 8 problems on 8 pages. This exam is closed book. You may

More information

CS 115 Lecture 4. More Python; testing software. Neil Moore

CS 115 Lecture 4. More Python; testing software. Neil Moore CS 115 Lecture 4 More Python; testing software Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 8 September 2015 Syntax: Statements A statement

More information

CCNY Math Review Chapter 2: Functions

CCNY Math Review Chapter 2: Functions CCN Math Review Chapter : Functions Section.1: Functions.1.1: How functions are used.1.: Methods for defining functions.1.3: The graph of a function.1.: Domain and range.1.5: Relations, functions, and

More information

Calculators ARE NOT Permitted On This Portion Of The Exam 28 Questions - 55 Minutes

Calculators ARE NOT Permitted On This Portion Of The Exam 28 Questions - 55 Minutes 1 of 11 1) Give f(g(1)), given that Calculators ARE NOT Permitted On This Portion Of The Exam 28 Questions - 55 Minutes 2) Find the slope of the tangent line to the graph of f at x = 4, given that 3) Determine

More information

ENCM 501 Winter 2019 Assignment 9

ENCM 501 Winter 2019 Assignment 9 page 1 of 6 ENCM 501 Winter 2019 Assignment 9 Steve Norman Department of Electrical & Computer Engineering University of Calgary April 2019 Assignment instructions and other documents for ENCM 501 can

More information

CSE 251 PROJECT 1. Andrew Christlieb. Monday Class AND Friday Class Abstract. Web:

CSE 251 PROJECT 1. Andrew Christlieb. Monday Class AND Friday Class Abstract. Web: CSE 51 PROJECT 1 Andrew Christlieb Monday Class 0-03-14 AND Friday Class 01-31-14 Abstract Web: http://www.cse.msu.edu/ cse51 Project 1 due date: (Monday Class) 0-17-14 AND (Friday Class)0-14-14, time:

More information

MAT 182: Calculus II Test on Chapter 6: Applications of Integration Take-Home Portion Points as Assigned for Each Exercise 40 Points Total.

MAT 182: Calculus II Test on Chapter 6: Applications of Integration Take-Home Portion Points as Assigned for Each Exercise 40 Points Total. Name: Section: Date: MAT 182: Calculus II Test on Chapter 6: Applications of Integration Take-Home Portion Points as Assigned for Each Exercise 40 Points Total Guidelines 1. Each student must produce his

More information

Introduction to Python and programming. Ruth Anderson UW CSE 160 Winter 2017

Introduction to Python and programming. Ruth Anderson UW CSE 160 Winter 2017 Introduction to Python and programming Ruth Anderson UW CSE 160 Winter 2017 1 1. Python is a calculator 2. A variable is a container 3. Different types cannot be compared 4. A program is a recipe 2 0.

More information

Paul's Online Math Notes. Online Notes / Algebra (Notes) / Systems of Equations / Augmented Matricies

Paul's Online Math Notes. Online Notes / Algebra (Notes) / Systems of Equations / Augmented Matricies 1 of 8 5/17/2011 5:58 PM Paul's Online Math Notes Home Class Notes Extras/Reviews Cheat Sheets & Tables Downloads Algebra Home Preliminaries Chapters Solving Equations and Inequalities Graphing and Functions

More information

TEAMS National Competition Middle School Version Photometry Solution Manual 25 Questions

TEAMS National Competition Middle School Version Photometry Solution Manual 25 Questions TEAMS National Competition Middle School Version Photometry Solution Manual 25 Questions Page 1 of 14 Photometry Questions 1. When an upright object is placed between the focal point of a lens and a converging

More information

MATH 1A MIDTERM 1 (8 AM VERSION) SOLUTION. (Last edited October 18, 2013 at 5:06pm.) lim

MATH 1A MIDTERM 1 (8 AM VERSION) SOLUTION. (Last edited October 18, 2013 at 5:06pm.) lim MATH A MIDTERM (8 AM VERSION) SOLUTION (Last edited October 8, 03 at 5:06pm.) Problem. (i) State the Squeeze Theorem. (ii) Prove the Squeeze Theorem. (iii) Using a carefully justified application of the

More information