Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F875330
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
dereckson
Feb 24 2020, 07:42
2020-02-24 07:42:25 (UTC+0)
Size
816 B
Referenced Files
None
Subscribers
None
raw.txt
View Options
WITH RECURSIVE
-- Grid of points for which the Mandelbrot set will be approximated
xaxis(x) as (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x < 1.2),
yaxis(y) as (VALUES(-1.0) UNION ALL SELECT y+0.10 FROM yaxis WHERE y < 1.0),
-- Mandelbrot iterations
m(iter, cx, cy, x, y) AS (
SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis
UNION ALL
SELECT iter + 1, cx, cy, x*x - y*y + cx, x*y*(x+y) + cy FROM m
WHERE (x*x + y*y) < 4.0 AND iter < 28
),
m2(iter, cx, cy) AS (
SELECT max(iter), cx, cy FROM m GROUP BY cx, cy
),
-- ASCII representation line per line
a(t) AS (
SELECT group_concat(substr(' .+*#', 1 + min(iter/7, 4), 1), '')
FROM m2 GROUP BY cy
)
-- All lines
SELECT group_concat(rtrim(t), x'0a') FROM a;
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
368561
Default Alt Text
raw.txt (816 B)
Attached To
Mode
P291 mandelbrot-inspired-spaceship.sql
Attached
Detach File
Event Timeline
Log In to Comment