Math's Trig Versus Basic's Trig Functions
#11
(07-30-2022, 11:37 AM)OldMoses Wrote:
(07-30-2022, 05:30 AM)Pete Wrote: Remember Obamacare? That's why Democrats can't do simple math... because there are no left triangles!

That explains why they're always looking for a bigger slice of _PI, but we're going off on a TAN here...

Yah, a little comic relief is OK. Getting back:
Quote:I think a lot of folks resist trig because of the amount of memorization that's required. I know it's the case with me. I only discovered the SOH CAH TOA mnemonic a few years back. It certainly wasn't taught to me in school. Prior to that, anytime I needed to use trig it was off to find a math book or my machinist notes. It was only a few days ago that I found that with the reciprocal identities, only one of each pair starts with "CO..." So now I no longer need confuse which is secant and cosecant.

SOH, CAH, TOA ? is that Klingon? Sin Cos and Tan are the main players that must be the S, C, T that start you mnemonics.

This is how I learned these Ratios, yes remember that first they are Ratios of lengths of sides:

Hypotenuse is the length of the longest slanted line opposite the Right Angle.

Now the triangle has 2 other angles so pick one and call it the Angle being considered so:
Then there are 2 sides lengths named: Opposite the Angle being considered and Adjacent the Angle being considered.
   Sin = O/H "Opposite Over Hypotenuse"  Opposite Over Hypotenuse is the side opposite the Angle being considered 
   Cos = A/H "Adjacent Over Hypotenuse"  Adjacent is the side next to the Angle being considered
   Tan = Sin/Cos = Opposite/Adjacent O/H

So then for the other angle not being considered it's Sin and Cos are just the reverse of the Angle being considered so it's Sin is the other angles Cos and it's Cos is the other angles Sin. But if that gets confusing drop it, don't need to memorize that because so easily figured out later.

Then I just lookup Secant is the reciprocal of Cos so for 1/Cos Algebra reverses top and bottom numbers for H/A, laughs I guess; and CoSecant is the other one. H/O  H/A and H/O very funny stuff! ;-)) (Trying hard not to get boring like a machinist.)

Hey @OldMoses you were a machinist too! I wasn't a machinist per say but learned to program a CNC lathe for fasteners (threads for screws as well as regular "turnings") manufacturing companies. So I had the lowly title of Machine Operator.
b = b + ...
Reply
#12
I once programed a machine gun but my code was shot full of holes.

Okay, now all we need to do is fit in ways to remember "inverse function" "arctangent", "arccosine", "arcsine" and we're in pretty good shape! We can circle back to those, anytime!

Pete
Reply
#13
What is the difference between an angel and an arch angel? (sic I mean angel not angle, get back to that later.)
b = b + ...
Reply
#14
They're 180 degrees apart! Oh, and Arch Angels are unionized.

Pete
If eggs are brain food, Biden takes his scrambled.
Reply
#15
(07-30-2022, 03:49 PM)Pete Wrote: They're 180 degrees apart! Oh, and Arch Angels are unionized.

Pete

Umm... how'd you get that? That kinda makes them opposites?

I am trying to establish another mnemonic for arc which, when I hear think of arch. 

Ah! now I get it, you go one way to get Sin from and angle and you go the other way to get an Angle from a Sin. 

Pretty cool the word play!

I was thinking archs were of a higher order, the highway of getting an angel from a sin.
b = b + ...
Reply
#16
(07-30-2022, 03:18 PM)bplus Wrote: SOH, CAH, TOA ? is that Klingon? Sin Cos and Tan are the main players that must be the S, C, T that start you mnemonics.

This is how I learned these Ratios, yes remember that first they are Ratios of lengths of sides:

Hypotenuse is the length of the longest slanted line opposite the Right Angle.

