summaryrefslogtreecommitdiff
path: root/examples/root.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2009-06-07 13:01:03 +0000
committerAlberto Ruiz <aruiz@um.es>2009-06-07 13:01:03 +0000
commit7697c6dc27fd0d9601728af576e8d7b9d1c800ee (patch)
treec4b2c0f52f3884fbbd93bd6c0739e0fc73b921a2 /examples/root.hs
parent49a3d719221cd9484a64688ffcdbeb13cb8e55a0 (diff)
root finding with jacobian
Diffstat (limited to 'examples/root.hs')
-rw-r--r--examples/root.hs14
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
14jacobian a b [x,y] = [ [-a , 0]
15 , [-2*b*x, b] ]
16
17testJ 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
14disp = putStrLn . format " " (printf "%.3f") 23disp = putStrLn . format " " (printf "%.3f")
15 24
16main = do 25main = 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