Arithmetic in Pascal (2) Arithmetic Functions Perform arithmetic calculations Gives an argument to the function and it returns the result.

Slides:



Advertisements
Similar presentations
Escape Sequences \n newline \t tab \b backspace \r carriage return
Advertisements

Solving Right Triangles Essential Question How do I solve a right triangle?
Building Java Programs
Return values.
Maths & Trig, Statistical functions. ABS Returns the absolute value of a number The absolute value of a number is the number without its sign Syntax ◦
Excel Notes Phys244/246 © 2007, B.J. Lieb. Calculating Velocity The velocity is calculated by entering the following: =(B3-B2) / (A3-A2). Then drag the.
6.6 – TRIG INVERSES AND THEIR GRAPHS
Evaluating Sine & Cosine and and Tangent (Section 7.4)
Review
Lecture 6 MATLAB functions Basics of Built-in Functions, Help Feature, Elementary Functions (e.g., Polynomials, Trigonometric Functions), Data Analysis,
Reciprocal Trig Functions Section The Reciprocal Functions  cosecant (csc θ)=  secant (sec θ)=  cotangent (cot θ)=
Microsoft® Small Basic The Math Object Estimated time to complete this lesson: 1 hour.
Lecture 6 29/1/15. Number functions Number functions take numbers as input, change them, and output the results as numbers. 2.
8.3 Solving Right Triangles
Functions and Their Graphs
EXAMPLE 1 Use an inverse tangent to find an angle measure
Inverses  How do we know if something has an inverse? ○ Vertical line tests tell us if something is a function ○ Horizontal line tests will tell us if.
A B C Warm UP What side is The hypotenuse? What side is opposite  A?
2 pt 3 pt 4 pt 5pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2pt 3 pt 4pt 5 pt 1pt 2pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4pt 5 pt 1pt Logs TrigPoly Problem Sets Expon.
Foundations Basics: Notation, and other things Algebraic manipulations Indices, Logs, Roots and Surds Binomial expansion Trigonometric functions Trigonometric.
Section 6.4 Inverse Trigonometric Functions & Right Triangles
Computer Science 111 Fundamentals of Programming I Basic Program Elements.
Finding an angle. (Figuring out which ratio to use and getting to use the 2 nd button and one of the trig buttons. These are the inverse functions.) 5.4.
MATH AND RANDOM CLASSES.  The need for random numbers occurs frequently when writing software.  The Random class, which is part of the java.util class,
Warm- Up 1. Find the sine, cosine and tangent of  A. 2. Find x. 12 x 51° A.
Chapter 7.7 Notes: Solve Right Triangles Goal: You will use inverse tangent, sine, and cosine ratios to determine the unknown angle measures of right triangles.
6:12-4 Exploring square roots and rational numbers.
COMPUTER PROGRAMMING I Objective 7.03 Apply Built-in Math Class Functions Image taken from:
Inverse Trigonometric Functions 4.7
basic functions.
CSC Programming for Science Lecture 7: Math Functions.
CS 153: Concepts of Compiler Design October 5 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Math With Java The Math Class. First, A Quick Review of Math Operators in Java Primitive Data type in Java that represent numbers: Primitive Data type.
Arithmetic Expressions Russell Taylor NC Computing Software Application Development.
Lecture 9 There are ain’t no way to find out why a snorer can’t hear himself snore Mark Twain, Western koan.
Hot Seat Game!!! Review of Basic Graphs. Which 3 functions DO NOT have all Real #’s as their domain?
13.7 I NVERSE T RIGONOMETRIC F UNCTIONS Algebra II w/ trig.
Visual Basic I Programming
1 8.1 Inverse Trigonometric Functions In this section, we will study the following topics: Definitions of the inverse trig functions Evaluating inverse.
Objective: use the Unit Circle instead of a calculator to evaluating trig functions How is the Unit Circle used in place of a calculator?
Introduction As programmers, we don’t want to have to implement functions for every possible task we encounter. The Standard C library contains functions.
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,
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.
Section 6.5 Circular Functions: Graphs and Properties Copyright ©2013, 2009, 2006, 2001 Pearson Education, Inc.
Warm up. Review for chapter test Chapter 4 Understanding Trigonometric Functions Language Objectives: We will learn more about trigonometric functions.
Section 7.4 Inverses of the Trigonometric Functions Copyright ©2013, 2009, 2006, 2001 Pearson Education, Inc.
The Math Class Methods Utilizing the Important Math Operations of Java!
Computer Science: A Structured Programming Approach Using C1 4-5 Standard Functions C provides a rich collection of standard functions whose definitions.
Algebra II Honors Problem of the Day Homework: p a,b,g,3c,d,5,9,13,29,41,43 After watching the video graph y = cos t and y = sin t. graphing the.
29 January 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems.
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.
CS 115 Lecture 5 Math library; building a project Taken from notes by Dr. Neil Moore.
8-3 Trigonometry Part 2: Inverse Trigonometric Functions.
Lesson 8-6 The Sine and Cosine Ratios (page 312) The sine ratio and cosine ratio relate the legs to the hypotenuse. How can trigonometric ratios be used.
Reviewing Trigonometry Angle Measure Quadrant Express as a function of a positive acute angle Evaluate Find the angle Mixed Problems.
Understand radian measure of an angle as the length of the arc on the unit circle subtended by the angle Common Core Standards for Chapter 6 The arc in.
EXAMPLE 1 Use an inverse tangent to find an angle measure Use a calculator to approximate the measure of A to the nearest tenth of a degree. SOLUTION Because.
CSE 110: Programming Language I Afroza Sultana UB 1230.
Numeric Functions Purpose:-
Some Useful MATLAB Functions
CPSC Pascal Brent M. Dingle Texas A&M University Chapter 3
Square Roots Practice © T Madas.
Introduction to Programming
Algebra II (Honors) Chapter 1
1. Use the quadratic formula to find all real zeros of the second-degree polynomial
Inverses of the Trigonometric Functions
Geometry Section 7.7.
Objective 7.03 Apply Built-in Math Class Functions
What is the radian equivalent?
Presentation transcript:

Arithmetic in Pascal (2) Arithmetic Functions

Perform arithmetic calculations Gives an argument to the function and it returns the result

Some Arithmetic Functions Pascal function Argument type Function type sqr(x)integer or realsame as argument sqrt(x)integer or realreal sin(x)integer or realreal cos(x)integer or realreal ln(x)integer or realreal exp(x)integer or realreal

Some Arithmetic Functions Pascal function Argument type Function type random(x)integer abs(x)integer or realsame as argument round(x)realinteger trunc(x)realinteger

sqr(x) Return the square of the argument The type of the result is the same as the argument D := sqr(2) D = 4

sqrt(x) Return the square root of the argument The type of the result is always real The function type is real even when the result is a rounded number D := sqrt(9) D = 3.0

sin(x), cos(x) Return the sine and cosine of the argument The type of the result is always real The argument should be in radians, not degree Use Degree * Pi / 180 to calculate the radians

ln(x), exp(x) Return the value of ln and exp like the same function in your calculator The type of the result is always real X y := exp( y * ln(x) )

random(x) Return a random number between 0 and the argument – 1 The type of the result is integer Exception When you use random with no argument, it returns a number of type real ranged from 0 to 1 (but not include 1)

random(x) (cont.) Try to write a program to generate three random number Run the program for a few times Something strange !! Try to add a line randomize; before using random(x) This procedure randomize the random number generator

abs(x) Return the absolute value (positive value) of the argument The type of the result is the same as the type of input argument

round(x) Return the value of the argument rounded to the nearest integer The type of the result is always integer round(10.5) = 11 round(10.4) = 10 round(-10.5) = -11 round(-10.4) = -10

trunc(x) Return the value of the argument rounded to the nearest integer towards zero Or we could say everything after the decimal point is truncated trunc(10.9) = 10 trunc(-10.9) = 10