Now the triangle has 2 other angles so pick one and call it the Angle being considered so:
Then there are 2 sides lengths named: Opposite the Angle being considered and Adjacent the Angle being considered.
   Sin = O/H "Opposite Over Hypotenuse"  Opposite Over Hypotenuse is the side opposite the Angle being considered 
   Cos = A/H "Adjacent Over Hypotenuse"  Adjacent is the side next to the Angle being considered
   Tan = Sin/Cos = Opposite/Adjacent O/H

So then for the other angle not being considered it's Sin and Cos are just the reverse of the Angle being considered so it's Sin is the other angles Cos and it's Cos is the other angles Sin. But if that gets confusing drop it, don't need to memorize that because so easily figured out later.

Then I just lookup Secant is the reciprocal of Cos so for 1/Cos Algebra reverses top and bottom numbers for H/A, laughs I guess; and CoSecant is the other one. H/O  H/A and H/O very funny stuff! ;-)) (Trying hard not to get boring like a machinist.)

Hey @OldMoses you were a machinist too! I wasn't a machinist per say but learned to program a CNC lathe for fasteners (threads for screws as well as regular "turnings") manufacturing companies. So I had the lowly title of Machine Operator.

Probably a Hawaiian/Klingon dialect.  Big Grin

SOH = Sine is Opposite over Hypotenuse
CAH = Cosine is Adjacent over Hypotenuse
TOA = Tangent is Opposite over Adjacent

I do machinist stuff on the farm, but wouldn't deign to call myself a "machinist" per se. It started as a hobby. I've got two main lathes, a '47 Logan 820 and a post WWI Monarch model "A", as well as a couple project lathes. I also have a Hendey Norton mill from approximately the same era as the Monarch. www.plainviewfarms.com/mill  shows my rehabilitation of that machine. I also rescued and cleaned up an 1881 E. Gould and Eberhardt Shaper. That's by far my oldest piece. One of the main uses for trig in hand operated machines is for setting lathe compound rests to do threading and precision feeds. I've also used it to plot locating moves for milling indexing plates.

I've cut threads and built things like bushings, simple worm drives and hydraulic manifold blocks. Mostly though it's attachments for the main machines like carriage stops, spindle indexers and other sunderies. We do some millwright type welding and fabrication work and associated stuff as well to keep things percolating on a farm with an eclectic mix of ancient and modern equipment. If there's something that we need that's either not made, or not available, I'm generally on the case around here. As such I'm constantly running into problems that trig is the easiest method to solve. I've used it for years, like a little old lady uses her car, but only recently have I made an in depth study of how it really works.

I really don't know why this post is spaced out so much, I can't seem to get rid of it, sorry...
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Reply
#17
@OldMoses wow man I am impressed even a little envious ;-))

I hope spacing is to your liking.
b = b + ...
Reply
#18
Graphics based on Basic's Trig Functions

I base my x, y coordinates around point cx, cy like this:
x = cx + r * cos(RadianAngle)
y = cy + r * sin(RadianAngle)
r = radial distance between x, y and cx, cy or r = SQR((x-cx)^2 + (y-cy)^2)

When RadianAngle = 0 then Cos(0) = 1, Sin(0) = 0 this graphs due East of point cx, cy
When RadianAngle = Pi/2 = 90 degrees Cos(RadianAngle) = 0, Sin(RadianAngle) = 1 that
graphs due South of cx, cy and moving from East to South is Clockwise around cx, cy
and the angle increases from 0 to pi/2 (or if you prefer, 0 to 90 Degrees)
and onwards around the point in 2*pi Radians or 360 Degrees.

This means I use my own Arc drawing Sub to make arcs because Circle methods are upside down
and Counter-Clockwise.


