class 5 retrieving a previous statement in Thonny or IDLE // %

Slides:



Advertisements
Similar presentations
4.7 Inverse Trig Functions. Does the Sine function have an inverse? 1.
Advertisements

Section 4.7 Inverse Trigonometric Functions. A brief review….. 1.If a function is one-to-one, the function has an inverse that is a function. 2.If the.
Functions and methods A method is a function that is a member of a class A method is a function that is a member of a class FCL(Framework Class Library)
5.3 Solving Trigonometric Equations *use standard algebraic techniques to solve trig equations *solve trig equations in quadratic form *solve trig equations.
4.7 Inverse Trig Functions
Section 5.5 Inverse Trigonometric Functions & Their Graphs
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
ME 142 Engineering Computation I Excel Functions.
1 TAC2000/ Protocol Engineering and Application Research Laboratory (PEARL) MATH Functions in C Language.
CSC1015F – Chapter 3, Computing with Numbers Michelle Kuttel
ENG 1181 College of Engineering Engineering Education Innovation Center MATLAB is a powerful program for numerical computations, plotting and programming.
Introduction to MATLAB ENGR 1181 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
STANDARD FUNCTIONS Computer Programming Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
Section 7.5 Inverse Circular Functions
Class Work Find the exact value of cot 330
4.7 INVERSE TRIGONOMETRIC FUNCTIONS. For an inverse to exist the function MUST be one- to - one A function is one-to- one if for every x there is exactly.
Visual Basic I Programming
Values of the Trig Functions Reference angles and inverse functions (5.4)
C++ Programming Lecture 9 Functions – Part I By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Pg. 385 Homework Pg. 395#13 – 41 odd, Graph the three inverse trig functions and label the domain and range of each. Memorization quiz through inverse.
ENG 1181 First-Year Engineering Program College of Engineering Engineering Education Innovation Center First-Year Engineering Program MAT - Introduction.
The Right Triangle Right Triangle Pythagorean Theorem
29 January 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems.
The Accumulator Pattern Summing: Add up (“accumulate”), e.g. 1 2 plus 2 2 plus 3 2 plus … plus Variation: Form a product (instead of sum), e.g.
Useful Python CMSC 120: Visualizing Information. Scope def area(diameter): radius = diameter / 2.0 A = PI * radius ** 2 return A def circumference(diameter):
C H. 4 – T RIGONOMETRIC F UNCTIONS 4.7 – Inverse Trig Functions.
ANSWERS. Using Trig in every day life. Check Homework.
1 Lecture 7 of 12 Inverse Trigonometric Functions.
Inverse Trig Functions Vocabulary Inverse Cosine Function (cos -1 ) – The function y=cos -1 x = Arccos x, if and only if x = cos y and 0 ≤ y ≤ π Inverse.
Variables, Operators, and Expressions
Simple C Programs.
Section 7.5 Inverse Circular Functions
Section 4.6 Inverse Trigonometric fuctions
Review of radian measure.
Inverse Trig Functions
4.7(b) Notes: The Other Inverse Trig. Functions
6.8 – Trig Inverses and their graphs
The Inverse Sine, Cosine and Tangent Functions
ECE 1304 Introduction to Electrical and Computer Engineering
The Inverse Trigonometric Functions
Trig/Precalc Chapter 5.7 Inverse trig functions
Warm Up Let g(x) = {(1, 3), (2, 5), (4, 10), (-3, 7)}. What is g -1(x)? Write the inverse of the function: f(x) = 2x – 3 Determine whether the function.
BIL 104E Introduction to Scientific and Engineering Computing
Computer Simulation Lab
6.6 Inverse Trigonometric Functions
Ch. 5 – Analytic Trigonometry
Fundamental of Java Programming Basics of Java Programming
Inverse Trigonometric Functions
Introduction to Programming
Math Library and IO formatting
Sum and Difference Identities
Ch 4.7: Inverse Trig Functions
Inverse Trigonometric Functions
TRIGONOMETRIC GRAPHS.
§1.5 Inverse and log functions

1.6 Inverse Functions and Logarithms
Lecture 9: Arrays Building Java Programs: A Back to Basics Approach
Evaluating Inverse Trig Expressions
月夜憶舍弟 戍鼓斷人行,邊秋一雁聲。 露從今夜白,月是故鄉明。 有弟皆分散,無家問死生。 寄書長不達,況乃未休兵。 杜甫
class 4 definite loops range list end=" "
Output Formatting Bina Ramamurthy 4/16/2019 BR.
Class 6 using the math library
月夜憶舍弟 戍鼓斷人行,邊秋一雁聲。 露從今夜白,月是故鄉明。 有弟皆分散,無家問死生。 寄書長不達,況乃未休兵。 杜甫
月夜憶舍弟 戍鼓斷人行,邊秋一雁聲。 露從今夜白,月是故鄉明。 有弟皆分散,無家問死生。 寄書長不達,況乃未休兵。 杜甫
Notes 6-8: Principal Values and Inverses
Computer Simulation Lab
Output Formatting Bina Ramamurthy 9/25/2019 BR.
Section 4.7.
Presentation transcript:

