
Добавил:
Lybov_Vernis
2202 2050 2250 3772 Сб
Песня посвящается героическим защитникам курсовой по ЦСП в апреле 2025 года
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Вариант 3 / 1horde
.pyimport math
a = 0.7
b = 1
fixedx = b
x0 = a
a0 = a
b0 = b
def func(x):
return float(math.exp(x) - 4 * math.exp(-x) - 1)
def dfunc(x):
return float(4 * math.exp(-x) + math.exp(-x))
def ddfunc(x):
return float(math.exp(-x) - 4 * math.exp(-x))
i = 0
xn = a
while abs(func(xn)) > 10**(-7):
fn = func(xn)
xn = xn - (func(xn)/(func(fixedx)-func(xn)))*(fixedx-xn)
print(i, xn, fn)
i += 1
pogreshnost = (func(xn))/ddfunc(x0)
print(pogreshnost)