Spaß-mit-Mathematik.de

Des Schockwellenreiters Seiten über (Unterhaltungs-) Mathematik

Suchen in:
Suche:
In Partnerschaft mit Amazon.de
Startseite | Schockwellenreiter | Impressum

Fraktalien Sourcecode


#           -- Die Reise nach Fraktalien --          #
# Copyright (c) 1997 by Jörg Kantel, Berlin-Zehlendorf #
##
phase := proc(x, y, z, u, v)
local
	erg, real, imag, phy, value;
begin
	erg		:= complex_surf(u, v):
	real	:= op(erg, 1):
	imag	:= op(erg, 2):
	if abs(real) > EPS then
		phy := atan(imag/abs(real)):
	else
		phy := sign(imag)*float(PI/2):
	end_if:
	value := (phy - MINPHI)/(MAXPHI - MINPHI):
	if value > 4/5 then
		erg := [1, 5*(1 - value), 0]:
	elif value > 3/5 then
		erg := [1 - 5*(4/5 - value), 1, 0]:
	elif value > 2/5 then
		erg := [0, 1 - 5*(3/5 - value), 5*(3/5 - value)]:
	elif value > 1/5 then
		erg := [5*(2/5 - value), 0, 1]:
	else
		erg := [1, 0, 1 - 5*(1/5 - value)]:
	end_if:
end_proc:
##
MAXPHI := float(PI/2):
MINPHI := -MAXPHI:
EPS	   := 10^(-DIGITS):
##
#------------------------------------------------------------------------------#
# Bunter Kegel #
complex_surf := proc(u, v)
begin
    (u + v*I):
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [5.5, -5.0, 13.0],
            [Mode = Surface,
                  [u, v, abs(complex_surf(u, v))],
                  u = [-2, 2], v = [-2, 2], Grid = [15, 15],
                  Style = [ColorPatches, AndMesh],
                  Color = [Function, phase]
            ]);
##
#------------------------------------------------------------------------------#
# Regenrinne am Hippie-Haus #
complex_surf := proc(u, v)
begin
    sin(u + v*I):
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [5.5, -5.0, 13.0],
			BackGround = [1.0, 1.0, 1.0], ForeGround = [0.0, 0.0, 0.0],
            [Mode = Surface,
                  [u, v, abs(complex_surf(u, v))],
                  u = [-2, 2], v = [-2, 2], Grid = [15, 15],
                  Style = [ColorPatches, AndMesh],
                  Color = [Function, phase]
            ]);
##
#-------------------------------------------------------------------------#
# Farbige Wüstenlandschaft #
complex_surf := proc(u, v)t
begin
    sin(sin(u + v*I)):
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [-22.0, -22.0, 1900.0],
            BackGround = [1.0, 1.0, 1.0], ForeGround = [0.0, 0.0, 0.0],
            [Mode = Surface,
                  [u, v, min(abs(complex_surf(u, v)), 100)],
                  u = [-PI, PI], v = [-PI, PI], Grid = [50, 50],
                  Style = [ColorPatches, AndMesh],
                  Color = [Function, phase]
            ]);
#-------------------------------------------------------------------------#
# Versteinerter Märchenwald #
complex_surf := proc(u, v)
begin
    sin(sin(sin(u + v*I))):
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [-250.0, -250.0, 10^7],
            BackGround = [1.0, 1.0, 1.0], ForeGround = [0.0, 0.0, 0.0],
            [Mode = Surface,
                  [u, v, min(abs(complex_surf(u, v)), 10^5)],
                  u = [-PI, PI], v = [-PI, PI], Grid = [100, 100],
                  Style = [ColorPatches, AndMesh],
                  Color = [Function, phase]
            ]);
##
# Versteinerter Märchenwald (revers)#
plot3d(Axes = Box, Ticks = 0, CameraPoint = [10, -18, 6],
            BackGround = [1.0, 1.0, 1.0], ForeGround = [0.0, 0.0, 0.0],
            Scaling = UnConstrained,
            [Mode = Surface,
                  [u, v, min(1/abs(complex_surf(u, v)), 1.0)],
                  u = [-PI, PI], v = [-PI, PI], Grid = [100, 100],
                  Style = [ColorPatches, AndMesh],
                  Color = [Function, phase]
            ]);
##
# Versteinerter Märchenwald (invers, Contour-Plot) #
plot3d(Axes = Box, Ticks = 0, CameraPoint = [-250.0, -250.0, 10^7],
            BackGround = [1.0, 1.0, 1.0], ForeGround = [0.0, 0.0, 0.0],
            [Mode = Surface,
                  [u, v, min(1/abs(complex_surf(u, v)), 10^5)],
                  u = [-PI, PI], v = [-PI, PI], Grid = [100, 100],
                  Style = [ColorPatches, AndMesh],
                  Color = [Function, phase]
            ]);
