410 likes | 726 Views
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.
E N D
Presentation links page for lesson three 3 Arithmetic functions Introduction to arithmetic Basic functions (+, -, *, /) Combining operations Trigonometry functions Square root Absolute value ROUNDFIXFUP(rounding functions) Priority of arithmetic operators Example
Introduction To Arithmetic Just about anything that can be done on a scientific calculator can be done in a custom macro program Add Subtract Multiply Divide Square root Logarithms Sine Cosine Tangent Arc tangent Rounding
23 23 2 3 Introduction To Arithmetic For those functions that are not included in custom macro: Square: 23 times 23 Cube: 23 times 23 times 23 You can usually come up with a way to calculate longhand
Basic arithmetic operations Equality Add Subtract Multiply Divide = + - / * #100 = 4. #101 = 2+2 #102 = 5-1 #103 = 2*2 #104 = 8/2 Variable #100 equals 4 in all expressions
10 Combining operations You can combine operations into an expression Multiplication has a higher priority than addition 6 #101 = 4 + 3 * 2 14 Again, multiplication is done first – otherwise the result would be 14
14 Combining operations If you want to force the addition to be done first, use brackets to surround the addition operation #101 = [4 + 3] * 2 7 More on brackets later
Trigonometry Functions Sine #101 = SIN[30] Result: #101 is set equal to 0.5
#101 45 deg 2.5R Trigonometry Functions Y component of hole location Sine #101 = SIN[45] * 2.5
Trigonometry Functions Cosine #101 = COS[30] Result: #101 is set equal to 0.86602
#101 45 deg 2.5R Trigonometry Functions X component of hole location Cosine #101 = COS[45] * 2.5
Trigonometry Functions Arc cosine #101 = ACOS[.86602] Result: #101 is set equal to 30
#101 ? #102 Trigonometry Functions Angle needed Side adjacent and hypotenuse known Arc cosine #103 = ACOS[#102/#101]
Trigonometry Functions Tangent #101 = TAN[30] Result: #101 is set equal to 0.5773
? 10 1.5 Trigonometry Functions Side opposite needed Angle and side adjacent known Tangent #101 = TAN[10] * 1.5
Trigonometry Functions Arc tangent #101 = ATAN[.5] / [.75] Result: #101 is set equal to 33.6874
#101 ? #102 Trigonometry Functions Angle needed Arc tangent Side adjacent and side opposite known #103 = ATAN[#101] / [#102]
Square Root #101 = SQRT[9] Result: #101 is set equal to 3.0
c a b 2 2 2 c = a + b Square Root Pythagorean theorem #101 #102 #103=SQRT[#101*#101 + #102*#102]
Absolute Value Absolute value renders unsigned (positive) value #101 = ABS[2-5] Result: #101 is set equal to 3.0
Z Absolute Value User could enter positive or negative value Result is Z-1.0, regardless of entry polarity ? Z-1.0 G65 P1000 … Z1.0 ... O1000 . . . G01 Z-[ABS[#26]] F4.5
Rounding Result is next closest integer #101 = ROUND[3.2] #101 is set to 3 #101 = ROUND[3.8] #101 is set to 4
#19 #7 Rounding Rounding is helpful when determining the number of passes #101=ROUND[#19/#7] #7=#19/#101
0.25 0.85 Rounding
0.25 0.85 Rounding Recalculated depth per peck ensures consistent depth per peck #17 This renders three even passes of 0.2833 each #7 #101 = ROUND[#7/#17] (3 passes) #17 = #7/#101 (0.2833)
0.125 0.69 Rounding #17 This renders six even passes of 0.115 each #7 #101 = ROUND[#7/#17] (6 passes) #17 = #7/#101 (0.115)
#17 #26 Rounding #101= ROUND[#26/#17] Use ROUND when you don’t care if the recalculated depth of cut is greater or less than the initial specification #17= #26 / #101
Round Down (FIX) FIX rounds down to next lower integer #101 = FIX[3.8] #101 is set to 3
0.125 0.69 => original doc Round Down (FIX) #17 Use FIX when you want to specify a MINIMUM depth of cut. The recalculated depth will always be GREATER than the specified value. #7 #101 = FIX[#7/#17] (5) #17 = #7/#101 (0.138)
Round Up (FUP) FUP rounds up to next higher integer #101 = FUP[3.2] #101 is set to 4
0.125 0.69 =< original doc Round Up (FUP) #17 Use FUP when you want to specify a MAXIMUM depth of cut. The recalculated depth will always be LESS than the specified value. #7 #101 = FUP[#7/#17] (6) #17 = #7/#101 (0.115)
1) 2) 3) 4) [ ] Functions * then / + then - Priority Of Arithmetic Operations Here is the full priority of arithmetic operations Anything in brackets will be done first Higher level functions (sine, cosine, etc) done second Multiplication and division done third Addition, then subtraction are done last
3 1 2 Priority Of Arithmetic Operations Example #102 = COS[#1] * [#18 + #20]
Fixed jaw Workpiece moving jaw Example A vise has a fixed jaw and moving jaw Workpiece Y center position varies based upon diameter… Center Y position changes based upon diameter
Fixed jaw moving jaw Example …small workpiece… Center Y position changes based upon diameter Workpiece
Fixed jaw moving jaw Example …large workpiece Center Y position changes based upon diameter Workpiece
X0 Y0 Fixed jaw dia moving jaw Example Formula to determine Y center position Center Y position changes based upon diameter [dia/d] / COS[45] 45 dia/2 Workpiece
Fixed jaw dia moving jaw Example Related custom macro commands Center Y position changes based upon diameter O0001 (Custom macro B) #101=3.25 (diameter) . . G00 X0 Y-[#101/2 / COS[45]] . . . . . X0 Y0 [dia/d] / COS[45] 45 dia/2 Workpiece