Salut,

J'ai trouvé un post qui traite l'algorithme Mandelbrot sur OTN.


Algorithme de Mandelbrot.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
For each pixel on the screen do:
{
  x = x0 = x co-ordinate of pixel
  y = y0 = y co-ordinate of pixel
 
  iteration = 0
  max_iteration = 1000
 
  while ( x*x + y*y <= (2*2)  AND  iteration < max_iteration ) 
  {
    xtemp = x*x - y*y + x0
    y = 2*x*y + y0
 
    x = xtemp
 
    iteration = iteration + 1
  }
 
  if ( iteration == max_iteration ) 
  then 
    color = black
  else 
    color = iteration
 
  plot(x0,y0,color)
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
SQL> set linesize 150
SQL> set pagesize 110
SQL> with ord as (SELECT M xyz  FROM DUAL MODEL  DIMENSION BY (0 P) MEASURES( 0 M) (M[FOR P FROM 0 T
O 99 INCREMENT 1 ]=CV(P)))
  2  , xgen as (
  3    select -2.2 + xyz*0.031 cx, xyz ix
  4      from ord)
  5  , ygen as (
  6    select -1.5 + xyz*0.031 cy, xyz iy
  7      from ord)
  8  , z as (
  9    select ix, iy, i
 10      from xgen, ygen
 11     model partition by (ix, iy)
 12           dimension by (0 i)
 13           measures (cx, cy
 14                   , cx x
 15                   , cy y
 16           )
 17           ignore nav
 18           rules iterate (100) 
 19                   until (X[iteration_number] * X[iteration_number] + 
 20                          Y[iteration_number] * Y[iteration_number] > 16) (
 21             cx[iteration_number] = cx[cv()]+cx[cv()-1]
 22           , cy[iteration_number] = cy[cv()]+cy[cv()-1]
 23           , x[iteration_number] = cx[cv()]+x[cv()-1]*x[cv()-1]-y[cv()-1]*y[cv()-1]
 24           , y[iteration_number] = cy[cv()]+y[cv()-1]*x[cv()-1]*2
 25           )
 26  )
 27  select replace(ltrim(max(sys_connect_by_path(i,'|')) keep (dense_rank last partition by ix),'|'
),'|')
 28     from (select ix, iy, substr(' .,,,-----++++%%%%@@@@### ',least(max(i),26),1) i from z group 
by ix, iy)
 29            connect by iy = prior iy and ix = prior ix + 1
 30            start with ix = 1
 31            group by iy;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
 
<div style="margin-left:40px">
REPLACE(LTRIM(MAX(SYS_CONNECT_BY_PATH(I,'|'))KEEP(DENSE_RANKLASTPARTITIONBYIX),'|'),'|')
----------------------------------------------------------------------------------------------------
            ....................................................................................
           .......................................................................................
          .........................................................................................
         ..........................................................................................
       ....................................................,,,,,,,,,...............................
      ................................................,,,,,,,,,,,,,,,,,,...........................
     ..............................................,,,,,,,,,,,,,,,,,,,,,,,,........................
    ............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
    ..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
   .........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..................
  ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................
 .......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...............
.......................................,,,,,,,,,,,,,,,,,,,,,,,,--,,,,,,,,,,,,,,,,,,,,..............
.....................................,,,,,,,,,,,,,,,,,,,,,,,,,,-+--,,,,,,,,,,,,,,,,,,,.............
...................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----,,,,,,,,,,,,,,,,,,,............
..................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,--- -----,,,,,,,,,,,,,,,,,...........
................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---++--++,,,,,,,,,,,,,,,,,,..........
...............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----%++---,,,,,,,,,,,,,,,,,..........
.............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%----,,,,,,,,,,,,,,,,,,.........
............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----- %%+----,,,,,,,,,,,,,,,,,,........
..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---%-+%   ----,,,,,,,,,,,,,,,,,,,.......
.........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+ + #  %+%---,,,,,,,,,,,,,,,,,,.......
.......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----#      # +---,,,,,,,,,,,,,,,,,,......
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------%       %-----,,,,,,,,,,,,,,,,,......
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------+         ------,,,,,,,,,,,,,,,,,.....
...................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----------+@       +-----------,,,,,,,,,,,,.....
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----@-------++       ++-----------,,,,,,,,,,,,....
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--+@% ---+ +@%%@     %%+@+@%------+-,,,,,,,,,,,....
...............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----  # ++%               % @-----++--,,,,,,,,,,,...
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----+    %                  %%++ %+%@-,,,,,,,,,,,...
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+                         %    ++-,,,,,,,,,,,,..
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------+                             @---,,,,,,,,,,,,..
.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------++%                             ---,,,,,,,,,,,,..
........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+ +                             %+---,,,,,,,,,,,,,.
.......,,,,,,,,,,,,,,,,,,,,,--------------------@                                +----,,,,,,,,,,,,.
......,,,,,,,,,,,,,,,,,,,,,,- +-----------------+                                 ----,,,,,,,,,,,,.
......,,,,,,,,,,,,,,,,,,,,,--++------+---------+%                                 +++--,,,,,,,,,,,,
.....,,,,,,,,,,,,,,,,,,,,,,--%+-----++---------                                     #+-,,,,,,,,,,,,
....,,,,,,,,,,,,,,,,,,,,,,----#%++--+@ -+-----+%                                     --,,,,,,,,,,,,
....,,,,,,,,,,,,,,,,,,,,,,-----+## ++@ + +----%                                    +--,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,,,,,------+@  @     @@++++#                                   +--,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,,,,-------%           #++%                                      -,,,,,,,,,,,,,
..,,,,,,,,,,,,,,,,,,,,,------++%#           %%@                                     %-,,,,,,,,,,,,,
..,,,,,,,,,,,,,,,,,,,--------+               %                                     +--,,,,,,,,,,,,,
..,,,,,,,,,,,,,,,,,,-----+--++@              #                                      --,,,,,,,,,,,,,
.,,,,,,,,,,,,,,,,,-------%+++%                                                    @--,,,,,,,,,,,,,,
.,,,,,,,,,,,-------------+ @ @                                                    ---,,,,,,,,,,,,,,
.,,,,,,,,,---@--------@-+%                                                       +---,,,,,,,,,,,,,,
.,,,,,------- +-++++-+%%%                                                       +----,,,,,,,,,,,,,,
.,,,,,,------%--------++%                                                       +----,,,,,,,,,,,,,,
.,,,,,,,,,,--+----------++#                                                       ---,,,,,,,,,,,,,,
.,,,,,,,,,,,,------------+@@@%                                                    +--,,,,,,,,,,,,,,
.,,,,,,,,,,,,,,,,,------- +++%                                                    %--,,,,,,,,,,,,,,
..,,,,,,,,,,,,,,,,,,---------+@              @                                      --,,,,,,,,,,,,,
..,,,,,,,,,,,,,,,,,,,,------- #              %@                                    +--,,,,,,,,,,,,,
..,,,,,,,,,,,,,,,,,,,,,-------++@           %+                                      %-,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,,,,-------            %++%                                     %-,,,,,,,,,,,,,
...,,,,,,,,,,,,,,,,,,,,,,------+#  %#   #@ ++++                                    +--,,,,,,,,,,,,,
....,,,,,,,,,,,,,,,,,,,,,,-----+ %%++% +@+----+                                    +--,,,,,,,,,,,,,
....,,,,,,,,,,,,,,,,,,,,,,,---%+++--+#+--------%                                    #--,,,,,,,,,,,,
.....,,,,,,,,,,,,,,,,,,,,,,--++-----%%---------                                    @#--,,,,,,,,,,,,
......,,,,,,,,,,,,,,,,,,,,,---------------------+@                                +-++,,,,,,,,,,,,.
.......,,,,,,,,,,,,,,,,,,,,,--------------------+                                 ----,,,,,,,,,,,,.
........,,,,,,,,,,,,,,,,,,,,----,,,-------------                                #+----,,,,,,,,,,,,.
.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------+ +                              +---,,,,,,,,,,,,,.
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+%#                           #---,,,,,,,,,,,,..
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------+#                        @   @---,,,,,,,,,,,,..
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+#                        +    @--,,,,,,,,,,,,..
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+%   %+@                 %+-+ +++%-,,,,,,,,,,,...
...............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----% %@++              # %  -----++-,,,,,,,,,,,,...
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-- ++ ---+ + +%@     %++++++------%-,,,,,,,,,,,....
..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---- -------++       +------------,,,,,,,,,,,,....
...................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----------+%       +--------,,,,,,,,,,,,,,,.....
.....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+         -----,,,,,,,,,,,,,,,,,,.....
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------+        ----,,,,,,,,,,,,,,,,,,......
........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----+%      %#---,,,,,,,,,,,,,,,,,,,......
.........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+%+%@  %+%%--,,,,,,,,,,,,,,,,,,.......
...........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+-+%  %----,,,,,,,,,,,,,,,,,,........
............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%@+---,,,,,,,,,,,,,,,,,,,........
..............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%----,,,,,,,,,,,,,,,,,,.........
...............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----%+ +--,,,,,,,,,,,,,,,,,..........
.................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---++----,,,,,,,,,,,,,,,,,...........
..................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,---@-----,,,,,,,,,,,,,,,,,...........
....................................,,,,,,,,,,,,,,,,,,,,,,,,,,,-----,,,,,,,,,,,,,,,,,,,............
.....................................,,,,,,,,,,,,,,,,,,,,,,,,,,--%,,,,,,,,,,,,,,,,,,,,.............
.......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...............
 ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................
  ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................
   .........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..................
    ..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
     ............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
      .............................................,,,,,,,,,,,,,,,,,,,,,,,,........................
       ................................................,,,,,,,,,,,,,,,,,...........................
        .....................................................,,,,..................................
         ..........................................................................................
          .........................................................................................
           ......................................................................................
            ....................................................................................
              .................................................................................
               ..............................................................................
 
100 rows selected.
 
SQL> 
SQL></div>