3 Arithmetic functions
-
Upload
rhea-dodson -
Category
Documents
-
view
35 -
download
4
description
Transcript of 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
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
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:
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
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
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
Trigonometry Functions
Sine
#101 = SIN[30]
Result:#101 is set equal to 0.5
Trigonometry Functions
Sine
45 deg
2.5R
#101
#101 = SIN[45] * 2.5
Y component of hole location
Trigonometry Functions
Cosine
#101 = COS[30]
Result:#101 is set equal to 0.86602
Trigonometry Functions
Cosine
45 deg
2.5R
#101
#101 = COS[45] * 2.5
X component of hole location
Trigonometry Functions
Arc cosine
#101 = ACOS[.86602]
Result:#101 is set equal to 30
Trigonometry Functions
Arc cosine
#103 = ACOS[#102/#101]
?
#101
#102
Angle neededSide adjacent and hypotenuse known
Trigonometry Functions
Tangent
#101 = TAN[30]
Result:#101 is set equal to 0.5773
Trigonometry Functions
Tangent10
1.5
?
#101 = TAN[10] * 1.5
Side opposite neededAngle and side adjacent known
Trigonometry Functions
Arc tangent
#101 = ATAN[.5] / [.75]
Result:#101 is set equal to 33.6874
Trigonometry Functions
Arc tangent
#103 = ATAN[#101] / [#102]
?
#102
#101
Angle neededSide adjacent and side opposite known
Square Root
#101 = SQRT[9]
Result:#101 is set equal to 3.0
Square Root
a
b
c
22 2c a b= +
#103=SQRT[#101*#101 + #102*#102]
#101
#102
Pythagorean theorem
Absolute Value
#101 = ABS[2-5]
Result:#101 is set equal to 3.0
Absolute value renders unsigned (positive) value
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
Rounding
#101 = ROUND[3.2]
#101 = ROUND[3.8]
#101 is set to 3
#101 is set to 4
Result is next closest integer
Rounding
#19
#7
#101=ROUND[#19/#7]#7=#19/#101
Rounding is helpful when determining the number of passes
Rounding
0.85
0.25
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
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
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
Round Down (FIX)
#101 = FIX[3.8]
#101 is set to 3
FIX rounds down to next lower integer
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.
Round Up (FUP)
#101 = FUP[3.2]
#101 is set to 4
FUP rounds up to next higher integer
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.
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
Priority Of Arithmetic Operations
#102 = COS[#1] * [#18 + #20]12
3Example
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…
Example
Fixed jaw
moving jaw
Workpiece
Center Y position changes based upon diameter
…small workpiece…
Example
Fixed jaw
moving jaw
Workpiece
Center Y position changes based upon diameter
…large workpiece
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
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