Post Reply 
[VA] SRC #009 - Pi Day 2021 Special
03-15-2021, 11:12 PM
Post: #7
RE: [VA] SRC #009 - Pi Day 2021 Special
(03-15-2021 11:06 PM)Albert Chan Wrote:  
(03-15-2021 09:33 PM)Gerson W. Barbosa Wrote:  For constants less than -1 divide the result by -3.

The reason for this is because atan(x) only return principle angle, between ±pi/2
Let the constant is x, instead of e:

atan((x-1)/(x+1)) = atan((x - tan(pi/4)) / (1 + tan(pi/4)*x) = atan(tan(atan(x) - pi/4))

If atan(x) - pi/4 ≥ -pi/2 (equivalent to x ≥ -1):

4*(atan(x) - atan((x-1)/(x+1)) = 4*(atan(x) - (atan(x) - pi/4)) = pi

If atan(x) - pi/4 < -pi/2 (equivalent to x < -1):

4*(atan(x) - atan((x-1)/(x+1)) = 4*(atan(x) - (atan(x) - pi/4 + pi)) = -3*pi

Thank you Albert for that explanation to the mere mortals like myself of something which is obviously trivial to Gerson (and you). Very neat.

Cheers,

PeterP
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #009 - Pi Day 2021 Special - PeterP - 03-15-2021 11:12 PM



User(s) browsing this thread: 1 Guest(s)