Wednesday 30 December 2020

Penrose Life

Recently I was email interviewed by Siobhan Roberts for an article she was writing about Conway’s famous Game of Life.  The article has just been published in the New York Times, and I see I am in good company!

Not only that, but the piece was picked up by Clive Thompson who wrote a post for BoingBoing on the part of the article I was interviewed about: runing the Game of Life on a Penrose tiling.

Here are a couple of the many oscillators my students and I discovered (and named):


period 4 bat



period 9 moustache

You can find out more about the work my students and I have done on this here:




Monday 21 December 2020

’Twas the night of conjunction

… and it was cloudy, so we couldn’t see anything.  I’m so glad we looked yesterday, which was still pretty fantastic!

Stellarium lets us see how much closer the planets were:

conjunction (same scale as yesterday)

And look how much the moons have moved in a day!




Sunday 20 December 2020

’Twas the night before conjunction

The conjunction of Jupiter and Saturn is tomorrow.  But that means they are pretty close today, so we had a look. 

I spotted Jupiter immediately, and was looking for the fainter Saturn nearby, but couldn’t see anything.  So I looked through my binoculars at Jupiter, and Saturn popped out, so close, just above Jupiter!  Wow!  

I still couldn't see it with the naked eye, even knowing where to look, because it was so close to Jupiter it was being drowned out.  (My other half could see it, but he has better eyesight than me.)

Here are a couple of (highly cropped, but unenhanced) photos, taken with a Canon EOS 20D and a Canon EF 100-400mm zoom lens

17:32 GMT looking west; 400mm focal length; f/5.6; ISO-1600 equivalent;1s exposure

17:35 GMT looking west; 260mm focal length; f/5.6; ISO-1600 equivalent;1s exposure

When we saw these photos, we went, “Wow, are those Jupiter’s moons?”  Then we zoomed in, and saw a very faint dot to the right of Saturn, almost invisible, but in the same place on both photos: “Wow, is that Titan?”

So we went to Stellarium to find out.

17:30 GMT: Jupiter, its four Gallilean moons, and a star in line to the left, below Saturn and Titan.

So, yes! We had indeed seen Jupiter (naked eye), plus very close-by Saturn (binoculars), and then plus Callisto, Ganymede, Europa, and Titan (photography).

And tomorrow is conjunction, so Jupiter and Saturn will appear even closer together in the sky!



Saturday 19 December 2020

some normality

 It's certainly been an atypical year, but some things don't change.




Friday 18 December 2020

cheeky devil

I caught some movement on the bird feeder out the cornerof my eye while eating breakfast.  I turned to see what bird was feeding now.

that’s no bird!

I crept closer to the window, to get a better shot.

that position can’t be good for your digestion

I tried for another shot, but I had been seen

time to make a getaway

No wonder we go through bird seed so quickly!



Monday 14 December 2020

the eyes of the tiger

Back several decades ago, Esso had a TV ad with the most breathtaking pictures of tigers, including a fantastic final shot.

I was desperate for a copy of that pic, so actually wrote to Esso.  They were kind enough to send me a poster (I think they had many requests!), but it was the wrong picture.  It was a poster titled “The Cat’s Whiskers”, and was a lovely picture of a tiger, but wasn’t that picture.

The Cats Whiskers

Then yesterday we were watching an episode of Neil Brand’s short TV series on the music of TV; the episode was about adverts.  AND THERE IT WAS...

screen shot

That expression!  Those eyes!  “Look on my Face, ye Puny, and despair.”

I did a Google image search, which matched a few eBay sites that only led through to “The Cat’s Whiskers”.  So this fuzzy screenshot is the best I’ve got for now.  But still better than I had. 


Friday 11 December 2020

Covid-19 diary: puns galore

We should all remember the name of the first person to get a Covid vaccination (except those in clinical trials): it was 90-year old Margaret Keenan.

We all will remember the name of the second person: it was 81-year old William Shakespeare.

And this, of course, led to so many puns.  My favourite has to be:

So, if Ms Keenan was patient 1A, was Mr Shakespeare “Patient 2B or not 2B”?


 


Friday 4 December 2020

snowy morning

 We woke to wintry scenes this morning:




Sunday 8 November 2020

leaf skeleton

Moving some bricks that had been standing outside for a while, we found this old leaf that had decayed away, leaving just its skeleton behind:




Friday 6 November 2020

