2 posts
• Page **1** of **1**

Please include ATAN2(radian(longitude),radian(latitude)) in the list of trigonometric functions.

- Ajay Askoolum
**Posts:**684**Joined:**February 22nd, 2007, 2:16 am**Location:**United Kingdom

Had you considered using the CSE to accomplish this? If no, below is solution using the CSE:

- Code: Select all
`⍙output←x atan2 y;s1;⍙atan2;⍙radians;⍙degrees`

⍝ Calculate the arctangent of an angle

⍝ x is x-coordinate of a point

⍝ y is y-coordinate of a point

⍝ Material and example sourced from http://msdn.microsoft.com/en-us/library/system.math.atan2.aspx

⍝

⍝ 2014 APLNow LLC

⍙atan2←'c' ⎕cse 'Init' 'System'

s1←⊃'using System;' 'double x;' 'double y;' 'double angle;' 'double radians;'

0 0⍴⍙atan2 ⎕cse 'Exec' s1

0 0⍴⍙atan2 ⎕cse 'ExecStmt' 'radians = Math.Atan2({0},{1});' y x

⍙radians←⍙atan2 ⎕cse 'GetValue' 'radians'

0 0⍴⍙atan2 ⎕cse 'ExecStmt' 'angle = {0}*(180/Math.PI);' ⍙radians

⍙degrees←⍙atan2 ⎕cse 'GetValue' 'angle'

⍙atan2 ⎕cse 'Close'

⍙output←"The arctangent of the angle formed by the x-axis",⎕tcnl

⍙output←⍙output," and a vector to point (",(⍕x),",",(⍕y),") is ",(⍕⍙radians),⎕tcnl

⍙output←⍙output"which is equivalent to",(⍕⍙degrees)," degrees."

Tech Support

support@apl2000.com

support@apl2000.com

- Tech Support
**Posts:**1167**Joined:**February 10th, 2007, 7:33 am**Location:**Rockville, MD

2 posts
• Page **1** of **1**

Users browsing this forum: No registered users and 1 guest