Movatterモバイル変換
[0]ホーム
a little help with my program?
Terry Reedytjreedy at udel.edu
Tue Apr 3 13:40:47 EDT 2001
> import math...> x.real = -(b) + pow(b**2 - 4(a)(c)) / 2If the discriminant (b**2-4.0*a*c)/2 is >=0, you can replace pow withmath.sqrt.If negative, you must use cmath.sqrt.However, for serious quadratic root finding, the above formula is NOT theone to use for actual computation. A fairly standard alternative is givenin many numerical analysis books, with explanation.
More information about the Python-listmailing list
[8]ページ先頭