Learn › Asking your AI

Asking your AI: advanced

Exact programs and the elucid8 command: commands and coordinates are expected here.

Works in chats that run code (with internet) and coding agents with a terminal. Lesson 5 needs a coding agent on your own computer: it starts a service there and opens it in your browser.

  1. One value against the whole picture

    Paste this into your AI chat:

    Read https://elucid8-lang.org/llms.txt first. Then install eLucid8 (pip install elucid8), save this program as mandelbrot.el8 exactly as written, use elucid8 run to give me the count at k = 30, x = 92, y = 103, and use elucid8 check --explain to tell me how many values are computed for that one pixel and for the whole picture (x = 0..191, y = 0..191), with the totals.
    
    cx = restrict -2.2 + #x * 0.015625 to (x : 192) end
    cy = restrict -1.5 + #y * 0.015625 to (y : 192) end
    escaped = zr * zr + zi * zi > 4
    zr = restrict 0 fby.k (if escaped then zr else zr * zr - zi * zi + cx) to (k : 31, x : 192, y : 192) end
    zi = restrict 0 fby.k (if escaped then zi else 2 * zr * zi + cy) to (k : 31, x : 192, y : 192) end
    n_steps = restrict 0 fby.k (if escaped then n_steps else n_steps + 1) to (k : 31, x : 192, y : 192) end

    What comes back: The pixel’s count is 28, from 123 values computed. The whole picture needs 4,460,928.

    What it teaches: Measuring demand.

  2. The exact run to a file

    In the same chat as lesson 1.

    Paste this into your AI chat:

    Now draw the whole picture: run elucid8 run mandelbrot.el8 -q "n_steps[k = 30, x = 0..191, y = 0..191]" -o mandelbrot.npz, load mandelbrot.npz with numpy, take n_steps_value[0], transpose it, save it with matplotlib as mandelbrot.png (origin="lower", colour map "magma"), and show me the PNG.

    What comes back: The Mandelbrot set as a PNG (192 × 192, counts 1 to 30).

    What it teaches: Reproducible runs, queries over ranges, files out.

  3. The steps behind a value

    In the same chat as lesson 1.

    Paste this into your AI 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.

    What comes back: A row per step, k = 25 to 30: escaped first true at k = 28; from then on n_steps stays 28 and zr and zi stop changing.

    What it teaches: An iteration dimension, read step by step.

  4. Messy data with the given program

    Paste this into your AI chat:

    Read https://elucid8-lang.org/llms.txt first. Then install eLucid8 (pip install elucid8) and 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
    
    Then 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.

    What comes back: all is an error, via temp[t = 6]: sensor fault, with a warning that one missing point was left out; clean is 16.5.

    What it teaches: Aggregates that leave out missing data and say so; errors that name their origin.

  5. Deploy it and watch it live

    With a coding agent on your computer.

    Paste this into your AI chat:

    Read https://elucid8-lang.org/llms.txt first. Then use eLucid8 to make a sine wave that grows by one point every 50 milliseconds, run it as a live service with elucid8 serve, and open it in the eLucid8 Player so I can watch it grow.

    What comes back: A short program and a deploy.json with the built-in clock every 50 ms, the service running on your computer, and the Player open in your browser, the wave growing a point at a time.

    What it teaches: serve, deploy.json, the Player.

  6. A correction

    In the same chat as lesson 4.

    Paste this into your AI chat:

    The reading at t = 2 has come in late: it was 16. Add to sensor.el8 the running mean of the good readings, hour by hour. Run it with elucid8 serve, ask it for every hour, then give the service the corrected readings and ask again. Show me both tables, and which hours changed.

    What comes back: Two tables of eight hours; hours 0 and 1 unchanged (they come before the late reading), hours 2, 3, 5, 6 and 7 changed, hour 4 the same by coincidence (16 either way).

    What it teaches: Exact recomputation after corrected data.

Next: Why not just Python? → eLucid8 beside Python, continuing from the exact run.