cloud shadow

 A glorious sunset tonight:

sunset, looking west, 16:25 GMT

Towards the lower left edge of the coud, there’s a diagonal dark band: it’s a shadow of part of the cloud cast by the setting sun on the cloud!  Here it is in an expanded view:





Saturday 24 October 2020

autumn colour

 The garden is looking gorgeous at the moment






Friday 9 October 2020

book review: Lent

Jo Walton.
Lent.
Tor. 2019


Girolamo Savonarola was a Dominican friar who preached in Florence, and was burned for heresy in 1498. Nearly the first half of this novel is the story of the six years leading up to this event, with the only fantasy overtones being that Girolamo can see and cast out demons. The novel makes him a sympathetic character, rather than the somewhat puritanical zealot of history. But on his execution, the novel takes a highly unexpected turn. For this Girolamo Savonarola is not human.

For me, the story got much more interesting once the fantasy aspects are foregrounded. As I said, that’s nearly half the way through. Up until then, it can be read (apart from the demons) as a relatively straightforward dramatisation of an historical figure. This is well done, but not my usual fare; however, I like Walton’s work, so I persisted. And it was worth the wait.

The rest of the book, which I can’t describe without massive spoilers, has the same historical feel, although the context has changed dramatically. It gives a wonderful view of life in Italy at this time, through a fantastical lens, and keeps you guessing until the end. I thought the ending was very slightly rushed, but everything fit together perfectly.




For all my book reviews, see my main website.

Thursday 8 October 2020

book review: Dogs of War

Adrian Tchaikovsky.
Dogs of War.
Head of Zeus. 2017


In the near future, genetic engineering has led to bioforms, animals with increased intelligence, size, and strength, bred for war. They have embedded obedience chips, so they can’t go rogue. But what happens when they are obedient to a war criminal? Who is to blame for their actions? Will a terrified public demand they be destroyed? How can they fight for their freedom without terrifying the public even further?

This is an excellent view inside the minds of uplifted beasts, told from the point of view of Rex, a dog-form, in charge of a group that includes a bear that is rather more intelligent that she should be, a giant lizard who prefers lying in the sun to shooting enemies, and the hive-mind Bees. There are lots of plot twists just when you think you know how things will play out, and a view of humanity whose only salvation may lie in the hands, or paws, of its own creations.





For all my book reviews, see my main website.

Sunday 20 September 2020

bacteria computing in cubes

Our new paper published today:

Susan Stepney, Viv Kendon.
The representational entity in physical computing
Natural Computing, (online), 2020

Abstract: We have developed abstraction/representation (AR) theory to answer the question “When does a physical system compute?” AR theory requires the existence of a representational entity (RE), but the vanilla theory does not explicitly include the RE in its definition of physical computing. Here we extend the theory by showing how the RE forms a linked complementary model to the physical computing model. We show that the RE does not need to be a human brain, by demonstrating its use in the case of intrinsic computing in a non-human RE: a bacterium..
Many systems are claimed to compute, from spaghetti, to slime moulds, to the universe itself.  But how can we tell if a system is computing, or just “doing its thing”?

We have been working on the snappily named “abstraction/representation theory” for a while to clarify this issue.  In a nutshell, one part of the requirement for a system to be computing is that what it is doing has to represent something else in the world.  And that representation is in the eye of the (also snappily named) repesentational entity (RE) that is using the computer.

Up until now, our definitions have only referred to the RE, but not included it in the overall model.  No longer.  Here, we add the RE to the model, which adds a new dimension, and the definitoin moves from requiring a commuting square to a commuting cube.  (See the paper for lots more pictures of these cubes...)






Sunday 30 August 2020

shepherds are delighted

looking NW, at 20:02BST

 

Sunday 23 August 2020

Artificial glassware for artificial chemistries

 Our new paper published recently:

Penelope Faulkner Rainford, Angelika Sebald, Susan Stepney.
MetaChem: An algebraic framework for Artificial Chemistries
Artificial Life Journal, 26(2):153–195, 2020

Abstract: We introduce MetaChem, a language for representing and implementing artificial chemistries. We motivate the need for modularization and standardization in representation of artificial chemistries. We describe a mathematical formalism for Static Graph MetaChem, a static-graph-based system. MetaChem supports different levels of description, and has a formal description; we illustrate these using StringCatChem, a toy artificial chemistry. We describe two existing artificial chemistries—Jordan Algebra AChem and Swarm Chemistry—in MetaChem, and demonstrate how they can be combined in several different configurations by using a MetaChem environmental link. MetaChem provides a route to standardization, reuse, and composition of artificial chemistries and their tools.

