From dbe22e183f9193905a246bcc339226a11d9c2577 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 15 Dec 2022 22:23:59 +0100 Subject: [PATCH] Solved Task 3 --- Schenk_Brandenberger_S11_Aufg3.py | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Schenk_Brandenberger_S11_Aufg3.py diff --git a/Schenk_Brandenberger_S11_Aufg3.py b/Schenk_Brandenberger_S11_Aufg3.py new file mode 100644 index 0000000..6ead0dd --- /dev/null +++ b/Schenk_Brandenberger_S11_Aufg3.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +""" +Created on Sun Nov 29 14:43:17 2020 + +Höhere Mathematik 1, Serie 11, Aufgabe 3 (Gerüst) + +@author: knaa +""" +import numpy as np +import matplotlib.pyplot as plt + + +detail = 1000 #number of pixels in x and y direction +maxit = 70 #maximum n for iterations +x_min = -2 #minimim value of x-interval +x_max = 0.7 #maximum value of x-interval +y_min = -1.4 #minimim vale of y-interval +y_max = 1.4 #minimim vale of y-interval + +a = np.linspace(x_min, x_max, detail, dtype=np.float64) #define real axis [x_min,x_max] +b = np.linspace(y_min, y_max, detail, dtype=np.float64) #define imaginary axis [y_min,y_max] + +B = np.zeros((detail,detail)) #for color valzues n + +[x,y] = np.meshgrid(a, b) #to create the complex plane with the axes defined by a and b +C = x+y*1j #creating the plane +Z = np.zeros((detail, detail), np.complex64) #initial conditions (first iteration), Z has same dimension as C +for n in np.arange(1,maxit+1): #start iteration + Z = Z**2 + C #calculating Z + expl = np.where(np.abs(Z) > 2.0) #finding exploded values (i.e. with an absolute value > 2) + Z[expl] = 0 #removing from iteration + C[expl] = 0 #removing from plane + B[expl] = n #saving color value n + +plt.figure(1) +B = B/np.max(np.max(B)) #deviding by max value for correct color +plt.imshow(B,extent=[x_min,x_max,y_min,y_max],origin='lower',interpolation='bilinear') #display image + +plt.show()