started Task 4
This commit is contained in:
parent
dff6d7b7b4
commit
e108ba6f08
|
@ -2,17 +2,28 @@ import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import math
|
import math
|
||||||
|
|
||||||
def h(x):
|
def h1(x):
|
||||||
return math.sqrt(100 * math.pow(x,2) - 200 * x + 99)
|
return math.sqrt(100 * math.pow(x,2) - 200 * x + 99)
|
||||||
|
|
||||||
|
def h2(x):
|
||||||
|
return math.sqrt((10 * x - 9) * (10 * x - 11))
|
||||||
|
|
||||||
xStep = math.pow(10,-7)
|
xStep = math.pow(10,-7)
|
||||||
xStart = 1.1 + xStep
|
xStart = 1.1 + xStep
|
||||||
xStop = 1.31
|
xStop = 1.31
|
||||||
|
|
||||||
|
|
||||||
x = np.arange(xStart,xStop + xStep,xStep)
|
x = np.arange(xStart,xStop + xStep,xStep)
|
||||||
y = [h(x_val) for x_val in x]
|
y1 = [h1(x_val) for x_val in x]
|
||||||
|
y2 = [h2(x_val) for x_val in x]
|
||||||
|
|
||||||
plt.plot(x,y, label='h(x)')
|
plt.plot(x, y1, label='h1(x)')
|
||||||
|
plt.plot(x, y2, label='h2(x)')
|
||||||
|
plt.xscale('log', base=10)
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
# Aufgabe 4a)
|
||||||
|
# Da die Operation nicht gut konditioniert ist, erhält man für den Ausdruck inder Wurzel
|
||||||
|
# bei x = 1.1, -1.4e-14
|
||||||
|
# Somit kann die Wurzel für diesen x Werte nicht berechnet werden.
|
Loading…
Reference in New Issue