Artificial chemistries – computational systems that link together abstract ‘molecules’, inspired by the way natural chemistry operates – are fascinating ways to explore the growth of complexity, and underpin some aspects of Artificial Life research.  Most AChem research focusses on designing the molecules and reactions of the artificial system.

We have been working at the level of the artificial ‘glassware’: the system whereby different molecules are brought together under different conditions.

Our new paper explains how this MetaChem system works, and how it can be used to underpin essentially any artificial chemistry – it can even use whole chemistries at one level to be the molecules at another level.

The python code is available on GitHub for anyone to use in their own AChem systems.

Sunday 2 August 2020

TV review: Devs

Beautiful nonsense

Lily Chan and her boyfriend Sergei Pavlov are software developers at the high tech Amaya company in San Francisco. Sergei is reassigned to the secretive Devs project, disappears, and then security video of his suicide turns up. Lily is initially distraught, but then suspicious. She starts to investigate, and discovers the Sergei was murdered when he tried to steal Devs code. Her own life is at risk as she works to discover what the Devs project is actually trying to do.

The whole premise is bonkers. SPOILER: the Devs team are developing quantum computer code that can retrodict the past from the current state of the world. (It can also predict the future, but the team are forbidden to use it to do that. Yeah, right.) My first snort of derision was when Sergei asks how big the quantum computer is, and Forest answers “a number that it is meaningless to state”, while they are looking at a machine that has about 50 qubits in the real world.

At one point we see a crystal clear rendition of an episode from tens of thousands of years in the past. This is, of course, all impossible, for so many technical reasons. At another point one of the team asks Lily to name something that in not determined by something earlier: everything she says is refuted. The one thing she doesn’t suggest is Schrödinger’s cat, or some other quantum process. (And even if we ignore quantum mechanics, the very technology central to the plot, we know that chaos means that even a deterministic system can’t necessarily be predicted, or retrodicted, because of sensitive dependence on initial conditions. Okay, I’ll stop the dynamical systems lecture now…)

Also, everyone works on the assumption that the computer’s predictions of the future (because, yes, of course they do use it for that) are inevitable. There’s a scene where the predictions are running a couple of seconds ahead of a group of people watching the prediction; no-one even tries to do something different. Lily, apparently, is the only person who can do something different from the prediction. It all ends nonsensically in a computer simulation.

So why do I say it is “worth watching”? Because the slow calm pace (even of a couple of murders!), the beautifully shot soft, rich, misty San Francisco, the amazing soundtrack, all add up (even with occasional shouting at the screen) to a dreamily beautiful experience.

Even if the premise is bonkers.





For all my SF TV reviews, see my main website.

Friday 10 July 2020

book review: Because Internet

Gretchen McCulloch.
Because Internet: understanding how language is changing.
Vintage. 2019

Linguists study language in all its forms. Spoken language is the primary form, but written language is also of interest. Whilst most spoken language is informal, spontaneous, conversational, most written language is formal, studied, edited. Well, that was the case until the internet, with the explosion of informal writing in emails, texts, chats, and so on. This has provided linguists with a rich resource, with no recording and transcription required. McCulloch’s book covers a wide range of investigations into this informal internet language, and how it has been changing over time.

McCulloch explains why a full stop at the end of a text appears passive-aggressive, the evolution of emojis and why they aren’t a language, why the internet has enabled videophones when previous attempts failed, and multiple other fascinating insights into this new form of language.

This isn’t the post-literate world; this is a differently literate world. Because Internet.





For all my book reviews, see my main website.

Thursday 9 July 2020

book review: Adam's Task

Vicki Hearne.
Adam’s Task: calling animals by name.
Akadine Press. 1986

This is a book about taking domesticated animals seriously: training them, respecting them, and treating them as creatures with their own complex, non-human internal lives. It provides a deeply fascinating account of how domesticated animals relate to humans, and of our responsibilities to them. It is mostly about mostly dogs and horses, told through a series of in-depth stories of particular animals Hearne has trained, plus a chapter on how different cats are.

It is also a book about building a philosophy of communication with domesticated animals. No behaviourism or anthropomorphism or sentimentality, but instead a deep understanding of their existence and differences.

This is a difficult book to summarise, but it is an engrossing read. I was completely hooked, and devoured it in just two sittings. It is an inspiring view into minds simultaneously alien, and yet co-evolved with our own, so that we can communicate meaningfully, if we take the time to learn how.




For all my book reviews, see my main website.

Wednesday 8 July 2020

TV review: Star Trek Discovery season 1


I recall when this first came out hearing a lot of fannish criticism, from the uniforms to the plot. I hadn’t heard whether that died down during the season or not. But we thought we’d give it a try anyway.

So, we are in the Star Trek universe, about 100 years after Enterprise, and 10 years before the Original Series. I’m not sure if it joins up with the original TV timeline, or the new movie series timeline (which I personally consider to be non-canon); maybe that never becomes clear. Michael Burnham, adopted daughter of Sarek and Amanda, is cashiered for mutiny at the start of the Klingon war with the Federation. Despite this, she ends up on board the starship Discovery, with its experimental spore drive, a key weapon against the Klingons.

This is not your typical light optimistic Star Trek. It unfolds into a dark season arc; it has a (deliberately) non-funny Harry Mudd episode, a “Groundhog Day” episode, a Mirror Universe episode, a lot of very nasty Klingons, a lot of very nasty Terrans, a captain acting dubiously, Starfleet acting dubiously, and more. It plays like grimdark non-canon Star Trek fanfic (what happened to the spore drive? why had we not seen Kelpiens before, or since?), yet also weaves in bits of early Original Series background.

It starts off slowly, but as the existence of the arc becomes established, the tension mounts. Characters die. Other characters are not what they seem. There are several jaw-droppingly unexpected moments. It’s really rather good.

Now for season 2…




For all my SF TV reviews, see my main website.

Sunday 5 July 2020

TV review: Good Omens


Armageddon is coming. Still, it’s not the end of the world…

The angel Aziraphale [Michael Sheen] and the demon Crowley (originally the snake Crawly) [David Tennant clearly having immense fun] have been on earth since the beginning of time (that is, about 6000 years), slowly become unacknowledged friends, and the only immortals around. But now time is up. The Antichrist has been born, and it’s Crowley’s job to make sure he’s placed with the American Ambassador, ready for Armageddon in a few years time. But Crowley messes up, and the boy is placed with a surburban British couple. Apocalyptic hijinks ensue.

This is Neil Gaiman’s adaptation of the book by him and Terry Pratchett (I haven’t read the book). Some might not feel it’s a good idea to watch an end of the world tale during a global pandemic lockdown, but it felt appropriate. There may be a few places where Gaiman is simply having too much fun, but on the whole this is a great series. It is clever, funny, scary, weird, sarcastic, touching, inventive, and wonderfully irreligious.




For all my SF TV reviews, see my main website.

Saturday 13 June 2020

not a shop

There is a good discussion of what education is for, and how different disciplines use different tools, in the post How to speak truthfully about what it means to be human: a user’s handbook.  All of it is interesting, but there is one paragraph that speaks forcefully about why students are not “customers”, itself a quote from another piece (my emphasis):

We go to school, not to get what we already know that we want, but because we want to receive an education. Here, we would expect teachers not just to give students what they know they want or say they want or are able to identify as what they want, but to move them beyond what they already know that they want. We want teachers to open up new vistas, new opportunities, and help children and young people to interrogate whether what they say they want or desire is actually what they should desire. To turn the student into a customer, and just  work on the assumption that education should do what the customer wants is therefore a distortion of what education is about, a distortion that significantly undermines the ability of teachers to be teachers and of schools, colleges and universities to be educational institutions rather than shops.

Hear, hear.

 

Friday 5 June 2020

Covid-19 diary: learning lessons from history

Black Death, COVID, and Why We Keep Telling the Myth of a Renaissance Golden Age and Bad Middle Ages” is a brilliant essay by Renaissance scholar and all round Renaissance woman Ada Palmer, on why the question “If the Black Death caused the Renaissance, will COVID also create a golden age?” is based on multiple misconceptions about history in general, and the Renaissance in particular.  However, there are things we can learn from history about how to tackle the Covid-19 aftermath, but will we?

The post is marvelous in general.  But in particular, the concept of “Ever-So-Much-More-So” really struck a chord with me.  As Palmer says, sprinkle some Ever-So-Much-More-So powder on the Middle Ages and you get the Renaissance: much more of the good bits, and much more of the bad bits.  

