1MROOT(3) User Contributed Perl Documentation MROOT(3)
2
3
4
6 PDL::GSL::MROOT - PDL interface to multidimensional root-finding
7 routines in GSL
8
10 This is an interface to the multidimensional root-finding package
11 present in the GNU Scientific Library.
12
13 At the moment there is a single function gslmroot_fsolver which
14 provides an interface to the algorithms in the GSL library that do not
15 use derivatives.
16
18 use PDL;
19 use PDL::GSL::MROOT;
20
21 my $init = pdl (-10.00, -5.0);
22 my $epsabs = 1e-7;
23
24
25 $res = gslmroot_fsolver($init, \&rosenbrock,
26 {Method => 0, EpsAbs => $epsabs});
27
28
29 sub rosenbrock{
30 my ($x) = @_;
31 my $a = 1;
32 my $b = 10;
33 my $y = zeroes($x);
34 $y->slice(0) .= $a * (1 - $x->slice(0));
35 $y->slice(1) .= $b * ($x->slice(1) - $x->slice(0)**2);
36 return $y;
37 }
38
40 gslmroot_fsolver -- Multidimensional root finder without using derivatives
41 This function provides an interface to the multidimensional root
42 finding algorithms in the GSL library. It takes a minimum of two
43 argumennts: a piddle $init with an initial guess for the roots of the
44 system and a reference to a function. The latter function must return a
45 piddle whose i-th element is the i-th equation evaluated at the vector
46 x (a piddle which is the sole input to this function). See the example
47 in the Synopsis above for an illustration. The function returns a
48 piddle with the roots for the system of equations.
49
50 Two optional arguments can be specified as shown below. One is Method,
51 which can take the values 0,1,2,3. They correspond to the 'hybrids',
52 'hybrid', 'dnewton' and 'broyden' algorithms respectively (see GSL
53 documentation for details). The other optional argument is Epsabs,
54 which sets the absolute accuracy to which the roots of the system of
55 equations are required. The default value for Method is 0 ('hybrids'
56 algorithm) and the default for Epsabs is 1e-3.
57
58 Usage:
59
60 $res = gslmroot_fsolver($init, $function_ref,
61 [{Method => $method, Epsabs => $epsabs}]);
62
64 PDL
65
66 The GSL documentation is online at
67
68 http://sources.redhat.com/gsl/ref/gsl-ref_toc.html
69
71 This file copyright (C) 2006 Andres Jordan <ajordan@eso.org> and Simon
72 Casassus <simon@das.uchile.cl> All rights reserved. There is no
73 warranty. You are allowed to redistribute this software/documentation
74 under certain conditions. For details, see the file COPYING in the PDL
75 distribution. If this file is separated from the PDL distribution, the
76 copyright notice should be included in the file.
77
79 fsolver_meat
80 Signature: (double xfree(n); double epsabs(); int method(); SV* funcion1)
81
82 info not available
83
84 fsolver_meat does not process bad values. It will set the bad-value
85 flag of all output piddles if the flag is set for any of the input
86 piddles.
87
88
89
90perl v5.12.3 2011-03-31 MROOT(3)