math in programming

88
8/10/2019 Math in Programming http://slidepdf.com/reader/full/math-in-programming 1/88 Marquez, Adonis Gamilla, Melchor Resource Speaker/s

Upload: leon-mills

Post on 02-Jun-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 1/88

Marquez, Adonis

Gamilla, MelchorResource Speaker/s

Page 2: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 2/88

Objective At the end of the course, the participants will

be able to:Identify relevant mathematical formulas; and

Perform simple computations as required in

shop operations.

Page 3: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 3/88

Course OutlineI. Basic Elements

 Arithmetic

Basic operations

Rounding off Numbers

II. Systems of Measurement System Internationale (SI or Metric)

English System (Imperial)

Page 4: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 4/88

Page 5: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 5/88

Course OutlineV. Trigonometry

Types of Angles and Triangles

Trigonometric Functions

Pythagorean Theorem

VI. Taper Taper Ratio

Taper Calculation

Page 6: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 6/88

Page 7: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 7/88

Basic Elements Arithmetic

Deals with the handling of numbers involving the

four basic operations such as:

 Addition

Subtraction

Multiplication

Division

Page 8: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 8/88

Basic Elements Algebra

Is an extension of arithmetic and deals with handling

numbers in terms of equations and formulas.

Typical usage will involve:

Square Roots

Powers of a Number

Trigonometric Functions

Solving Formulas and Equations

Variable Data

Page 9: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 9/88

Page 10: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 10/88

Basic ElementsSubtraction 

is a natural result of an addition

called the inverse operation of addition.

Multiplication

represents the idea of repeated addition.

Page 11: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 11/88

Basic ElementsProperties of Multiplication 

Division 

represents the idea of repeated subtraction.

It is most commonly thought as the inverse of Multiplication.

Property Name Property Sample

Commutative Property  A • B = B • A  5 • 8 = 8 • 5 

 Associative Property  A • (B • C) = (A • B) • C 6 • (4 • 5) = (6 • 4) • 5 

Identity Property  A • 1 = 1 • A = A 8 • 1 = 1 • 8 = 8 

Multiplication Property of

Zero

 A • 0 = 0 • A = 0  3 • 0 = 0 • 3 = 0 

Page 12: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 12/88

Page 13: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 13/88

Basic ElementsOrder of Operations

In the field of mathematics, there is a precisely defined

order in which the calculations are performed. In times where there are combination of various algebraic

operations, the order of calculation will follow these rules:

Multiplications and divisions are always calculated first;

 Additions and subtractions follow; and

 Any roots, powers and operations within a parentheses are

always calculated before and multiplications and divisions.

Page 14: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 14/88

Basic ElementsSample

Perform the following operations:

a. (3 + 5) • 5

b. 4 • 5 + 2 – 1

c. 30 ÷ 2 – 1 + 3

d. 23 + 2 • (4 ÷ 2)

Page 15: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 15/88

Page 16: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 16/88

Basic ElementsRules in Rounding Off Numbers

1. If the digit after that being retained is LESS than 5,

the retained digit is unchanged.Example:

Round off the following:

a. 27.73 to the nearest tenths

b. 254,400 to the nearest ten thousands

c. 944 to the nearest hundreds

Page 17: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 17/88

Page 18: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 18/88

Basic ElementsRules in Rounding Off Numbers

3. If the digit after that being retained is EQUAL to 5,

what follows determines how to round the number:

a. If there are no nonzero digits after the 5, the

retained digit is made even (round it up if it is odd).

b. If there are nonzero digits after the 5, the retained

digit is increased by one.

Page 19: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 19/88

Basic ElementsRules in Rounding Off Numbers

Example:

Round off the following:

a. 27.752 to the nearest tenths

b. 255,400 to the nearest ten thousands

c. 15.350 to the nearest ones

Page 20: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 20/88

Basic ElementsExercise

Round each to the nearest tens.

1. 122.67 3. 36.2 5. 19.232. 521.8 4. 57.59

Round each to the nearest hundreds

1. 2382.1  3. 312.645 5. 34.32. 5371 4. 2016.2

Round each to the nearest thousands

1. 12,392.1 3. 9,920 5. 6,821

