3 Arithmetic functions

37
3 Arithmetic functions Introduction to arithm etic Basic functions (+, -, *, /) Combining operations Trigonometry functions Presentation links page for lesson three Square root Absolute value ROUND FIX FUP (rounding functions) Priority of arithmetic o perators Example

description

Presentation links page for lesson three. 3 Arithmetic functions. Introduction to arithmetic. Basic functions (+, -, *, /). Combining operations. Trigonometry functions. Square root Absolute value. ROUND FIX FUP (rounding functions). Priority of arithmetic operators. Example. - PowerPoint PPT Presentation

Transcript of 3 Arithmetic functions

Page 1: 3    Arithmetic functions

3 Arithmetic functionsIntroduction to arithmeticBasic functions (+, -, *, /)Combining operationsTrigonometry functions

Presentation links page for lesson three

Square root Absolute valueROUND FIX FUP (rounding functions)Priority of arithmetic operatorsExample

Page 2: 3    Arithmetic functions

Introduction To Arithmetic

AddSubtractMultiplyDivideSquare rootLogarithmsSineCosineTangentArc tangentRounding

Just about anything that can be done on a scientific calculator can be done in a custom macro program

Page 3: 3    Arithmetic functions

Introduction To Arithmetic

23223 times 23

23323 times 23 times 23

For those functions that are not included in custom macro:

You can usually come up with a way to calculate longhand

Square:

Cube:

Page 4: 3    Arithmetic functions

Basic arithmetic operations

