Solved Task 3
This commit is contained in:
parent
2f141642f6
commit
a69573b5ad
|
@ -41,6 +41,18 @@ import matplotlib.pyplot as plt
|
|||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
def fixpunkt(alpha):
|
||||
print('Alpha:', alpha)
|
||||
k = 0.1
|
||||
F = lambda x: alpha * x * (1 - x)
|
||||
y = np.array([])
|
||||
for j in range(100):
|
||||
y = np.append(y, k)
|
||||
k = F(k) # y-Werte, Fixpunktgleichung: k = a * k * (1-k)
|
||||
print(y)
|
||||
return y
|
||||
|
||||
|
||||
alphaList = np.array([0.25, 0.5, 0.75, 1.00, 1.25, 1.50, 1.75, 2.00, 2.25, 2.50, 2.75, 3.00]) # alpha anziehend
|
||||
alphaList = np.append(alphaList, [3.25, 3.5, 3.75, 4.0]) # alpha abstossend
|
||||
k = np.arange(0.00, 4.00, pow(10, -2)) # x-Werte
|
||||
|
@ -54,13 +66,3 @@ for currentAlpha in alphaList:
|
|||
plt.show()
|
||||
|
||||
|
||||
def fixpunkt(alpha):
|
||||
print('Alpha:', alpha)
|
||||
k = 0.1
|
||||
F = lambda x: alpha * x * (1 - x)
|
||||
y = np.array([])
|
||||
for j in range(100):
|
||||
y = np.append(y, k)
|
||||
k = F(k) # y-Werte, Fixpunktgleichung: k = a * k * (1-k)
|
||||
print(y)
|
||||
return y
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,21 @@
|
|||
import numpy as np
|
||||
import matplotlib as plt
|
||||
|
||||
def fixpunkt(k):
|
||||
iterationsgleichung = np.sin(k) + 0.5 * np.pi # sin calculation is in rad
|
||||
error = pow(10, -3)
|
||||
if np.abs(iterationsgleichung - k) < error:
|
||||
return iterationsgleichung
|
||||
return fixpunkt(iterationsgleichung)
|
||||
|
||||
|
||||
print("Der Winkel phi beträgt bis auf drei Stellen nach dem Komma genau:", np.degrees(fixpunkt(2))) # 2 is in rad
|
||||
# Der Winkel phi beträgt bis auf drei Stellen nach dem Komma genau: 132.3464587947431 Grad.
|
||||
|
||||
# c)
|
||||
# h berechnet sich aus diesem Zusammenhang
|
||||
# cos(phi/2) = (r - h) / r
|
||||
# Oder alternativ: Höhe Kreissegment: h = (r * ( 1 - cos(phi2))
|
||||
# Gesamthöhe: 2 r
|
||||
# Daher: h = 2 * r - (r * ( 1 - cos(phi/2)))
|
||||
print('Die gesucht Formel für h lautet: h = r - r * cos(phi/2)', 'oder: 2 * r - (r * ( 1 - cos(phi/1.5)))')
|
Loading…
Reference in New Issue