And this just keeps on: the good things keep getting more and better, but the bad things keep getting more and worse.  This is different from utopias (only the good things increase) or dystopias (only the bad increases): in the real future, everything gets Ever-So-Much-More-So.  The optimists notice only the more good; the pessimists only the more bad.  The reality is everything gets more complicated, more complex, more more.  Ever-So-Much-More-So.



Tuesday 2 June 2020

Covid-19 diary: online workshops

We were due to run a small workshop in York on 25-26 March.  Lockdown started on 23 March, but we had anticipated this, and moved the conference into a virtual format.

Here's a short report on how it went, and what we could do better next time.


Friday 29 May 2020

Covid-19 diary: seeing clearly

The window cleaners came today for the first time since lockdown.

We can see clearly now the spider webs are gone.

before window cleaning -- webby windows
after window cleaning -- clear and sunny

Thursday 28 May 2020

blooming May

It might be the dryest May on record, but the garden is blooming.






Wednesday 27 May 2020

Covid-19 diary: eye tests

Dominic Cummings has said that he drove to Barnard Castle with his wife and child at the end of his lockdown-busting trip to County Durham in order to test his eyesight before making the long drive home to London.

If the Indepedent’s report is accurate (and I have no reason to believe otherwise; there is plenty of other evidence), then here are only two possibilities: 
  1. Cummings is lying about his reason for his actions
  2. Cummings is telling the truth about his reasons for his actions
If he is lying, then he should be sacked for this lie.

If he is telling the truth, then he should be sacked for being too stupid to be a government advisor.

Additionally, if he is telling the truth, and he is happy to risk his wife and child’s life in such a manner, then it rather calls into question his original excuse for travelling north: worry for his child’s well being.


 

Sunday 24 May 2020

rational conics

I’m currently reading Elliptic Tales, some light relief from lockdown.  On reading the preface alone, I discovered something I hadn’t known before.  This might be quite well-know to people with a “traditonal” maths background, but I did “modern maths” at school: lots of cool set and group theory, very little classical geometry.

The discussion in the book is just about circles, but a little googling helped me discover this is a result that applies more broadly.

Consider the general quadratic equation of two variables:

\(a x^2 + b x y + c y^2 + d x + e y + f = 0\)

where not all of the coefficients of the quadratic terms, \(a,b,c\),  are zero.  Depending on the coefficent values, this gives a circle, ellipse, parabola, or hyperbola, that is, a conic section.

Let’s now consider the restricted case where all the coefficients are rational numbers.  A rational solution to this equation is a solution \((x,y)\) where both \(x\) and \(y\) are rational numbers.

Now comes the interesting bit.  Take a straight line with rational slope, \(y = q x + r\), where \(q\) is rational, that cuts the quadratic curve at two points.  Then either both points are rational solutions, or neither is.

The book proves this for the case of a circle, and then shows how to use the result to find all the rational points on the unit circle, \(x^2+y^2=1\).  You need one point that you know is rational, so let’s chose \((-1,0)\).  Then draw a straight line with rational slope that crosses the \(y\) axis at \(q\); that is, \(q\) is rational.  This line has equation \(y=q(x+1)\).  Then solve for the other point where the line crosses the circle to get a rational solution:

It is clear from the form of the solution that if \(q\) is rational, so is the point \((x_q,y_q)\).  Additionally, there are no rational solutions that correspond to an irrational value of \(q\), so we can use \(q\) to parameterise all the rational solutions.

Notice also that if we scale up the yellow right-angled triangle, multiplying it by a suitable integer \(n\), so that both  \(n x_q\) and \(n y_q\) are integers, the three sides form a Pythagorean triple.

These points and triples can be generated very easily, just by scanning through values of \(q\) and printing out the unique triples.  And Python’s fraction module makes this particularly straightforward (with a bit of fiddling to print in a fixed width format to make things line up neatly; yes, I’m a bit picky about things like this):
from fractions import Fraction as frac

found = set()
for denom in range(1,15):
    for num in range(1,denom):
        q = frac(num,denom)
        xq = (1-q*q)/(1+q*q)
        yq = 2*q/(1+q*q)
        
        n = xq.denominator
        triple = sorted([int(xq*n), int(yq*n), n])
        
        if triple[0] not in found:
            print( '{0:<7}  ({1:^7}, {2:^7})  {3}'.format(str(q),str(xq),str(yq),triple) )
            found.add(triple[0])
