Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Paste
P291
mandelbrot-inspired-spaceship.sql
Active
Public
Actions
Authored by
dereckson
on Feb 24 2020, 07:42.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F875330: raw.txt
Feb 24 2020, 07:42
2020-02-24 07:42:25 (UTC+0)
Subscribers
None
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
;
Event Timeline
dereckson
edited the content of this paste.
(Show Details)
Feb 24 2020, 07:42
2020-02-24 07:42:25 (UTC+0)
dereckson
changed the title of this paste from untitled to
mandelbrot-inspired-spaceship.sql
.
dereckson
mentioned this in
P290 ASCII art inspired by Mandelbrot set equations
.
Feb 24 2020, 08:48
2020-02-24 08:48:59 (UTC+0)
Log In to Comment