Question on acos function in Fractint
Hi, I'm comparing the results my fractal program produces against Fractint's. In general I get the same results, but I'm getting dramatically different images for some fractals involving the acos function. Using the formula: mandelfn { z = 0: z = fn1(z*z) + pixel |z| < 4.0 } With fn1 = acos and default parameters, Fractint produces : http://www.speakeasy.org/~edyoung/fract001.gif And I get: http://www.speakeasy.org/~edyoung/acos_image.png I think this stems from different functions we use to compute acos: Fractint uses rz=Arccos(z)=-i*Log{z+sqrt(z*z-1)} Whereas my code uses: acos(z) = pi/2 - asin(z) According to MathWorld, ( see http://functions.wolfram.com/ElementaryFunctions/ArcCos/27/02/01/), the formula Fractint uses is only valid for certain domains, so I'm suspicious that Fractint's producing the wrong output. Any comments? Regards, -- Edwin
On Sun, 2004-05-02 at 17:21, Tim Wegner wrote:
Edwin wrote:
Whereas my code uses:
acos(z) = pi/2 - asin(z)
Which tells us nothing except the relationship between sin and cos. Now tell us how your program calculates asin(z)!!
The formula I use for asin(z) is -i * log(i*z + sqrt(1-z*z)), which looks the same as Fractint's, judging by the comment in mpmath_c.c. My formulas for log and sqrt are a bit different from Fractint's, though. Both my program and Fractint produce the same image for asin(z*z)+c - it's only acos() - and acosh(), I've just discovered - which are different. Regards, -- Edwin
Further to the acos(z) issue, here's an example of a specific point which I think may be wrong. acos(1,-1) is (-0.904557,-1.06128) per Fractint's formula asin(1,-1) is (0.666239,-1.06128), also per Fractint's formula pi/2 - asin(1,-1) is (+0.904557,+1.06128) So my theory is that the acos(z) formula used in Fractint produces an answer with the wrong sign if real(z) * imag(z) < 0. The only other complex math library I have to hand is Python's, which also claims that acos(1,-1) is +ve. Regards, -- Edwin
participants (2)
-
Edwin -
Tim Wegner