This gives the output:
1/2      (  3/5  ,   4/5  )  [3, 4, 5]
2/3      ( 5/13  ,  12/13 )  [5, 12, 13]
1/4      ( 15/17 ,  8/17  )  [8, 15, 17]
3/4      ( 7/25  ,  24/25 )  [7, 24, 25]
2/5      ( 21/29 ,  20/29 )  [20, 21, 29]
4/5      ( 9/41  ,  40/41 )  [9, 40, 41]
1/6      ( 35/37 ,  12/37 )  [12, 35, 37]
5/6      ( 11/61 ,  60/61 )  [11, 60, 61]
2/7      ( 45/53 ,  28/53 )  [28, 45, 53]
4/7      ( 33/65 ,  56/65 )  [33, 56, 65]
6/7      ( 13/85 ,  84/85 )  [13, 84, 85]
1/8      ( 63/65 ,  16/65 )  [16, 63, 65]
3/8      ( 55/73 ,  48/73 )  [48, 55, 73]
5/8      ( 39/89 ,  80/89 )  [39, 80, 89]
7/8      (15/113 , 112/113)  [15, 112, 113]
2/9      ( 77/85 ,  36/85 )  [36, 77, 85]
4/9      ( 65/97 ,  72/97 )  [65, 72, 97]
8/9      (17/145 , 144/145)  [17, 144, 145]
3/10     (91/109 , 60/109 )  [60, 91, 109]
7/10     (51/149 , 140/149)  [51, 140, 149]
9/10     (19/181 , 180/181)  [19, 180, 181]
2/11     (117/125, 44/125 )  [44, 117, 125]
4/11     (105/137, 88/137 )  [88, 105, 137]
6/11     (85/157 , 132/157)  [85, 132, 157]
8/11     (57/185 , 176/185)  [57, 176, 185]
10/11    (21/221 , 220/221)  [21, 220, 221]
1/12     (143/145, 24/145 )  [24, 143, 145]
5/12     (119/169, 120/169)  [119, 120, 169]
7/12     (95/193 , 168/193)  [95, 168, 193]
11/12    (23/265 , 264/265)  [23, 264, 265]
2/13     (165/173, 52/173 )  [52, 165, 173]
4/13     (153/185, 104/185)  [104, 153, 185]
6/13     (133/205, 156/205)  [133, 156, 205]
8/13     (105/233, 208/233)  [105, 208, 233]
10/13    (69/269 , 260/269)  [69, 260, 269]
12/13    (25/313 , 312/313)  [25, 312, 313]
3/14     (187/205, 84/205 )  [84, 187, 205]
5/14     (171/221, 140/221)  [140, 171, 221]
9/14     (115/277, 252/277)  [115, 252, 277]
11/14    (75/317 , 308/317)  [75, 308, 317]
13/14    (27/365 , 364/365)  [27, 364, 365]
and larger values are readily calculated, such as:
500/1001  (752001/1252001, 1001000/1252001)  [752001, 1001000, 1252001]

So I’ve only read the Preface so far, and yet I’ve already learned some interesting stuff, and had an excuse to play with Python.  Let’s hope the rest is as good (but I suspect it will rapidly get harder…)


Sunday 17 May 2020

the Buddhabrot

As we have seen, the Mandelbrot set can be calulated by iterating a function, and testing whether the sequence it generates diverges or not.  The so-called Buddhabrot (named for its appearance) looks at the trajectory of the generated sequence, as the generated points hop about, diverging or not. Points that start with a \(c\) value outside the Mandelbrot set, and so produce diverging sequences, may nevertheless have points along the way that land inside the set.

The Buddhabrot takes all the points ourside the set, and plots each point in the trajectory to divergence.  This leads to a density map: some points are visited more often than others (it is conventional to plot this rotated 90 degrees, to highlight the shape):

42 million randomly chosen values of \(c\)
In addition, there is the anti-Buddhabrot, which plots the trajectories of all the \(c\) values inside the Mandelbrot set.  These do not diverge: some converge inside the set, others cycle around.



Again, the code is relatively simple, and you can calculate the Buddhabrot and anti-Buddhabrot at the same time:
import numpy  as np
import matplotlib.pyplot as plt

IMSIZE = 2048 # image width/height 
ITER = 1000