2. 84,625.455  4. 2,001.6

Page 21: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 21/88

Page 22: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 22/88

Page 23: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 23/88

Metric and English UnitsEnglish Units (Imperial Units)

Typical conversions seen in Imperial units:

LENGTH

1 yard 3 feet

1 foot 12 inches

1 mi 1760 yds

1 mi 5280 ft

AREA

144 in2 1 ft2

43,560 ft2 1 acre

640 acres 1 mi2

VOLUME

57.75 in3 1 qt

4 qt 1 gal

42 gal 1 barrel

32 qt 1 bushel

MASS

437.5 grains 1 oz

16 oz 1 lb

2000 lb 1 short ton

Page 24: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 24/88

Metric and English UnitsSystem Internationale (SI or Metric System) 

Was developed in the 1790s by French scientists

It is comprise of seven base units and can be enlargeor reduce by a factor of 10

The factor of 10 can be represented by the use of

prefixes

 Approximately 90% of the world is using this form of

measurement

Page 25: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 25/88

Metric and English UnitsSystem Internationale (SI or Metric System) 

Base units of measurements are:

Kelvin (temperature)

Second (time)

Meter (length)

Gram (mass)

Candela (luminous intensity)

Mole (amt. of substance)

 Ampere (electric current)

Page 26: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 26/88

Metric and English UnitsSystem Internationale (SI or Metric System) 

Multiples

Name Kilo- Mega- Giga- Tera-

Prefix k M G T

Factor 100 103  106  109  1012 

Fractions

Name Centi- Milli- Micro- Nano- Pico-

Prefix c m μ  n p

Factor 100  10-2  10-3  10-6  10-9  10-12 

Page 27: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 27/88

Metric and English UnitsMetric to English (Vice Versa)

LENGTH

1 inch 2.54 cm1 meter 3.28 feet

1 ft 30.48 cm

1 mi 1.61 km

AREA

1 in2 6.45 cm2

1 mi2 2.59 km2

1 m2 10.76 ft2

VOLUME

1 gal 3.7854 li1 m3 1000 li

1 in3 16.39 cm3

1 m3 35.31 ft3

MASS

1 lb 453 g

1 kg 2.2 lb

1 ton 907 kg

Page 28: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 28/88

Metric and English UnitsUNIT CONVERSION

 A unit conversion expresses the same property as a

different unit of measurement.

 A conversion factor is a number used to change one set

of units to another, by multiplying or dividing.

When a conversion is necessary, the appropriate

conversion factor to an equal value must be used.

For example, to convert inches to feet, the appropriate

conversion value is 12 inches equal 1 foot.

Page 29: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 29/88

Metric and English UnitsUNIT CONVERSION

 A unit cancellation table is developed by using known units,

conversion factors, and the fact that a unit of measure ÷  the

same unit of measure cancels out that unit.

The table is set up so all the units cancel except for the unit

desired.

To cancel a unit, the same unit must be in the numerator and in

the denominator.

When you multiply across the table, the top number will be

divided by the bottom number, and the result will be the answerin the desired units. 

Page 30: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 30/88

Metric and English UnitsUNIT CONVERSION

Sample: Convert 3 yards to meters

3 yards 3 feet 

1 yard 

1 meter

3.28 feet   2.74= meters

Page 31: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 31/88

Page 32: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 32/88

Metric and English UnitsExercise

Convert the following:

1. 600 g to lb

2. 1.75 gal to mL

3. 2 ton to kg

4. 40 cm to yards5. 0.75 km to in

6. 10 kg to oz

7. 1.3 barrel to in3 

8. 1550 m2 to acre

9. 1300 g to lb10. 150 m2 to in3 

Page 33: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 33/88

Page 34: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 34/88

GeometryThree entities in engineering drawing:

Points

Lines

Circles and Arcs

Page 35: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 35/88

Page 36: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 36/88

GeometryPlane

 A Plane extends in two dimensions.

It is usually represented by a shape that lookslike a tabletop or wall. 

Collinear

are points that lie on the same line.

Coplanar

are points that lie on the same plane.

Page 37: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 37/88

GeometrySample:

1. Name three points that are collinear.

2. Name four points that are coplanar.

