赞
踩
先来看一元一次
算理:一次函数于x轴横坐标交点为-b/k
def yici(k=1,b=0):
try :
k = float(k)
b = float(b)
x = -b/k
except:
x = false
if x==0:
x=float(0)
return x
接下来看一元二次方程
算理:一元二次方程求根公式
def erci(a=1,b=0,c=0):
try :
a = float(a)
b = float(b)
c = float©
x = (-b+(b**2-4ac)0.5)/(2*a)
y = (-b-(b2-4ac)**0.5)/(2*a)
if x==y:
xy=(x,)
else:
xy=(x,y)(x,y)
except:
xy= False,False
return xy
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。