tan^-1

Discussion in 'Questions (Windows Mobile)' started by dennishea, Dec 24, 2007.

  1. dennishea

    dennishea Active Member Licensed User

    a = Tan-1 * (y/x)

    The above formula is for finding an angle when converting from rectangular to polar. I'm not sure how to get the tan-1 right. Have tried some different configurations but no luck. I've used this before with a scientific calculator and it worked great. Has anyone used this with basic4ppc? Any help would be appreciated.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You should use ATan:
    Msgbox(ATan(1) * 180 / cpi) 'Displays 45.
     
  3. dennishea

    dennishea Active Member Licensed User

    Thanks Erel. That's what I needed. Agian Thanks.

    p.s. I realize that us non programmers abuse the use of variables, arrays, and what not but with your great job in designing basic4ppc and the use of yours, agraham, dzt and others dll's, it makes basic4ppc a very powerful and easy to use programing language. Not counting this very informative and friendly forum. I hope you have a very merry Chistmas.

    :sign0188: :) :sign0188:
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Thank you and merry Christmas too :)
     
  5. dennishea

    dennishea Active Member Licensed User

    Rec to Pol

    Hi all.

    This program gives me x & y for polar to rectangular and gives me radius but not angle from rectangular to polar. Does anybody see what I'm doing wrong.


    PHP:
    Sub Globals
       
    'Declare the global variables here.   
       DegRad = cPI/180
       RadDeg = 180/cPI
    End Sub

    Sub App_Start
       Form1.Show
    End Sub

    Sub btnRecPor_Click   
       radius = Sqrt((txtx.Text^2) + (txty.Text^2))   
       angle = ATan(txty.Text/txtx.Text * RadDeg)
       txtanswer.Text = "Radius " & Format(radius,"n2") & " --  " & "Angle " & Format(angle,"n5")
    End Sub

    Sub btnPolRec_Click
       x = txtx.Text * Cos(txty.Text * degrad)
       y = txtx.Text * Sin(txty.Text * degrad)
       txtanswer.Text = "x " & Format(x,"n2") & " ------  " & "y " & Format(y,"n2")

    End Sub

    Sub btnClear_Click
       txtx.Text = ""
       txty.Text = ""
       txtanswer.Text = ""
    End Sub
    Thanks in advance for any help.

    Denny
     
  6. agraham

    agraham Expert Licensed User

    Isn't that last bracket misplaced?
     
  7. dennishea

    dennishea Active Member Licensed User

    Thanks agraham. That is what I missed.

    Denny
     
Loading...