diff options
Diffstat (limited to 'lib/Numeric/GSL/Polynomials.hs')
-rw-r--r-- | lib/Numeric/GSL/Polynomials.hs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Numeric/GSL/Polynomials.hs b/lib/Numeric/GSL/Polynomials.hs index 694c003..290c615 100644 --- a/lib/Numeric/GSL/Polynomials.hs +++ b/lib/Numeric/GSL/Polynomials.hs | |||
@@ -27,22 +27,22 @@ import System.IO.Unsafe (unsafePerformIO) | |||
27 | import Foreign.C.Types (CInt(..)) | 27 | import Foreign.C.Types (CInt(..)) |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | {- | Solution of general polynomial equations, using /gsl_poly_complex_solve/. For example, | 30 | {- | Solution of general polynomial equations, using /gsl_poly_complex_solve/. |
31 | the three solutions of x^3 + 8 = 0 | 31 | |
32 | For example, the three solutions of x^3 + 8 = 0 | ||
33 | |||
34 | >>> polySolve [8,0,0,1] | ||
35 | [(-2.0) :+ 0.0,1.0 :+ 1.7320508075688776,1.0 :+ (-1.7320508075688776)] | ||
32 | 36 | ||
33 | @\> polySolve [8,0,0,1] | ||
34 | [(-1.9999999999999998) :+ 0.0, | ||
35 | 1.0 :+ 1.732050807568877, | ||
36 | 1.0 :+ (-1.732050807568877)]@ | ||
37 | 37 | ||
38 | The example in the GSL manual: To find the roots of x^5 -1 = 0: | 38 | The example in the GSL manual: To find the roots of x^5 -1 = 0: |
39 | 39 | ||
40 | @\> polySolve [-1, 0, 0, 0, 0, 1] | 40 | >>> polySolve [-1, 0, 0, 0, 0, 1] |
41 | [(-0.8090169943749475) :+ 0.5877852522924731, | 41 | [(-0.8090169943749472) :+ 0.5877852522924731, |
42 | (-0.8090169943749475) :+ (-0.5877852522924731), | 42 | (-0.8090169943749472) :+ (-0.5877852522924731), |
43 | 0.30901699437494734 :+ 0.9510565162951536, | 43 | 0.30901699437494756 :+ 0.9510565162951535, |
44 | 0.30901699437494734 :+ (-0.9510565162951536), | 44 | 0.30901699437494756 :+ (-0.9510565162951535), |
45 | 1.0 :+ 0.0]@ | 45 | 1.0000000000000002 :+ 0.0] |
46 | 46 | ||
47 | -} | 47 | -} |
48 | polySolve :: [Double] -> [Complex Double] | 48 | polySolve :: [Double] -> [Complex Double] |