class 5 retrieving a previous statement in Thonny or IDLE // % // % order of operations computing ones, tens, and hundreds range(_), range(_,_), range(_,_,_) accumulating a sum math library trig review preview of Objects Graphics intro

retrieving previous statements in the shell. In Thonny, up and down arrow keys. In IDLE: mac: control p (previous), control n (next) windows: alt p, alt n

Given a number of days (days) how many full weeks is it? Put the answer in weeks. How many days left over? Put the answer in extra_days. Example: 18 days comes out to 2 weeks and 4 extra days. 2 R 4 7 18 18 // 7 = 2 18 % 7 = 4

18 % 7 put in rows of 7, number in last NOT FULL row (might be 0 ): X X X X X X X X X X X 4

18 // 7 put in rows of 7, number of full rows X X X X X X X 2 X X X X

14 % 7 put in rows of 7, number in last NOT FULL row (might be 0 ): X X X X X X X

14 // 7 put in rows of 7, number of full rows X X X X X X X 2

Order of Operations: parentheses ** * and / and // and % + and - Example: x = 12.5 - 3.5 + 4.7 Left to right since + and - are the same “level” 9.0 13.7 NOT x = 12.5 - 3.5 + 4.7 8.2 4.3 WRONG!!

Compute the following expressions 5 // 10 * 2 5 / 10 * 2

Compute the following expressions 2**3**0 (2**3)**0

What is the output? a = 725 b = a%10 c = a//10 d = c%10 e = a//100 print(a) print(e, d, b)

What is the output? >>>list( range(3,7))

What is the output? >>>list( range(7,1))

What is the output? >>>list( range(4,10,2))

What is the output? >>>for decimal in range(4,5,.1): print(decimal, end=", ")

How could we do it, get 4.0, 4.1, 4.2 etc? >>>for k in range( ): print( , end=", ")

What is the output? for k in list[77, 3.14, "hot dog"]: print(k, end=" ")

What is the output? for count in range(3): num = eval(input("Enter a number: ")) print(num+1, end=', ')

What is the output? sum = 0 for val in range(5, 50, 10): sum=sum + val print(sum)

Accumulating a sum sum = 0 #initialize accumulator for val in range(5, 50, 10): sum=sum+val print("partial sum is", sum) print("final sum is", sum) #out of loop

accumulating a sum If we do just the loop again do we get the same answer?

accumulating a sum If we do just the loop again do we get the same answer? NO Need to reset sum to 0.

What is the output? for j in range (1, 4): sum = 0 sum = sum + j print(sum)

What is the output? mystery = 100 for k in range ( 5 ): mystery=mystery-10 print(mystery)

Observe mystery = 100 for k in range ( 5 ): mystery=mystery-10 print(mystery) k isn't even used inside the loop! Just for counting.

From Lab 4: add 1/1 + 1/2 + 1/3 +... sum = 0 for k in range (1,101,1): sum=sum + 1/k print(sum)

Using the Math Library Python Mathematics English pi An approximation of pi e An approximation of e sqrt(x) The square root of x sin(x) sin x The sine of x cos(x) cos x The cosine of x tan(x) tan x The tangent of x asin(x) arcsin x The inverse of sine x acos(x) arccos x The inverse of cosine x atan(x) arctan x The inverse of tangent x Python Programming, 3/e

Using the Math Library Python Mathematics English log(x) ln x The natural (base e) logarithm of x log10(x) The common (base 10) logarithm of x exp(x) The exponential of x ceil(x) The smallest whole number >= x floor(x) The largest whole number <= x Python Programming, 3/e

Trig Review: Definition of sine and cosine (Unit circle, radius=1) (cos sin ) (cos sin )  From Wikipedia, modified

cos(0) = sin(0) = 1.0 0.0 (cos(0), sin(0))

cos(PI/2) = sin(PI/2) = 0.0 1.0 (cos(PI/2), sin(PI/2))

cos(PI) = sin(PI) = -1.0 0.0 (cos(PI), sin(PI))

Preview of Objects Data type we have seen: int, float, string We can make "instances" of each: age=10 #int price = 57.23 #float They have data – their values. They can do things: + * print

Preview of Objects Object Oriented Programming: We can make "data types" of our own – called Objects, and package them with functions – things they can do. We will build our own objects later.

Preview of Objects There are packages of predesigned Objects. We will get used to the idea by working with a package for graphics.

Introduction to graphics.py Some of the objects we can use: GraphWin (windows for drawing in) Circles Polygons Points

Introduction to graphics.py Each Circle we make is an "instance" of a Circle. Each instance of a Circle has its own data: its center its color its radius ...

Introduction to graphics.py Each Circle we make is an "instance" of a Circle. Each instance of a Circle can do things: draw itself in a window change color report the x coordinate of its center clone itself ...

The Graphics Window Made up of pixels – picture elements. (0,0) is upper left corner. x increases to the right y increases down

The Graphics Window