##
# Versteinerter Märchenwald (fraktal?, Contour-Plot) #
plot3d(Axes = Box, Ticks = 0, CameraPoint = [-250.0, -250.0, 10^7],
            BackGround = [1.0, 1.0, 1.0], ForeGround = [0.0, 0.0, 0.0],
            [Mode = Surface,
                  [u, v, min(1/abs(complex_surf(u, v)), 1)],
                  u = [-PI, PI], v = [-PI, PI], Grid = [100, 100],
                  Style = [ColorPatches, AndMesh],
                  Color = [Height, [0, 1, 0], [1, 1, 1]]
            ]);
##
#--------------------------------------------------------------------------#
# Alptraum #
complex_surf := proc(u, v)
begin
    ln(ln(sin(sin(sin(u + v*I))) + float(E))):
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [6.5, -8.8, 27.0],
            BackGround = [1.0, 1.0, 1.0], ForeGround = [0.0, 0.0, 0.0],
            Scaling = UnConstrained,
            [Mode = Surface,
                  [u, v, abs(complex_surf(u, v))],
                  u = [-PI, PI], v = [-PI, PI], Grid = [75, 75],
                  Style = [ColorPatches, AndMesh],
                  Color = [Function, phase]
            ]);
##
#--------------------------------------------------------------------------#
# Die Geburt des fraktalen Monsters #
n_complex_surf := proc(u, v)
	local erg, real, imag, i;
begin
	if v = 0 then
		v := EPS:
	end_if:
	real := float(u): 
	imag := float(v):
	erg := sin(real + imag*I): 
	for i from 2 to 4 do
		erg  := sin(erg):
		imag := op(erg, 2):
		if (abs(imag) > 100000) then
			return(10000.0 + 10000.0*I):
		end_if:
	end_for:
	ln(ln(erg + float(E))):
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [5.0, -5.0, 4.0],
            BackGround = [1.0, 1.0, 1.0], ForeGround = [0.0, 0.0, 0.0],
            Scaling = UnConstrained,
            [Mode = Surface,
                  [u, v, min(hold(abs(n_complex_surf(u, v))), 1.0)],
                  u = [-PI, PI], v = [-2, 2], Grid = [50, 50],
                  Style = [ColorPatches, AndMesh],
                  Color = [Function, phase]
            ]);
##
#----------------------------------------------------------------------------#
# Jetzt drehen wir den Spieß um #
EPS	   := 10^(-DIGITS):
##
n_sin_fractal3d := proc(u, v)
	local erg, real, imag, i;
begin
	if v = 0 then
		v := EPS:
	end_if:
	real := float(u): 
	imag := float(v):
	i := 0:
	erg := sin(real + imag*I): 
	while (abs(imag) < 10000) and (i < 100) do
		i := i + 1:
		erg  := sin(erg):
		imag := op(erg, 2):
	end_while:
	i:
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [25.0, -35.0, 1000.0],
            Scaling = UnConstrained, ForeGround = [0.0, 0.0, 0.0],
            [Mode = Surface,
                  [u, v, hold(n_sin_fractal3d(u, v))],
                  u = [-2*PI, 2*PI], v = [-2*PI, 2*PI], Grid = [50, 50],
                  Style = [ColorPatches, AndMesh],
                  Color = [Height, [1, 0, 0], [1, 1, 1]]
             ]);
#----------------------------------------------------------------------------#
#		Die Mandelbrotmenge als 3D-Gebirge
#		Mandelbrot im Abendrot
#
##
mandelbrot := proc(u, v)
	local erg, i; 
begin
	erg := u + v*I:
	i := 0:
	while ( (abs(float(erg)) < 2) and (i < 10) ) do
		erg := erg^4 + (u + v*I):
		i := i + 1:
	end_while:
	i:	
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [3.5, 6.0, 50.6],
            Scaling = UnConstrained, ForeGround = [0.0, 0.0, 0.0],
            [Mode = Surface,
                  [u, v, hold(mandelbrot(u, v))],
                  u = [-1.5, 1.5], v = [-1.5, 1.5], Grid = [50, 50],
                  Style = [ColorPatches, AndMesh],
                  Color = [Height, [0, 0, 1], [1, 0.3, 0]]
             ]);
##
#----------------------------------------------------------------------------#
#		Spirale im Seepferdchental
#
mandelbrot_spiral := proc(u, v)
	local erg, i; 
begin
	erg := u + v*I:
	i := 0:
	while ( (abs(float(erg)) < 2) and (i < 100) ) do
		erg := erg^2 + (u + v*I):
		i := i + 1:
	end_while:
	i:	
end_proc:
##
plot3d(Axes = Box, Ticks = 0, CameraPoint = [0, 0.6, 350000.0],
            Scaling = UnConstrained, ForeGround = [0.0, 0.0, 0.0],
            [Mode = Surface,
                  [u, v, hold(mandelbrot_spiral(u, v))],
                  u = [-0.74591, -0.74448], v = [0.11196, 0.11339],
                  Grid = [50, 50],
                  Style = [ColorPatches, AndMesh],
                  Color = [Height, [0, 0, 1], [1, 0.3, 0]]
             ]);