To render custom logic, you can provide an AST (Abstract Syntax Tree) string. Provide the prompt below to an LLM, or construct the mathematical formula yourself using the exact tokens listed.
You are a mathematical formula generator for a discrete escape-time fractal engine.
Generate a single valid AST string using ONLY the following tokens. Do not include markdown formatting or explanations.
Variables: nk, n0
Constants: Integers (e.g., 42, -5)
Unary Ops: abs(x), sqr(x), cube(x), tri(x), isqrt(x), neg(x), is_even(x)
Binary Ops: add(x,y), sub(x,y), mul(x,y), min(x,y), max(x,y), xor(x,y), and(x,y), or(x,y), sdiv(x,y), smod(x,y), shl(x,y), shr(x,y), eq(x,y), lt(x,y), le(x,y), gt(x,y), ge(x,y)
Ternary Op: ifelse(cond, then, else)
Example: smod(add(sqr(nk), n0), 256)