3. Name three points that are not collinear.

Page 38: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 38/88

Geometry Arcs

 Are curved elements that have at least a

center or radius.Circles

Is a mathematical curve, where every point on

the curve has the same distance from a fixedpoint.

This fixed point is called a center point.

Page 39: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 39/88

GeometryTerms used in Circles:

 Arc – is any part of the circle between two points on the

circumference of the circle.

Circumference – is the length of the circle.

Chord  –  is a straight line joining any two points on the

circumference of a circle.

Page 40: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 40/88

GeometryParts of a Circle:

Circumference

 Arc

Center Point

Page 41: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 41/88

Page 42: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 42/88

GeometryTerms used in Circles:

Sector

Segment

Page 43: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 43/88

GeometryPI ConstantIs a Greek letter used in mathematics to represent the

ratio of the circle circumference to the diameter.

Its symbol is represented by  

Its numerical value is 3.1416

Page 44: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 44/88

Page 45: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 45/88

Page 46: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 46/88

GeometryQuadrants

IVIII

II I

Page 47: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 47/88

GeometryConcentric Circles Are circles that have the same center point.

Just because a circle is inside another circle doesn'tmean they are concentric, they must have the same

point as their center.

Page 48: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 48/88

GeometryPolygon

Is a common geometric element defined by a

number of straight line segments that are joined at each end point.

Page 49: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 49/88

GeometryPolygon

Common terms in polygons are the words

inscribed and circumscribed.

CircumscribedInscribed

Page 50: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 50/88

GeometryCommon Polygon

Number of Sides Common Name

3 Triangle

4 Square

5 Pentagon

6 Hexagon

7 Heptagon

8 Octagon

9 Nonagon

10 Decagon

12 Dodecagon

n N-gon

Page 51: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 51/88

Page 52: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 52/88

Coordinate SystemTypes of Coordinate System

Rectangular Coordinates

Relative Coordinates

Polar Coordinates

Page 53: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 53/88

Coordinate SystemRectangular Coordinates

 Also known as the Cartesian plane which was

developed by Rene Descartes

The vertical line represents the Y-axis while the

horizontal line represents the X-axis.

The point where the two lines intersect is called

the origin.

Page 55: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 55/88

Coordinate SystemRectangular Coordinates

There are four distinct areas of the Cartesian plane.

We name them quadrants because there are four of

them

Each one has its own number, which we write as a

roman numeral. That is, quadrants I (1), II (2), III (3)and IV (4).

Page 56: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 56/88

Coordinate SystemParts of Cartesian Plane 

X-AXIS

 Y-AXIS

ORIGIN

Quadrant I

Quadrant IVQuadrant III

Quadrant II

Page 57: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 57/88

Coordinate SystemRectangular Coordinates

The X coordinate is the horizontal distance from the y-axis.

if the horizontal distance is on the left side of the y-axisthe sign convention should be negative and if it is onthe right side of the y-axis it should be positive.

The Y coordinate is the vertical distance from the x-

axis.

if the vertical distance is on the lower side of the x-axisthe sign convention should be negative and if it is onthe upper side of the x-axis it should be positive.

Page 58: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 58/88

Coordinate SystemParts of Cartesian Plane 

X-AXIS

 Y-AXIS

ORIGIN

Quadrant I

Quadrant IVQuadrant III

Quadrant II

( + , - )( - , - )

( + , + )( - , + )

Page 59: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 59/88

Page 60: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 60/88

Page 61: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 61/88

Page 62: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 62/88

Coordinate SystemPolar Coordinates

Is a two dimensional coordinate system which

is determined through the use of radii (R) andangles (θ).

This particular coordinate system is useful the

CNC drilling cycles.

Page 63: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 63/88

Coordinate SystemPolar Coordinates 

the radius can be obtained through

Pythagorean theorem:

The angle origin is located at the positive x axis, if

the angle opens CCW it is positive if it opens CW it

is negative.

R = x + y 

Page 65: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 65/88

Coordinate SystemRelating Polar to Rectangular Coordinates: 

Polar coordinates can be converted into rectangular

coordinates and vice versa, this is done by means ofdetermine the relationship of the sides with the angle.

θ 

x

