home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast2.iso
/
calculat
/
sm30a.zip
/
PSOLVE.(X)
< prev
next >
Wrap
Text File
|
1993-11-06
|
364b
|
9 lines
# psolve() is polynomial solver
# e.g. psolve(x^2+5*x+6, x) gives [-2, -3]
psolve(y_, x1_) := if(order(y,x1) == 1,
-coef(y,x1,0)/coef(y,x1,1) )
psolve(y_, x2_) := if(order(y,x2) == 2,
[(-coef(y,x2,1)+sqrt(coef(y,x2,1)^2-4*coef(y,x2,2)*coef(y,x2,0)))/2*coef(y,x2,2),
(-coef(y,x2,1)-sqrt(coef(y,x2,1)^2-4*coef(y,x2,2)*coef(y,x2,0)))/2*coef(y,x2,2)])