10/1/26, 4:36 p.m. tareaRandom.
py
~\Downloads\[Link]
1 import math
2 def comprobar_funcion_1():
3 x = 1
4 flag = True
5 result = 1
6 while result > 0.001:
7 if flag:
8 a = x
9 f1 = a**2 - [Link](a) - 3
10 b = x + 1
11 f2 = b**2 - [Link](b) - 3
12 if f1 * f2 < 0 and ((f1 < 0 and f2 > 0) or (f1 > 0 and f2 <
0)):
13 flag = False
14 else:
15 x = (a + b) / 2
16 fx = x**2 - [Link](x) - 3
17 if f1 * fx < 0:
18 b = x
19 else:
20 a = x
21 f1 = fx
22 result = abs(b - a)
23 return result
24 s = comprobar_funcion_1()
25 print(s)
26
27
28
localhost:63215/e3ee4626-1f94-4c02-a7ef-0386eb560193/ 1/1