Ry

The relationships are:

 Y = R sin θ 

 X = R cos θ 

Page 66: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 66/88

Page 67: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 67/88

TrigonometryTriangle/sIs the most common geometrical entity in CNC

programming. Are also integrated in polygons

 Always has three (3) sides but does not needto have equal length nor angles.

Types of triangle are divided into two parts

 Angle

Length of Sides

Page 68: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 68/88

TrigonometryTypes of Triangles (Angles)

a. Right Triangle One of the angles is equal to 90o

 A < 90o

B < 90o

C = 90o

 A

B

C

Page 69: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 69/88

TrigonometryTypes of Triangles (Angles)

b.  Acute Triangle The angles are greater than 0o and smaller than

90o.

 A < 90o

B < 90o

C < 90o

B

C A

Page 70: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 70/88

TrigonometryTypes of Triangles (Angles)

c. Obtuse Triangle One of the angles is greater than 90o but smaller

than 180o

 A < 90o

B > 90o

C < 90o

B

 A C

Page 71: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 71/88

TrigonometryTypes of Triangles (Sides)

a. Equilateral Triangle  All sides of the triangle are equal also all angles

are equal to 60o

a = b = c A = B = C = 60o 

B

 A C

a

b

c

Page 72: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 72/88

TrigonometryTypes of Triangles (Sides)

b. Isosceles Triangle Two sides of the triangle are equal also their

corresponding angle are also equal 

Side a = c Angle A = C 

B

 A C

a

b

c

Page 73: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 73/88

TrigonometryTypes of Triangles (Sides)

c.Scalene Triangle  All of the sides have different length and all the

angles are different as well

Side a ≠ b ≠ c 

 Angle A + B + C = 180o

B

 A C

a

b

c

Page 74: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 74/88

TrigonometrySolving Similar Triangles 

W

L

UH

 =

 

Page 75: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 75/88

TrigonometryTrigonometric Functions

Shows the relationships of the legs of the

triangle to their corresponding angles.

Main trigonometric functions (TF) are:

Sin-Opposite-Hypotenuse (SOH)

Cos-Adjacent-Hypotenuse (CAH)

Tan-Opposite-Adjacent (TOA)

Page 76: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 76/88

TrigonometryTrigonometric Functions

Parts of the Triangle to consider in TF

C

B

 A

   S   i   d  e

   (  a   )

Side (b)

Page 77: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 77/88

Page 78: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 78/88

TrigonometryPythagorean Theorem Is a well known formula to get the relationships of the

sides of a right triangles

C

B

 A

   S   i   d  e   (  a   )

Side (b)

General Formula : c = a + b 

c = a

+ b

 

a = c − b 

b = c − a 

Page 79: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 79/88

TrigonometrySine Law and Cosine Law

If the triangle is no longer a right triangle the

Pythagorean theorem is no longer applicable for itwould present error in the computation.

be used to compute the remaining sides of a triangle

when two angles and a side are known a techniqueknown as triangulation

Page 80: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 80/88

Page 81: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 81/88

TrigonometryCosine Law 

C

B

 Ab

c a

a = b + c   − 2bc cos A 

b = a + c   − 2ac cos B 

c = a + b   − 2ab cos C 

Page 82: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 82/88

Page 83: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 83/88

Page 84: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 84/88

Taper CalculationsTapers

d

L

D

1 : X

Page 85: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 85/88

Taper CalculationsTaper Ratio Is defined as the ratio of the difference between the

large and small diameter over the given length of thecone.

For example we have a taper ratio of 1:5, this means

that in every 5 mm length there will be a 1 mm

increase in the diameter.

1

X

=D − d

L

 

Page 86: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 86/88

Taper CalculationsTaper CalculationsTo calculate the small diameter d, with D, L and X:

To calculate the large diameter D, with d, L and X:

d = D −L

D = d +L

Page 87: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 87/88

Taper CalculationsTaper CalculationsTo calculate the length L, when D, d and X are known:

To calculate the ratio X, with d, D and L:

L = D − d × X 

X =L

D − d 

Page 88: Math in Programming

8/10/2019 Math in Programming

http://slidepdf.com/reader/full/math-in-programming 88/88