Results 1 to 3 of 3

Thread: using trig functions in vb.net

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    15

    using trig functions in vb.net

    Hi every 1

    Im building a maths program, to work out trig functions using sine, tan and opp. I made up one question asking the user to find the length of the opp side. The Hyp side has got 9cm(HYP) and the angle is 40 degrees and u need to find the size of X(OPP). I have dont the quesiton on pen and paper using a calculator and it works out to be 5.79cm.

    When i do it vb.net it comes out as 54.7. This is the code im using to work it out using vb.net maths operators:

    Public Function RatioSineFindingLength(ByVal length As Double, ByVal angle As Double) As Double
    Dim lengthReturn As Double
    lengthReturn = (length / (Sin(angle)))
    Return lengthReturn
    End Function

    ANY HELP WOULD BE GREAT.

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: using trig functions in vb.net

    sine = opp / hyp -> opp = sine*hyp; your formula appears to be slightly messed up. I also wouldn't be surprised if there's a radian/degree conversion error--your calculator probably uses degrees while VB tends to use radians.

    There are 2*pi radians in 360 degrees. Radians end up being much more natural than degrees. Hope something here helps.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    15

    Re: using trig functions in vb.net

    ok thanks m8

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