Question: Write a code in tibasic to basic that allows me to get the correct angle regardless of quadrant it's in . Think sort of like

Write a code in tibasic to basic that allows me to get the correct angle regardless of quadrant it's in. Think sort of like atan2d Matlab function code in tibasic. test it first please! should display one correct angle at the endt
this is how far I was able to get, use this as a base or don't if you wish, up to you!
Define LibPub ank(z)=
Func
:Local a,b,\theta
:a:=real(z)
:b:=imag(z)
:\theta :=arctan(((b)/(a)))
:If a<0 and b>0 Then
: \theta :=angle(z)-180*2
:ElseIf a<0 and b!=0 Then
: \theta :=180-\theta
:Else
: \theta :=angle(z)
:EndIf
:Return \theta
:EndFunc
Should work for ank(1+1i), ank(1-1i), ank(-1-1i), ank(-1+1i), and ank(1/((i*10)^3+7*(i*10)^2+14*i*10+7))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!