diff options
Diffstat (limited to 'examples/root.hs')
-rw-r--r-- | examples/root.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/root.hs b/examples/root.hs index 69db243..2a24f0f 100644 --- a/examples/root.hs +++ b/examples/root.hs | |||
@@ -11,6 +11,15 @@ test method = do | |||
11 | print s -- solution | 11 | print s -- solution |
12 | disp p -- evolution of the algorithm | 12 | disp p -- evolution of the algorithm |
13 | 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 | |||
14 | disp = putStrLn . format " " (printf "%.3f") | 23 | disp = putStrLn . format " " (printf "%.3f") |
15 | 24 | ||
16 | main = do | 25 | main = do |
@@ -18,3 +27,8 @@ main = do | |||
18 | test Hybrid | 27 | test Hybrid |
19 | test DNewton | 28 | test DNewton |
20 | test Broyden | 29 | test Broyden |
30 | |||
31 | testJ HybridsJ | ||
32 | testJ HybridJ | ||
33 | testJ Newton | ||
34 | testJ GNewton | ||