MATHEMATICAL / NUMERICAL FUNCTIONS

Similar documents
Macro Programming Reference Guide. Copyright 2005 Scott Martinez

Phụ lục 2. Bởi: Khoa CNTT ĐHSP KT Hưng Yên. Returns the absolute value of a number.

Long (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000.

Table of Contents. PREFACE... vii CONVENTIONS... vii HOW TO USE THIS MANUAL... vii Further Information...viii

(Type your answer in radians. Round to the nearest hundredth as needed.)

SCIENTIFIC CALCULATOR OPERATION GUIDE < EL-531TG/531TH/531TS >

CSI31 Lecture 5. Topics: 3.1 Numeric Data Types 3.2 Using the Math Library 3.3 Accumulating Results: Factorial

Section 14: Trigonometry Part 1

static int min(int a, int b) Returns the smaller of two int values. static double pow(double a,

6-1 (Function). (Function) !*+!"#!, Function Description Example. natural logarithm of x (base e) rounds x to smallest integer not less than x

Basic types and definitions. Chapter 3 of Thompson

The Math Class (Outsource: Math Class Supplement) Random Numbers. Lab 06 Math Class

2001 PET POCKET REFERENCE GUIDE TO COMMODORE'S LEADING EDGE COMPUTER PRODUCTS. ~ COPYRIGHT 1979, LEADING EDGE CO. ALL RIGHTS RESERVED

Using the um-fpu with the Javelin Stamp

Programming in QBasic

Trigonometric Functions of Any Angle

Long (LONGMATH) variables may be used the same as short variables. The syntax is the same. A few limitations apply (see below).

Secondary Math 3- Honors. 7-4 Inverse Trigonometric Functions

Program Workspace. Why numerical methods? Problem examples Why programming? Why numerical methods and programming? Why VBA?

Function Example. Function Definition. C Programming. Syntax. A small program(subroutine) that performs a particular task. Modular programming design

1001ICT Introduction To Programming Lecture Notes

MYSQL NUMERIC FUNCTIONS

Chapter 3 - Functions

Math General Angles, Radian Measure, measures of arcs and sectors

Single row numeric functions

Excel Tool: Calculations with Data Sets

How to Design Programs Languages

Introduction to Computer Programming in Python Dr. William C. Bulko. Data Types

The Graphing Calculator

: Find the values of the six trigonometric functions for θ. Special Right Triangles:

Final Exam: Precalculus

Python Numbers. Learning Outcomes 9/19/2012. CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17

DEPARTMENT - Mathematics. Coding: N Number. A Algebra. G&M Geometry and Measure. S Statistics. P - Probability. R&P Ratio and Proportion

Operators Functions Order of Operations Mixed Mode Arithmetic VOID Data. Syntax and type conventions Using the Script window interface

VBScript: Math Functions

Introduction to Programming

GREENWOOD PUBLIC SCHOOL DISTRICT Algebra III Pacing Guide FIRST NINE WEEKS

Graphics calculator instructions

10 Using the PCFL Editor In this chapter

C++, How to Program. Spring 2016 CISC1600 Yanjun Li 1

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Methods: A Deeper Look

A Quick Review of Trigonometry

SM 2. Date: Section: Objective: The Pythagorean Theorem: In a triangle, or

Green Globs And Graphing Equations

CS-201 Introduction to Programming with Java

C Functions. 5.2 Program Modules in C

Downloaded from Chapter 2. Functions

PA R T. A ppendix. Appendix A VBA Statements and Function Reference

ECET 264 C Programming Language with Applications

C++ PROGRAMMING SKILLS Part 3 User-Defined Functions

A trigonometric ratio is a,

CT 229 Java Syntax Continued

The Math Class. Using various math class methods. Formatting the values.

Warm-Up Up Exercises. Use this diagram for Exercises If PR = 12 and m R = 19, find p. ANSWER If m P = 58 and r = 5, find p.

FAQ No. 53. ihost: Logic Points. Roles and Privileges. Adding and removing logic points. Accessing and using the Logic Editor

Welcome. Please Sign-In

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed

Math 144 Activity #2 Right Triangle Trig and the Unit Circle

4.7a Trig Inverses.notebook September 18, 2014

Choose the correct answer below. 2. Convert the angle to a decimal in degrees.

Chapter 4: Triangle and Trigonometry

College Technical Math 2

TABLE 2: Mathematics College Readiness Standards for Score Range 13 15

FANF. programming language. written by Konstantin Dimitrov. Revision 0.1 February Programming language FANF 1 / 21

UNIT 5 TRIGONOMETRY Lesson 5.4: Calculating Sine, Cosine, and Tangent. Instruction. Guided Practice 5.4. Example 1

4.1: Angles & Angle Measure

MATHEMATICS SYLLABUS SECONDARY 5th YEAR

Math for Geometric Optics

1. The Pythagorean Theorem

MODULE 7: VARIABLES & STRINGS

Chapter 3 Mathematical Functions, Strings, and Objects

Active Planner. How to Create and Use Database Query Formulas

ME1107 Computing Y Yan.

Objectives: After completing this section, you should be able to do the following: Calculate the lengths of sides and angles of a right triangle using

Level 4 means that I can

FOUNDATION HIGHER. F Autumn 1, Yr 9 Autumn 2, Yr 9 Spring 1, Yr 9 Spring 2, Yr 9 Summer 1, Yr 9 Summer 2, Yr 9

Trigonometric Functions. Copyright Cengage Learning. All rights reserved.

Graphing Calculator Tutorial

Scope and Sequence Mathematics Kindergarten through Twelfth Grade

Software installation

Trigonometry is concerned with the connection between the sides and angles in any right angled triangle.

Amphitheater School District End Of Year Algebra II Performance Assessment Review

MTH 120 Fall 2007 Essex County College Division of Mathematics Handout Version 6 1 October 3, 2007

2.2 Limit of a Function and Limit Laws

11.4 CIRCUMFERENCE AND ARC LENGTH 11.5 AREA OF A CIRCLE & SECTORS

LAB 1 General MATLAB Information 1

Properties of a Circle Diagram Source:

College Technical Mathematics 1

List of NEW Maths content

Math 144 Activity #3 Coterminal Angles and Reference Angles

You can take the arccos of both sides to get θ by itself.

YEAR 12 Core 1 & 2 Maths Curriculum (A Level Year 1)

3.4 System Dynamics Tool: Nova Tutorial 2. Introduction to Computational Science: Modeling and Simulation for the Sciences

Sum and Difference Identities. Cosine Sum and Difference Identities: cos A B. does NOT equal cos A. Cosine of a Sum or Difference. cos B.

G r a d e 1 0 I n t r o d u c t i o n t o A p p l i e d a n d P r e - C a l c u l u s M a t h e m a t i c s ( 2 0 S )

6.8 Sine ing and Cosine ing It

EASON BASIC USERS GUIDE

Goals for This Lecture:

Introduction to C Language

Transcription:

MATHEMATICAL / NUMERICAL FUNCTIONS Function Definition Syntax Example ABS (Absolute value) ASC It returns the absolute value of a number, turning a negative to a positive (e.g. - 4 to 4) It returns the ASCII code for the first character in a string N = ABS (numerical expression) N = The numeric variable. numerical expression = The numeric value whose absolute value we want. ASC(stringexpression$) stringexpression$ = Any string of ABS function. N=ABS(-44) PRINT N 44 of ASC function. PRINT ASC("ry") 144 CDBL CHR$ It converts a numeric expression to a Doubleprecision floating-point value (that is, more digits to the right of the decimal point than a singleprecision number). It is a computer number format that occupies 8 bytes (64 bits) in computer memory and represents a wide, dynamic range of values by using a floating point. It converts an ASCII code into its corresponding character. CDBL(numeric-expression) numeric-expression = Any CHR$(Numeric Variable) Numeric Variable= the ASCII code whose corresponding character has to be found of CDBL function. PRINT 1 / 7 142857142857143 Q. Write a program to see the result of CHR$ function. a = 68 PRINT CHR$(a) D CINT CSNG It rounds off the fractional part of the numeric expression and changes it into an integer. It converts a numeric expression to a singleprecision value.( Singleprecision floating-point format is a computer number format that occupies 4 bytes (32 bits) in computer memory and N = CINT(Numeric Expression) N=Numeric variable. Numerical Expression = The floating point value/the real number that will be converted to an integer. CSNG(numeric-expression) numeric-expression = Any of CINT function. N = CINT(64.6) PRINT N 65 of CSNG function. PRINT CSNG(975.3422715#) 975.3423

represents a wide dynamic range of values by using a floating point.) EXP It returns the exponential of a number to the base e(2.71828..). EXP(X) X is a value. Exponential function raises e to the value X. i.e. e^x of EXP function. PRINT EXP(3) 20.08554 FIX It removes the fractional part of a real number and return the integer portion / factorial part. If number is negative, Fix returns the first negative integer greater than or equal to number. X = INT (Numerical Expression) X = The numeric variable. Numerical Expression = The floating point value/the real number whose integer part we want. of FIX function. X = FIX(64.5) X=FIX(-64.5) 64-64 HEX$ It returns a hexadecimal string representation of a number. HEX$(numeric-expression&) numeric-expression& is any of HEX$ function. INPUT a b$ = HEX$ (a) PRINT a; "decimal is "; b$ ;" hexadecimal"?135 135 decimal is 87 hexadecimal INT (Integer) It returns only the integer portion/factorial part of a real number. If number is negative, Int returns the first negative integer less than or equal to number. Numeric Variable = FIX(Numeric Expression) X = The numeric variable. Numerical Expression = The floating point value/the real number whose integer part we want. of INT function. X = INT(64.5) X=INT(-64.5) 64-65 LOG It returns the natural logarithm of a numeric LOG(numeric-expression) numeric-expression Any positive numeric

MOD (Modulo or Modulus) It returns the integer remainder. A= Numeric-expression1 MOD Numeric-expression2 A=Numeric variable/remainder. of MOD function. x = 9 MOD 3 X=9 MOD 2.6 X=9.6 MOD 3 PRINT x Numeric-expression1= is the numerator 0 0 1 Numeric-expression2 = is the divisor OCT$ It returns an octal string representation of a number. Real number numeric expressions are rounded to integers. OCT$(numeric-expression&) of OCT$ function. numeric-expression& is any INPUT a b$ = OCT$ (a) PRINT a; "decimal is "; b$ ; " octal"?64 64 decimal is 100 octal SGN It returns a value indicating the sign of a numeric If expression is positive, it turns + 1. If expression is negative, it turns 1. A=SGN(numeric expression) of SGN function. x = SGN (-12) X= SGN (12) X=SGN (0) PRINT x -1 1 0 SPC If expression is zero, it turns 0. It skips a specified number of spaces when used with the PRINT and the LPRINT statement. SPC(n) n is the number of spaces to skip. n must be within the range of 0 through 32,767. of SPC function. PRINT "QBASIC"; SPC(15); "Programming language" QBASIC Programming language SQR (Square Root) It returns the square root of the value represented by the Variable. N = SQR (numerical expression) N = The numeric variable. numerical expression = The numeric value whose square root value we want. of SQR function. N = SQR(64) PRINT N 8

TAB It moves the text cursor to a specified print position. TAB(column%) of TAB function. column% is the column number of the new print position. INPUT "My name is"; a$ PRINT TAB(20); a$ My name is? Ria Ria Trigonometric functions COS It is a Trigonometric function which computes the cosine of an angle measured in radians. SIN It is a Trigonometric function which computes the sine of an angle measured in radians A=COS(numeric expression) A= Numeric variable(cosine of the angle) Numeric expression=the angle expressed in radians. To convert degrees to radians use the formula: Radian = degree*(pi/180) where, Pi=3.14 A=SIN(numeric expression) A= Numeric variable(cosine of the angle) Numeric expression=the angle expressed in radians. To convert degrees to radians use the formula: Radian = degree*(pi/180) where, Pi=3.14 of COS function. P = COS(R) PRINT "Cosine of"; a; "degree is "; P Cosine of 30 degree is.8661581 of SIN function. P = SIN(R) PRINT "Sine of"; a; "degree is "; P Sine of 30 degree is.4997701 TAN It is a Trigonometric function which computes the tangent of an angle measured in radians. A=TAN(numeric expression) A= Numeric variable(cosine of the angle) Numeric expression=the angle expressed in radians. To convert degrees to radians use the formula: Radian = degree*(pi/180) where, Pi=3.14. Pi is the ratio between circumference and diameter shared by all circles. of TAN function. P = TAN(R) PRINT "Tangent of"; a; "degree is "; P Tangent of 30 degree is.5769964 ATN It is the inverse Trigonometric function of Tan. The ATN or arctangent function returns the angle in radians of a numerical tangent value. radian_angle = ATN(tangent) of ATN function. P = TAN(R)

PRINT "Tangent of"; a; "degree is "; P radian = ATN(P) PRINT " Arctangent="; radian Tangent of 30 degree is.5769964 Arctangent=.5233333 RND Function RND It returns a single precision random number between 0 & 1. RND[(n#)] Q. Examples are discussed below. n# is a value that sets how These numbers are decimal RND generates the next numbers. random number. To get integers use INT function. n# RND returns Example n#<0 The same number for any n#. Result=RND(-2) n#>0 The sequence of numbers generated will not change unless RANDOMIZE Result=RND(2) is initiated. n#=0 The last number generated. Result=RND(0) n# is omitted The next random number. Result=RND To get values in a range smaller than 1: FOR x = 1 TO 5 PRINT RND To get values in a range larger than 1: Multiply RND with a number to get return up to but not including the numerical value. To get values starting at a certain number: Add that number to the RND. To get an integer range of numbers: randnum%=int(rnd*max%)+min% To get an closest integer range of numbers: randnum%=cint(rnd*(max%-min%))+min% FOR x = 1 TO 5 PRINT RND * 10 FOR x = 1 TO 5 PRINT RND + 2 PRINT INT(RND * 30 )+ 12 [returns an integer from 12 to 31 (30+12-1)] PRINT CINT(RND*(30-12)) + 12 To get different random number results each time a program runs use: RANDOMIZE TIMER Here's a program that rolls two dice and prints the value of each. RANDOMIZE TIMER PRINT (RND * 12) + 2 RANDOMIZE TIMER PRINT INT(RND * 12) + 2

RANDOMIZE TIMER INPUT "Press ENTER to roll dice...", A$ PRINT Die1 = INT(RND * 6 + 1) Die2 = INT(RND * 6 + 1) PRINT "Die 1: "; Die1 PRINT "Die 2: "; Die2