def mandelbrot(c, k=2): 
    # c = position, complex; k = power, real
    z = c
    traj = [c]
    for i in range(1, ITER): 
        z = z ** k + c 
        traj += [z]
        if abs(z) > 2: # escapes
            return traj, []
    return [], traj
    
def updateimage(img, traj):   
    for z in traj:
        xt, yt = z.real, z.imag
        ixt, iyt = int((2+xt)*IMSIZE/4), int((2-yt)*IMSIZE/4)
        # check traj still in plot area
if 0 <= ixt and ixt < IMSIZE and 0 <= iyt and iyt < IMSIZE:   
            img[ixt,iyt] += 1    

# start with value 1 because take logs later
buddha = np.ones([IMSIZE,IMSIZE]) 
abuddha = np.ones([IMSIZE,IMSIZE]) 
for i in range(IMSIZE*IMSIZE*10):
    z = np.complex(np.random.uniform()*4-2, np.random.uniform()*4-2)
    traj, traja = mandelbrot(z, k)
    updateimage(buddha,traj)
    updateimage(abuddha,traja)
                
buddha = np.square(np.log(buddha)) # to extend small numbers
abuddha = np.log(abuddha)          # to extend small numbers

plt.axis('off')
plt.imshow(buddha, cmap='cubehelix')
plt.show()    
plt.imshow(abuddha, cmap='cubehelix')
plt.show()
These plots are more are computationally expensive to produce than the plain Mandelbrot set plots: it is good to have a large number of initial points, and a long trajectory run.  There are some beautifully detailed figures on the Wikipedia page.

As before, we can iterate using different powers of \(k\), and get analogues of the Buddhabrot.
\(k = 2.5\), the "piggy-brot"
More figures and animations of the Mandelbrot set, the Julia set, and the Buddhabrot, are available on my website.


Saturday 16 May 2020

Julia set

Before the Mandelbrot set came the closely related Julia set.

Consider the sequence \(z_0=z; z_{n+1} = z_n^2 + c\), where \(z\) and \(c\) are complex numbers.  Consider a given value of \(c\).  Then for some values of \(z\), the sequence diverges to infinity; for other values it stays bounded.  The Julia set is the border of the region(s) between which the values of \(z\) do or do not diverge.  Plotting these \(z\) points in the complex plane (again plotting the points that do diverge in colours that represent how fast they diverge) gives a picture that depends on the value of \(c\):

\(c = -0.5+0.5i\), a point well inside the Mandelbrot set
\(c = -0.5+0.6i\), a point just inside the Mandelbrot set
\(c = -0.5+0.7i\), a point outside the Mandelbrot set
If the point \(c\) is inside the Mandelbrot set, the corresponding Julia set is one connected border around one connected region.  If it is outside, there are instead many disconneted regions.  The deeper inside the Mandelbrot set, the larger and rounder the black region in the Julia set looks; the further outside the Mandelbrot set, the smaller and hence paler he Julia set looks.

This leads to the idea of plotting the Mandelbrot set in a rather different way.  For each value of \(c\), instead of plotting a pixel in a colur representing the speed of divergence, plot a little image of the associated Julia set, whose overall colour is related to the speed of divergence:

Julia sets mapping out the Mandelbrot set

As with the Mandelbrot set, we can construct related fractals by iterating different powers, \(z_0=z; z_{n+1} = z_n^k + c\):

\(k=3, c = -0.5+0.598i\)
\(k=4, c = -0.5+0.444i\)

The code is just as simple as, and very similar to, the Mandelbrot code, too:
import numpy  as np
import matplotlib.pyplot as plt

IMSIZE = 512 # image width/height 
ITER = 256

def julia(z, c, k=2): 
    # z = position, complex ; c = constant, complex; k = power, real
    z = z
    for i in range(1, ITER): 
        z = z ** k + c 
        if abs(z) > 2: 
            return 4 + i % 16 #16 colours
    return 0
    
julie = np.zeros([IMSIZE,IMSIZE]) 
c = np.complex(-0.5,0.5)

for ix in range(IMSIZE):  
    x = 4 * ix / IMSIZE - 2
    for iy in range(IMSIZE):
        y = 2 - 4 * iy / IMSIZE
        julie[iy,ix] = julia(np.complex(x,y), c, 5)
        
julie[0,0]=0   # kludge to get uniform colour maps for all plots

plt.axis('off')
plt.imshow(julie, cmap='cubehelix')
plt.show()