1DIFF(3)               User Contributed Perl Documentation              DIFF(3)
2
3
4

NAME

6       PDL::GSL::DIFF - PDL interface to numerical differentiation routines in
7       GSL
8

DESCRIPTION

10       This is an interface to the numerical differentiation package present
11       in the GNU Scientific Library.
12

SYNOPSIS

14          use PDL;
15          use PDL::GSL::DIFF;
16
17          my $x0 = 3.3;
18
19          my @res = gsldiff(\&myfunction,$x0);
20          # same as above:
21          @res = gsldiff(\&myfunction,$x0,{Method => 'central'});
22
23          # use only values greater than $x0 to get the derivative
24          @res =  gsldiff(\&myfunction,$x0,{Method => 'forward'});
25
26          # use only values smaller than $x0 to get the derivative
27          @res = gsldiff(\&myfunction,$x0,{Method => 'backward'});
28
29          sub myfunction{
30            my ($x) = @_;
31            return $x**2;
32          }
33

FUNCTIONS

35   diff_central
36         Signature: (double x(); double [o] res(); double [o] abserr(); SV* function)
37
38       info not available
39
40       diff_central does not process bad values.  It will set the bad-value
41       flag of all output piddles if the flag is set for any of the input
42       piddles.
43
44   diff_backward
45         Signature: (double x(); double [o] res(); double [o] abserr(); SV* function)
46
47       info not available
48
49       diff_backward does not process bad values.  It will set the bad-value
50       flag of all output piddles if the flag is set for any of the input
51       piddles.
52
53   diff_forward
54         Signature: (double x(); double [o] res(); double [o] abserr(); SV* function)
55
56       info not available
57
58       diff_forward does not process bad values.  It will set the bad-value
59       flag of all output piddles if the flag is set for any of the input
60       piddles.
61
62   gsldiff
63       This functions serves as an interface to the three differentiation
64       functions present in GSL: gsl_diff_central, gsl_diff_backward and
65       gsl_diff_forward. To compute the derivative, the central method uses
66       values greater and smaller than the point at which the derivative is to
67       be evaluated, while backward and forward use only values smaller and
68       greater respectively. gsldiff() returns both the derivative and an
69       absolute error estimate. The default  method is 'central', others can
70       be specified by passing an option.
71
72       Please check the GSL documentation for more information.
73
74       Usage:
75
76         ($d,$abserr) = gsldiff($function_ref,$x,{Method => $method});
77
78       Example:
79
80         #derivative using default method ('central')
81         ($d,$abserr) = gsldiff(\&myf,3.3);
82
83         #same as above with method set explicitly
84         ($d,$abserr) = gsldiff(\&myf,3.3,{Method => 'central'});
85
86         #using backward & forward methods
87         ($d,$abserr) = gsldiff(\&myf,3.3,{Method => 'backward'});
88         ($d,$abserr) = gsldiff(\&myf,3.3,{Method => 'forward'});
89
90         sub myf{
91           my ($x) = @_;
92           return exp($x);
93         }
94

BUGS

96       Feedback is welcome. Log bugs in the PDL bug database (the database is
97       always linked from <http://pdl.perl.org>).
98

SEE ALSO

100       PDL
101
102       The GSL documentation is online at
103
104         http://www.gnu.org/software/gsl/manual/
105

AUTHOR

107       This file copyright (C) 2003 Andres Jordan
108       <andresj@physics.rutgers.edu> All rights reserved. There is no
109       warranty. You are allowed to redistribute this software documentation
110       under certain conditions. For details, see the file COPYING in the PDL
111       distribution. If this file is separated from the PDL distribution, the
112       copyright notice should be included in the file.
113
114       The GSL differentiation routines were written by David Morrison.
115
116
117
118perl v5.32.0                      2020-09-17                           DIFF(3)
Impressum