= /*-+#100 = 4.#101 = 2+2#102 = 5-1#103 = 2*2#104 = 8/2

Equality Add Subtract Multiply Divide

Variable #100 equals 4 in all expressions

Page 5: 3    Arithmetic functions

Combining operations

#101 = 4 + 3 * 26

10

14

You can combine operations into an expressionMultiplication has a higher priority than addition

Again, multiplication is done first – otherwise the result would be 14

Page 6: 3    Arithmetic functions

Combining operations

#101 = [4 + 3] * 27

14More on

brackets later

If you want to force the addition to be done first, use brackets to surround the addition operation

Page 7: 3    Arithmetic functions

Trigonometry Functions

Sine

#101 = SIN[30]

Result:#101 is set equal to 0.5

Page 8: 3    Arithmetic functions

Trigonometry Functions

Sine

45 deg

2.5R

#101

#101 = SIN[45] * 2.5

Y component of hole location

Page 9: 3    Arithmetic functions

Trigonometry Functions

Cosine

#101 = COS[30]

Result:#101 is set equal to 0.86602

Page 10: 3    Arithmetic functions

Trigonometry Functions

Cosine

45 deg

2.5R

#101

#101 = COS[45] * 2.5

X component of hole location

Page 11: 3    Arithmetic functions

Trigonometry Functions

Arc cosine

#101 = ACOS[.86602]

Result:#101 is set equal to 30

Page 12: 3    Arithmetic functions

Trigonometry Functions

Arc cosine

#103 = ACOS[#102/#101]

?

#101

#102

Angle neededSide adjacent and hypotenuse known

Page 13: 3    Arithmetic functions

Trigonometry Functions

Tangent

#101 = TAN[30]

Result:#101 is set equal to 0.5773

Page 14: 3    Arithmetic functions

Trigonometry Functions

Tangent10

1.5

?

#101 = TAN[10] * 1.5

Side opposite neededAngle and side adjacent known

Page 15: 3    Arithmetic functions

Trigonometry Functions

Arc tangent

#101 = ATAN[.5] / [.75]

Result:#101 is set equal to 33.6874

Page 16: 3    Arithmetic functions

Trigonometry Functions

Arc tangent

#103 = ATAN[#101] / [#102]

?

#102

#101

Angle neededSide adjacent and side opposite known

Page 17: 3    Arithmetic functions

Square Root

#101 = SQRT[9]

Result:#101 is set equal to 3.0

Page 18: 3    Arithmetic functions

Square Root

a

b

c

22 2c a b= +

#103=SQRT[#101*#101 + #102*#102]

#101

#102

Pythagorean theorem

Page 19: 3    Arithmetic functions

Absolute Value

#101 = ABS[2-5]

Result:#101 is set equal to 3.0

Absolute value renders unsigned (positive) value

Page 20: 3    Arithmetic functions

Absolute Value

O1000...G01 Z-[ABS[#26]] F4.5

Z

G65 P1000 … Z1.0 ...Z-1.0

?User could enter positive or negative valueResult is Z-1.0, regardless of entry polarity

Page 21: 3    Arithmetic functions

Rounding

#101 = ROUND[3.2]

#101 = ROUND[3.8]

#101 is set to 3

#101 is set to 4

Result is next closest integer

Page 22: 3    Arithmetic functions

Rounding

#19

#7

#101=ROUND[#19/#7]#7=#19/#101

Rounding is helpful when determining the number of passes

Page 23: 3    Arithmetic functions

Rounding

0.85

0.25

Page 24: 3    Arithmetic functions

Rounding

0.85

0.25#17

#7

#101 = ROUND[#7/#17] (3 passes)#17 = #7/#101 (0.2833)

This renders three even

passes of 0.2833 each

Recalculated depth per peck ensures consistent depth per peck

Page 25: 3    Arithmetic functions

0.69

0.125#17

#7

#101 = ROUND[#7/#17] (6 passes)#17 = #7/#101 (0.115)

This renders six even passes

of 0.115 each

Rounding

Page 26: 3    Arithmetic functions

Rounding

#26

#17

#101= ROUND[#26/#17]

#17= #26 / #101

Use ROUND when you don’t care if the

recalculated depth of cut is greater or less

than the initial specification

Page 27: 3    Arithmetic functions

Round Down (FIX)

#101 = FIX[3.8]

#101 is set to 3

FIX rounds down to next lower integer

Page 28: 3    Arithmetic functions

Round Down (FIX)

0.69

0.125#17

#7

#101 = FIX[#7/#17] (5)#17 = #7/#101 (0.138)

=> original doc

Use FIX when you want to specify a

MINIMUM depth of cut. The recalculated

depth will always be GREATER than the

specified value.

Page 29: 3    Arithmetic functions

Round Up (FUP)

#101 = FUP[3.2]

#101 is set to 4

FUP rounds up to next higher integer

Page 30: 3    Arithmetic functions

Round Up (FUP)

0.69

0.125#17

#7

#101 = FUP[#7/#17] (6)#17 = #7/#101 (0.115)

=< original doc

Use FUP when you want to specify a

MAXIMUM depth of cut. The recalculated

depth will always be LESS than the

specified value.

Page 31: 3    Arithmetic functions

Priority Of Arithmetic Operations

[ ]1)Functions2)* then /3)+ then -4)

Here is the full priority of arithmetic operationsAnything in brackets will be done firstHigher level functions (sine, cosine, etc) done secondMultiplication and division done thirdAddition, then subtraction are done last

Page 32: 3    Arithmetic functions

Priority Of Arithmetic Operations

#102 = COS[#1] * [#18 + #20]12

3Example

Page 33: 3    Arithmetic functions

Example

Fixed jaw

moving jaw

Workpiece

Center Y position changes based upon diameter

A vise has a fixed jaw and moving jawWorkpiece Y center position varies based upon diameter…

Page 34: 3    Arithmetic functions

Example

Fixed jaw

moving jaw

Workpiece

Center Y position changes based upon diameter

…small workpiece…

Page 35: 3    Arithmetic functions

Example

Fixed jaw

moving jaw

Workpiece

Center Y position changes based upon diameter

…large workpiece

Page 36: 3    Arithmetic functions

Example

Fixed jaw

moving jaw

Workpiece

X0 Y0

dia

45

dia/2

[dia/d] / COS[45]

Center Y position changes based upon diameter

Formula to determine Y center position

Page 37: 3    Arithmetic functions

Center Y position changes based upon diameter

Example

Fixed jaw

moving jaw

Workpiece

X0 Y0

dia

45

dia/2

[dia/d] / COS[45]

O0001 (Custom macro B)#101=3.25 (diameter)..G00 X0 Y-[#101/2 / COS[45]].....

Related custom macro commands