Why not just Python?
The steps on this page continue in the chat where you did lessons 1 and 2 of Asking your AI: advanced, which save a given program and draw the Mandelbrot set from it.
You could. Python is a conventional imperative language that AI agents know well, and for a picture like this it is fine.
In eLucid8, the mathematical equations define the complete solution, and eduction materialises that solution.
- Only the part you ask for is materialised: 123 values for one pixel, against 4,460,928 for the whole picture.
- Any value can be dropped and materialised again with the same answer, to the last bit, which is how a long-running service keeps within a memory budget.
- One query can be spread over many threads (18 in our measurements), with the same answers on any number.
Everything else in eLucid8 (caches, compiled loops, threads) is a way of speeding up that materialisation, and none of it changes the answer. GPUs are next on that path, under the same rule.
Ask that chat four more things, and see what eLucid8 gives you that Python leaves to you.
One pixel, and how much was computed
The pixel’s count is 28, from 123 values computed. The whole picture needs 4,460,928.
The values, name by name
value one pixel whole picture cx,cy1 each 192 each zr,zi,escaped30 each 1,105,920 each n_steps31 1,142,784 total 123 4,460,928 From the output of
elucid8 check --explain(elucid8 0.25.0): the pixel’s steps, k = 0 to 30, and nothing of its neighbours.Paste into the same chat:Now ask for just one pixel, near the edge of the set: run elucid8 run mandelbrot.el8 -q "n_steps[k = 30, x = 92, y = 103]". Then run elucid8 check mandelbrot.el8 -q "n_steps[k = 30, x = 92, y = 103]" --explain, and the same with the whole grid (x = 0..191, y = 0..191), and show me in a short table how many values of each name were computed for the one pixel and for the whole picture, with the totals.
Why it’s 28
Its z stays within radius 2 for exactly 28 steps, k = 0 to 27. At step 28, zr² + zi² is 9.64, past 4:
escapedturns true and the count stays at 28.The values over steps 25 to 30
k zr zi zr² + zi² escaped n_steps 25 −0.967 0.611 1.31 false 25 26 −0.202 −1.072 1.19 false 26 27 −1.870 0.542 3.79 false 27 28 2.442 −1.916 9.64 true 28 29 2.442 −1.916 9.64 true 28 30 2.442 −1.916 9.64 true 28 eLucid8’s answers at this pixel (elucid8 0.25.0), rounded; zr² + zi² added by hand.
Paste into the same chat:Why is that pixel's count what it is? Ask eLucid8 for the steps behind it: run elucid8 run mandelbrot.el8 --format csv -q "n_steps[k = 25..30, x = 92, y = 103]" -q "escaped[k = 25..30, x = 92, y = 103]" -q "zr[k = 25..30, x = 92, y = 103]" -q "zi[k = 25..30, x = 92, y = 103]", show the answers as one table with a row per step k, and explain from the equations why the count stops where it does.
Messy data
Eight temperature readings, one missing and one a sensor fault, and a program that takes their mean two ways.
Paste into the same chat:Now some messy data. Save this as temp.csv (eight readings: the one at t = 2 is missing, the one at t = 6 is a sensor fault): t,value 0,15 1,15.5 2, 3,16.5 4,17 5,17 6,error: sensor fault 7,18 and this as sensor.el8: temp = input("temp", t : 8) all = mean temp over (t : 8) end clean = mean temp over (t : 8) if not iserror(temp) end Tell me when both are saved.
Their mean
From eLucid8, and from pandas:
eLucid8 $ elucid8 run sensor.el8 -q all -q clean --format csvelucid8 run: warning: query 1 (all): aggregates left out 1 missing point of input tempname,all_value,clean_valueall,error: via temp[t = 6]: sensor fault,clean,,16.5
allleaves out the missing reading and says so, and is an error naming the faulty one,temp[t = 6].cleanleaves out errors: 16.5, the mean of the six good readings.pandas, the usual way df = pd.read_csv("temp.csv")print(df["value"].mean())TypeError: Cannot perform reduction 'mean' with string dtype
It refuses, rightly (the fault’s text made the column text), but doesn’t say which row, or that a reading is missing. The usual fix:
values = pd.to_numeric(df["value"], errors="coerce")print(values.mean())16.5
Both bad readings became NaN and were skipped, silently.
values.isna().sum()counts them (2), but not which was missing and which was faulty.The same file, with elucid8 0.25.0 and pandas 3.1.1.
Paste into the same chat:Now run elucid8 run sensor.el8 -q all -q clean --format csv (no deploy.json is needed: the file is named after the input), show me its output, and tell me what each mean says about the bad readings.
There is more Python leaves to you: a live service that takes new data as it arrives; after a correction, recomputing only the values that read it (106 of them in the features example); and timestamps on every value, so a feature that read its own future is caught by one comparison.