Numerical Methods for Engineers

Published by McGraw-Hill Science/Engineering/Math
ISBN 10: 0073401064
ISBN 13: 978-0-07340-106-5

Chapter 2 - Programming and Software - Problems - Page 50: 2.15

Answer

x. y. theta. 1. 1. 90 1. -1. -90 1. 0. 0 -1. 1. 135 -1. -1. -135 -1. 0. 180 0. 1. 90 0. -1. -90 0. 0. 0 (tried to make a table I couldn’t)

Work Step by Step

Option Explicit Function Polar(x, y) Polar = θ 180 π End Polar Dim th As Single, r As Single Const pi As Single = 3.141593 r = Sqr(x ^ 2 + y ^ 2) If x < 0 Then If y > 0 Then th = Atn(y / x) + pi ElseIf y < 0 Then th = Atn(y / x) - pi Else th = pi End If Else If y > 0 Then th = pi / 2 ElseIf y < 0 Then th = -pi / 2 Else th = 0 End If End If Polar = th * 180 / pi End Function
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.