对于0-850之间的数据,直接求根公式。
import math
A = 3.908e-3
B = -5.802e-7
C = -4.183e-12
R = 110
a = -B
b = -A
c = R / 100 - 1
delt = b ** 2 - 4 * a * c
if delt > 0:
x1 = (-b + math.sqrt(delt)) / (2 * a)
x2 = (-b - math.sqrt(delt)) / (2 * a)
if 0 <= x1 <= 850:
print(x1)
if 0 <= x2 <= 850:
print(x2)
elif delt == 0:
print(-b / (2 * a))