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 $c = 1;
32 my $d = 10;
33 my $y = zeroes($x);
34
35 my $y0 = $y->slice(0);
36 $y0 .= $c * (1 - $x->slice(0));
37
38 my $y1 = $y->slice(1);
39 $y1 .= $d * ($x->slice(1) - $x->slice(0)**2);
40
41 return $y;
42 }
43
45 fsolver_meat
46 Signature: (double xfree(n); double epsabs(); int method(); SV* function1)
47
48 info not available
49
50 fsolver_meat does not process bad values. It will set the bad-value
51 flag of all output piddles if the flag is set for any of the input
52 piddles.
53
54 gslmroot_fsolver
55 Multidimensional root finder without using derivatives
56
57 This function provides an interface to the multidimensional root
58 finding algorithms in the GSL library. It takes a minimum of two
59 argumennts: a piddle $init with an initial guess for the roots of the
60 system and a reference to a function. The latter function must return a
61 piddle whose i-th element is the i-th equation evaluated at the vector
62 x (a piddle which is the sole input to this function). See the example
63 in the Synopsis above for an illustration. The function returns a
64 piddle with the roots for the system of equations.
65
66 Two optional arguments can be specified as shown below. One is Method,
67 which can take the values 0,1,2,3. They correspond to the 'hybrids',
68 'hybrid', 'dnewton' and 'broyden' algorithms respectively (see GSL
69 documentation for details). The other optional argument is Epsabs,
70 which sets the absolute accuracy to which the roots of the system of
71 equations are required. The default value for Method is 0 ('hybrids'
72 algorithm) and the default for Epsabs is 1e-3.
73
74 Usage:
75
76 $res = gslmroot_fsolver($init, $function_ref,
77 [{Method => $method, Epsabs => $epsabs}]);
78
80 PDL
81
82 The GSL documentation is online at
83
84 http://www.gnu.org/software/gsl/manual/
85
87 This file copyright (C) 2006 Andres Jordan <ajordan@eso.org> and Simon
88 Casassus <simon@das.uchile.cl> All rights reserved. There is no
89 warranty. You are allowed to redistribute this software/documentation
90 under certain conditions. For details, see the file COPYING in the PDL
91 distribution. If this file is separated from the PDL distribution, the
92 copyright notice should be included in the file.
93
94
95
96perl v5.32.0 2020-09-17 MROOT(3)