I believe arc drawing should be consistent with Basic's Trig functions, thusly starting an angle where 
the Trig function would graph them and moving Clockwise as angle increases.
b = b + ...
Reply
#19
Here is demo of the angle your mouse is to the center of the screen and demonstrating _Atan2 function:
Code: (Select All)
Screen _NewImage(800, 600, 32)
Do
    Cls
    For a = 0 To 2 * _Pi - .01 Step _Pi(2 / 36)
        x = 400 + 200 * Cos(a)
        y = 300 + 200 * Sin(a)
        _PrintString (x, y), Str$(Int(_R2D(a) + .5))
    Next
    While _MouseInput: Wend
    mx = _MouseX: my = _MouseY
    a = _Atan2(my - 300, mx - 400)
    If a < 0 Then a = a + 2 * _Pi
    Line (400, 300)-(400 + 150 * Cos(a), 300 + 150 * Sin(a)), &HFFFFFF00
    _PrintString (388, 292), _Trim$(Str$(Int(_R2D(a) + .5)))
    _Display
    _Limit 60
Loop

Please note: North is not 0 degrees it is 270.
b = b + ...
Reply
#20
Updated drawArc and drawPieSlice to match Trig Angles start arcs in Radian units:

Test code for routines:
Code: (Select All)
Option _Explicit
_Title "Arc New 2022-09-28" 'b+ 2022-09-28

Screen _NewImage(800, 600, 32)
_ScreenMove 250, 50

Dim start, measure, r
Do
    r = Rnd * 150 + 1
    start = Rnd * _Pi(2)
    measure = Rnd * _Pi(2)
    drawArc 400, 300, r + 20, start, measure, &HFFFFFF00
    drawPieSlice 400, 300, r, start, measure, &HFF0000FF
    Color &HFFFFFF00
    Print "Start Angle:"; _R2D(start) \ 1;
    Color &HFF0000FF
    Print "Degrees for Arc Angle:"; _R2D(measure) \ 1; "Degrees"
    Color &HFFFFFFFF
    Print "Pie Slice Radius:"; r \ 1; "  Arc Radius:"; r \ 1 + 20
    Sleep
    Cls
Loop

'Arc New 2022-09-28 independent of constants and routines
Sub drawArc (xc, yc, radius, rStart, rMeasure, colr As _Unsigned Long)
    ' xc, yc Center for arc circle
    ' rStart is the Radian Start Angle, use _D2R for conversion from Degrees to Radians
    ' rMeasure is the measure of Arc in Radain units, use _D2R for conversion from Degrees to Radians
    ' Arc will start at rStart and go clockwise around for rMeasure Radians

    Dim rEnd, stepper, a, x, y

    rEnd = rStart + rMeasure
    stepper = 1 / radius ' the bigger the radius the smaller  the steps
    For a = rStart To rEnd Step stepper
        x = xc + radius * Cos(a)
        y = yc + radius * Sin(a)
        If a > rStart Then Line -(x, y), colr Else PSet (x, y), colr
    Next
End Sub

'Arc New 2022-09-28 independent of constants and routines
Sub drawPieSlice (xc, yc, radius, rStart, rMeasure, colr As _Unsigned Long)
    ' xc, yc Center for arc circle
    ' rStart is the Radian Start Angle, use _D2R for conversion from Degrees to Radians
    ' rMeasure is the measure of Arc in Radain units, use _D2R for conversion from Degrees to Radians
    ' Arc will start at rStart and go clockwise around for rMeasure Radians

    Dim rEnd, stepper, a, x, y

    rEnd = rStart + rMeasure
    Line (xc, yc)-(xc + radius * Cos(rStart), yc + radius * Sin(rStart)), colr
    Line (xc, yc)-(xc + radius * Cos(rEnd), yc + radius * Sin(rEnd)), colr
    stepper = 1 / radius ' the bigger the radius the smaller  the steps
    For a = rStart To rEnd Step stepper
        x = xc + radius * Cos(a)
        y = yc + radius * Sin(a)
        If a > rStart Then Line -(x, y), colr Else PSet (x, y), colr
    Next
    Paint (xc + .5 * radius * Cos(rStart + .5 * rMeasure), yc + .5 * radius * Sin(rStart + .5 * rMeasure)), colr, colr
End Sub
b = b + ...
Reply




Users browsing this thread: 13 Guest(s)