Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -1,35 +1,35 @@
|
|||
class Complex {
|
||||
double _r,_i;
|
||||
double _r, _i;
|
||||
|
||||
Complex(this._r,this._i);
|
||||
double get r => _r;
|
||||
double get i => _i;
|
||||
String toString() => "($r,$i)";
|
||||
Complex(this._r, this._i);
|
||||
get r => _r;
|
||||
get i => _i;
|
||||
toString() => "($r,$i)";
|
||||
|
||||
Complex operator +(Complex other) => new Complex(r+other.r,i+other.i);
|
||||
Complex operator *(Complex other) =>
|
||||
new Complex(r*other.r-i*other.i,r*other.i+other.r*i);
|
||||
double abs() => r*r+i*i;
|
||||
operator +(Complex other) => Complex(r + other.r, i + other.i);
|
||||
operator *(Complex other) =>
|
||||
Complex(r * other.r - i * other.i, r * other.i + other.r * i);
|
||||
abs() => r * r + i * i;
|
||||
}
|
||||
|
||||
void main() {
|
||||
double start_x=-1.5;
|
||||
double start_y=-1.0;
|
||||
double step_x=0.03;
|
||||
double step_y=0.1;
|
||||
const startX = -1.5;
|
||||
const startY = -1.0;
|
||||
const stepX = 0.03;
|
||||
const stepY = 0.1;
|
||||
|
||||
for(int y=0;y<20;y++) {
|
||||
String line="";
|
||||
for(int x=0;x<70;x++) {
|
||||
Complex c=new Complex(start_x+step_x*x,start_y+step_y*y);
|
||||
Complex z=new Complex(0.0, 0.0);
|
||||
for(int i=0;i<100;i++) {
|
||||
z=z*(z)+c;
|
||||
if(z.abs()>2) {
|
||||
for (int y = 0; y < 20; y++) {
|
||||
String line = "";
|
||||
for (int x = 0; x < 70; x++) {
|
||||
var c = Complex(startX + stepX * x, startY + stepY * y);
|
||||
var z = Complex(0.0, 0.0);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
z = z * z + c;
|
||||
if (z.abs() > 2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
line+=z.abs()>2 ? " " : "*";
|
||||
line += z.abs() > 2 ? " " : "*";
|
||||
}
|
||||
print(line);
|
||||
}
|
||||
|
|
|
|||
9
Task/Mandelbrot-set/Uiua/mandelbrot-set.uiua
Normal file
9
Task/Mandelbrot-set/Uiua/mandelbrot-set.uiua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Size ← 800
|
||||
Cs ← ÷ 5[5_5_5 4_5_5 4_5_5 3_5_5 5_3_5 3_3_5 2_5_0 5_2_2 2_2_5 0_0_0]
|
||||
# Initialise complex co-ordinates.
|
||||
×2.5 ⊞ℂ:-1/4. ÷:-÷2,⇡.⟜(↯:0⊟.)Size
|
||||
# Iterate 50 times (a, b, got_there) -> (a*a+b, b, got_there)
|
||||
# got_there counts when corresponding value in b hits 2.
|
||||
⍥⊃(+×.|⋅∘|+<2⌵⊙◌)50 0
|
||||
# Scale the results down and display
|
||||
⊏:Cs⌈×9÷:⟜(/↥/↥)ₙ2◌◌
|
||||
Loading…
Add table
Add a link
Reference in a new issue