Compare commits
2 Commits
1d49cdbaf6
...
e108ba6f08
Author | SHA1 | Date |
---|---|---|
schrom01 | e108ba6f08 | |
schrom01 | dff6d7b7b4 |
|
@ -2,14 +2,28 @@ import numpy as np
|
|||
import matplotlib.pyplot as plt
|
||||
import math
|
||||
|
||||
def h(x):
|
||||
def h1(x):
|
||||
return math.sqrt(100 * math.pow(x,2) - 200 * x + 99)
|
||||
xStart = 1.1
|
||||
xStop = 1.31
|
||||
|
||||
def h2(x):
|
||||
return math.sqrt((10 * x - 9) * (10 * x - 11))
|
||||
|
||||
xStep = math.pow(10,-7)
|
||||
xStart = 1.1 + xStep
|
||||
xStop = 1.31
|
||||
|
||||
|
||||
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.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