September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,29 +1,13 @@
|
|||
GraphicsWindow.Show()
|
||||
size = 500
|
||||
half = 250
|
||||
GraphicsWindow.Width = size * 1.5
|
||||
GraphicsWindow.Height = size
|
||||
GraphicsWindow.Title = "Mandelbrot"
|
||||
For px = 1 To size * 1.5
|
||||
x_0 = px/half - 2
|
||||
For py = 1 To size
|
||||
y_0 = py/half - 1
|
||||
x = x_0
|
||||
y = y_0
|
||||
i = 0
|
||||
While(c <= 2 AND i<100)
|
||||
x_1 = Math.Power(x, 2) - Math.Power(y, 2) + x_0
|
||||
y_1 = 2 * x * y + y_0
|
||||
c = Math.Power(Math.Power(x_1, 2) + Math.Power(y_1, 2), 0.5)
|
||||
x = x_1
|
||||
y = y_1
|
||||
i = i + 1
|
||||
EndWhile
|
||||
If i < 99 Then
|
||||
GraphicsWindow.SetPixel(px, py, GraphicsWindow.GetColorFromRGB((255/25)*i, (255/25)*i, (255/5)*i))
|
||||
Else
|
||||
GraphicsWindow.SetPixel(px, py, "black")
|
||||
EndIf
|
||||
c=0
|
||||
EndFor
|
||||
EndFor
|
||||
10 FOR X=-2 TO 2 STEP 0.1
|
||||
20 FOR Y=-2 TO 2 STEP 0.1
|
||||
30 LET XA=0
|
||||
40 LET YA=0
|
||||
50 LET ITER=0
|
||||
60 LET XTEMP=XA*XA-YA*YA+X
|
||||
70 LET YA=2*XA*YA+Y
|
||||
80 LET XA=XTEMP
|
||||
90 LET ITER=ITER+1
|
||||
100 IF XA*XA+YA*YA<=4 AND ITER<200 THEN GOTO 60
|
||||
110 IF ITER<200 THEN PLOT X*10+20,Y*10+20
|
||||
120 NEXT Y
|
||||
130 NEXT X
|
||||
|
|
|
|||
|
|
@ -1,15 +1,29 @@
|
|||
Function mandel(xi As Double, yi As Double)
|
||||
|
||||
maxiter = 256
|
||||
x = 0
|
||||
y = 0
|
||||
|
||||
For i = 1 To maxiter
|
||||
If ((x * x) + (y * y)) > 4 Then Exit For
|
||||
xt = xi + ((x * x) - (y * y))
|
||||
y = yi + (2 * x * y)
|
||||
x = xt
|
||||
Next
|
||||
|
||||
mandel = i
|
||||
End Function
|
||||
GraphicsWindow.Show()
|
||||
size = 500
|
||||
half = 250
|
||||
GraphicsWindow.Width = size * 1.5
|
||||
GraphicsWindow.Height = size
|
||||
GraphicsWindow.Title = "Mandelbrot"
|
||||
For px = 1 To size * 1.5
|
||||
x_0 = px/half - 2
|
||||
For py = 1 To size
|
||||
y_0 = py/half - 1
|
||||
x = x_0
|
||||
y = y_0
|
||||
i = 0
|
||||
While(c <= 2 AND i<100)
|
||||
x_1 = Math.Power(x, 2) - Math.Power(y, 2) + x_0
|
||||
y_1 = 2 * x * y + y_0
|
||||
c = Math.Power(Math.Power(x_1, 2) + Math.Power(y_1, 2), 0.5)
|
||||
x = x_1
|
||||
y = y_1
|
||||
i = i + 1
|
||||
EndWhile
|
||||
If i < 99 Then
|
||||
GraphicsWindow.SetPixel(px, py, GraphicsWindow.GetColorFromRGB((255/25)*i, (255/25)*i, (255/5)*i))
|
||||
Else
|
||||
GraphicsWindow.SetPixel(px, py, "black")
|
||||
EndIf
|
||||
c=0
|
||||
EndFor
|
||||
EndFor
|
||||
|
|
|
|||
15
Task/Mandelbrot-set/BASIC/mandelbrot-set-9.basic
Normal file
15
Task/Mandelbrot-set/BASIC/mandelbrot-set-9.basic
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
Function mandel(xi As Double, yi As Double)
|
||||
|
||||
maxiter = 256
|
||||
x = 0
|
||||
y = 0
|
||||
|
||||
For i = 1 To maxiter
|
||||
If ((x * x) + (y * y)) > 4 Then Exit For
|
||||
xt = xi + ((x * x) - (y * y))
|
||||
y = yi + (2 * x * y)
|
||||
x = xt
|
||||
Next
|
||||
|
||||
mandel = i
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue