

Absolute values that are greater than 1.0 are clipped and displayed as white here. The result is a simple image with gray levels indicating the absolute value of z², where 0.0 represents black and 1.0 represents white. In this case, we can use this listability to get a small performance improvement: Attributes = ] Image]


Note: is always defined to be the last result that Mathematica generated. To quote Data from Star Trek: “For an android, that’s nearly an eternity”.Ī typical improvement to this code is to use the fact that many WL functions are listable, which means that they can operate on lists sequentially the same way they can operate on individual expressions. The names of built-in Mathematica functions begin with capital letters. On my Linux box (Intel Xeon CPU E3–1245) this evaluation takes about 700 milliseconds. Writing WL code like this is very inefficient though. Then we can call that function and run it repeatedly in a Do loop: Do, 1000000 ] The naive way to do this is to define a function that takes one complex number and squares it: f := z^2 Suppose we want to numerically square lots of complex numbers, not an unusual task in mathematics, physics, and other sciences. Let’s take a look at a very basic example.
