Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Compiled function different from uncompiled version? HOW?!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31664] Compiled function different from uncompiled version? HOW?!
  • From: Benjamin Lotto <benNOSPAMlotto at yahoo.com>
  • Date: Fri, 23 Nov 2001 05:46:49 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I'm trying to write some code to draw pictures of Julia sets.  The 
following code does what I want until I try to compile it.  Then, all of 
a sudden, I get a different (and wrong) answer!  What's going on?  Am I 
misusing Compile?

The following uses Mathematica version 3.0.1 on MacOS 8.6.

Help!!!

In[1] := Julia[z_,c_]:=
  Module[{test=Max[2.,Abs[c]]},
    Length[FixedPointList[(#^2+c)&,z,50,SameTest->Function[Abs[#1]>test 
]]]];

In[2] := compiledJulia=
  Compile[{{z,_Complex},{c,_Complex}},
    Module[{test=Max[2.,Abs[c]]},
      Length[FixedPointList[(#^2+c)&,z,50,
          SameTest->Function[Abs[#1]>test ]]]]];

In[3] := z = 0.984224 + 0.439194 * I; c = 0.361564 + 0.743827 * I;

In[4] := Julia[z,c]

Out[4] := 4

In[5] := compiledJulia[z,c]

Out[5] := 1

-- 
Benjamin Lotto <benNOSPAMlotto at yahoo.com>
(Remove NOSPAM to reply.)


  • Prev by Date: Re: Problem with finktion with four variables
  • Next by Date: KroneckerDelta in sum
  • Previous by thread: Re: Problem with finktion with four variables
  • Next by thread: KroneckerDelta in sum