diff options
author | Alberto Ruiz <aruiz@um.es> | 2014-05-08 08:48:12 +0200 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2014-05-08 08:48:12 +0200 |
commit | 1925c123d7d8184a1d2ddc0a413e0fd2776e1083 (patch) | |
tree | fad79f909d9c3be53d68e6ebd67202650536d387 /examples/root.hs | |
parent | eb3f702d065a4a967bb754977233e6eec408fd1f (diff) |
empty hmatrix-base
Diffstat (limited to 'examples/root.hs')
-rw-r--r-- | examples/root.hs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/examples/root.hs b/examples/root.hs deleted file mode 100644 index 8546ff5..0000000 --- a/examples/root.hs +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | -- root finding examples | ||
2 | import Numeric.GSL | ||
3 | import Numeric.LinearAlgebra | ||
4 | import Text.Printf(printf) | ||
5 | |||
6 | rosenbrock a b [x,y] = [ a*(1-x), b*(y-x^2) ] | ||
7 | |||
8 | test method = do | ||
9 | print method | ||
10 | let (s,p) = root method 1E-7 30 (rosenbrock 1 10) [-10,-5] | ||
11 | print s -- solution | ||
12 | disp p -- evolution of the algorithm | ||
13 | |||
14 | jacobian a b [x,y] = [ [-a , 0] | ||
15 | , [-2*b*x, b] ] | ||
16 | |||
17 | testJ method = do | ||
18 | print method | ||
19 | let (s,p) = rootJ method 1E-7 30 (rosenbrock 1 10) (jacobian 1 10) [-10,-5] | ||
20 | print s | ||
21 | disp p | ||
22 | |||
23 | disp = putStrLn . format " " (printf "%.3f") | ||
24 | |||
25 | main = do | ||
26 | test Hybrids | ||
27 | test Hybrid | ||
28 | test DNewton | ||
29 | test Broyden | ||
30 | |||
31 | mapM_ testJ [HybridsJ .. GNewton] | ||