Lecture 9 There are ain’t no way to find out why a snorer can’t hear himself snore Mark Twain, Western koan.

Slides:



Advertisements
Similar presentations
Methods Java 5.1 A quick overview of methods
Advertisements

1 Data Type Anan Phonphoem Data Type Ordinal TypeNon-ordinal Type StandardUser Define Enumerated Subrange Integer Char Boolean Real.
Building Java Programs
Return values.
Arithmetic in Pascal (2) Arithmetic Functions Perform arithmetic calculations Gives an argument to the function and it returns the result.
6.6 – TRIG INVERSES AND THEIR GRAPHS
1 Programming Languages and Paradigms Lisp Programming.
Evaluating Sine & Cosine and and Tangent (Section 7.4)
A Library of Functions This presentation will review the behavior of the most common functions including their graphs and their domains and ranges. See.
3.1 The inverse sine, cosine, and tangent functions Warm-up (IN) 1.What is the domain and range of ? 2.True or False: The graph of is decreasing on the.
Python (yay!) November 16, Unit 7. Recap We can store values in variables using an assignment statement >>>x = We can get input from the user using.
Strings, if/else, return, user input
1 Week 1 Complex numbers: the basics 1. The definition of complex numbers and basic operations 2. Roots, exponential function, and logarithm 3. Multivalued.
Functions and methods A method is a function that is a member of a class FCL(Framework Class Library) provides a rich collection of classes and methods.
5.3 Solving Trigonometric Equations. What are two values of x between 0 and When Cos x = ½ x = arccos ½.
12-2 Know how if and switch C statements control the sequence of execution of statements. Be able to use relational and logical operators in the conditional.
Microsoft® Small Basic The Math Object Estimated time to complete this lesson: 1 hour.
FOR DOWNTO Suppose you want to write a FOR-DO loop where the control variable is decreased with each repetition of the loop. Pascal provides the reserved.
Miss Battaglia AP Calculus. The natural logarithmic function is defined by The domain of the natural logarithmic function is the set of all positive real.
1 CS101 Introduction to Computing Lecture 38 String Manipulations (Web Development Lecture 13)
Library of Functions You should be familiar with the shapes of these basic functions. We'll learn them in this section.
Functions and Modules CSIS 1595: Fundamentals of Programming and Problem Solving 1.
FUNCTIONS. Function call: >>> type(32) The name of the function is type. The expression in parentheses is called the argument of the function. Built-in.
Operators, Functions and Modules1 Pattern Matching & Recursion.
Chapter 3 Expressions and Interactivity Department of Computer Science Missouri State Univeristy.
Lecture 13 Midterm overview When you know a thing, to hold that you know it, and when you do not know a thing, to allow that you do not know it: this is.
Section 4.2 Trigonometric Functions: The Unit Circle
STANDARD FUNCTIONS Computer Programming Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
Section 7.5 Unit Circle Approach; Properties of the Trigonometric Functions.
Pascal language Slides of Omar Al-Nahal. Components of Pascal Language Components of Pascal Language 1. Pascal Character set: - English Letters. - Decimal.
basic functions.
CSC Programming for Science Lecture 7: Math Functions.
Week 2 - Friday.  What did we talk about last time?  Base systems  C literals  Representations in memory.
CS 153: Concepts of Compiler Design October 5 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Today’s Lecture Predefined Functions. Introduction to Functions  Reuse Issue  Building Blocks of Programs  Two types of functions  Predefined  Programmer.
Calculations Chapter 11 Library of math functions, and constants cos, sin, tan, abs, min, max, log, random, sqrt, pow, exp Constants.PI,.E Use care with.
Hot Seat Game!!! Review of Basic Graphs. Which 3 functions DO NOT have all Real #’s as their domain?
1 What you will learn  How to graph a basic sin and cos function.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 5, Lecture 1 (Monday)
CS Class 08 Today  Exercises  Nested loops  for statement  Built-in functions Announcements  Homework #3, group solution to in-class.
Homework Assignment #4 J. H. Wang Dec. 3, 2007.
Visual Basic I Programming
Introduction As programmers, we don’t want to have to implement functions for every possible task we encounter. The Standard C library contains functions.
CSCI 125 & 161 / ENGR 144 Lecture 8 Martin van Bommel.
Loops Brent M. Dingle Texas A&M University Chapter 7 – part B (and some from Mastering Turbo Pascal 5.5, 3 rd Edition by Tom Swan)
1 Ordinal types An ordinal data type is an ordered set in which every element, except the first element, has an immediate predecessor, and every element,
Drill Convert 105 degrees to radians Convert 5π/9 to radians What is the range of the equation y = 2 + 4cos3x? 7π/ degrees [-2, 6]
6.3 Graphing Sine and Cosine Functions. Periodic Functions A periodic function is a function with a repeating pattern this includes sin and cos graphs.
Copyright 1999 by Larry Fuhrer. Pascal Programming Branching, Loops, Predefined Functions.
Let’s Learn 3. Modules Saenthong School, January – February 2016
6.3 Graphing Sine and Cosine Functions Objective: Use the graphs of the sine and cosine functions.
13.5 Law of Cosines Objectives: 1.Solve problems by using the Law of Cosines 2.Determine whether a triangle can be solved by first using the Law of Sines.
If/else, return, user input, strings
160 as a product of its prime factors is 2 5 x 5 Use this information to show that 160 has 12 factors.
Section 3.5 Trigonometric Functions Section 3.5 Trigonometric Functions.
Fall 2001(c)opyright Brent M. Dingle 2001 Abstract Data Types (ADTs) Brent M. Dingle Texas A&M University Chapter 8 – Sections 2 and 3 (and some from Mastering.
Section 6.5 Theorems about Roots of Polynomial Equations Objective: Students will be able to solve equations using Theorems involving roots. Rational Root.
Week 3 - Wednesday CS 121.
CS 153: Concepts of Compiler Design October 3 Class Meeting
Chapter 1 Order Of Operations
AP Calculus AB Chapter 5, Section 1 ish
CMPE 152: Compiler Design October 2 Class Meeting
4TC00 Model-based systems engineering 2.2 Types and values
functions: argument, return value
4.1 – Graphs of the Sine and Cosine Functions
月夜憶舍弟 戍鼓斷人行,邊秋一雁聲。 露從今夜白,月是故鄉明。 有弟皆分散,無家問死生。 寄書長不達,況乃未休兵。 杜甫
月夜憶舍弟 戍鼓斷人行,邊秋一雁聲。 露從今夜白,月是故鄉明。 有弟皆分散,無家問死生。 寄書長不達,況乃未休兵。 杜甫
Section 3 – Graphing Sine and Cosine Functions
CMPE 152: Compiler Design March 7 Class Meeting
What is the radian equivalent?
Presentation transcript:

Lecture 9 There are ain’t no way to find out why a snorer can’t hear himself snore Mark Twain, Western koan

Lecture 8 review for-loops nested for-loops

Can the for-loops be even cooler? Hmm…. What about looping over characters… What if we want to go through alphabet and do something?

Ordinal types Ordinal types are the ones which are countable For example integers, characters, boolean but not reals.

Ordinal types Orinal types have concept of successor and predecessor succ( ‘A’ ) is (major wow) ‘B’ pred( ‘A’ ) is (major MOM!) Lets see more detailed example

Ordinal types succ( pred( ‘A’ ) ) chr( ord( ‘A’ ) ) succ( TRUE ) pred( TRUE )

Characters as loop counter! Running through the alphabet: for cMyChar := ‘a’ to ‘z’ do Lets see examples

You can have as many loops as you want in any program

Standard Pascal functions We need to be able to do basic math sqr- squares a number sqrt- takes square root of a number abs- absolute value of a number exp- e^x ln- natural logarithm (base e) cos- cosine sin- sine * for sin & cos argument is considered to be in radians

Turbo Pascal built in functions upcase - gets upper case version of a character frac - gets fractional part of a real int - gets integer part of a real random - gets random number in the range [ 0, 1 ] random(N) - gets random number in the range [ 0, N-1 ]

Why do we need random??? A lot of different applications Lets look at some (fun) examples

Homework Read the rest of the Chapter 5 Program 3 Page 204 #15 a,b due Monday, October 19th

Programs from this lecture Ordinal types Alphabet 1 letter at a time GenX Standard Pascal functions TP functions Random stars Dice game