Results 1 to 8 of 8

Thread: sin and cos

  1. #1

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    sin and cos

    I need to know the opposite of sin and cos (sin-1 on calculators)

    From what i understand there's no vb function for these, can
    anyone give me one? so if i put:
    VB Code:
    1. print asin(sin(5))     'this will print 5
    2. print acos(cos(5))    'this will also print 5

    help?
    Don't pay attention to this signature, it's contradictory.

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    last I checked there was

  3. #3
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    there aren't

    They are dirived as follows (from vb-help):

    Inverse Sine: Arcsin(X) = Atn(X / Sqr(-X * X + 1))
    Inverse Cosine: Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  4. #4

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    VB Code:
    1. Private Function Arcsin(X As Double)
    2. Arcsin = Atn(X / Sqr(- X * X + 1))
    3. End Function
    4.  
    5. Private Function Arccos(X As Double)
    6. Arccos = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1)
    7. End Function

    this causes an error (incorrect prcedure call) for some reason.
    any ideas?
    Don't pay attention to this signature, it's contradictory.

  5. #5
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    try deleteing the space after the first "-" sign
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  6. #6

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    same result

    VB Code:
    1. Print Sin(Arcsin(5))
    2.  
    3. Public Function Arcsin(X As Double)
    4. Arcsin = Atn(X / Sqr(-X * X + 1))
    5. End Function



    creates an error, maybe im just using it wrong too, u give arcsin an angle and a measurement? or 2 measurements?
    Don't pay attention to this signature, it's contradictory.

  7. #7
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    You give arcsin a value between 0 and 1 inclusive, the output of a sin command. It will return the number of radians (pi radians=180 degrees). The number you give it is the ratio formed

    from SOH-CAH-TOA

    so for arcsin, you feed it the Opposite/Hypotenuse and it gives you the angle. You can't give it a number greater than one b/c by definition, in a right triangle, the hypotenuse is the longest side.
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  8. #8

    Thread Starter
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    oh

    radians, got it, thx

    my new line..

    Deg(Sin(Arcsin(Rad(40))))

    ... works though
    Don't pay attention to this signature, it's contradictory.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width