<casaxml xsi:schemaLocation="http://casa.nrao.edu/schema/casa.xsd file:///opt/casa/code/tools/xml/casa.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://casa.nrao.edu/schema/psetTypes.html">
<tool module="scimath" name="functional">
<shortdescription>Functionals handling</shortdescription>
<include>functional_forward.h</include>
<include>functional_private.h</include>
A functional is a function with parameters, defined as $f(p;x)$, where
$p$ are the parameters, and $x$ the arguments. Methods are available to
calculate the value of a function for a series of argument values for
the given set of parameters, and for the automatic calculation of the
derivatives with respect to the parameters.
The created functionals can be used in the fitting \tool\ or in any
other \tool\ that needs to have generic function values or their derivatives.
A functional has a mask associated with it, to indicate if certain
parameters have to be solved for. See
<link anchor="functionals:functionals.masks.function">masks</link> for details.
Functionals are created in a variety of ways, in general by
specifying the name of the functional, together with some necessary
information like e.g. the order of a polynomial, or the code needed
to compile your privately defined function. Parameters can be set at
- a = fs.gaussian1d() # creates a 1D Gaussian, default arguments
- b = fs.open('gaussian1') # creates the same one
- a.state() # the 'state' of the functional
[type=0, order=-1, ndim=1, npar=3, params=[1 0 1] ]
- a.ndim() # its dimension (number of arguments)
- a.npar() # its number of parameters
[type=0, order=-1, ndim=1, npar=3, params=[1 0 1] ]
- a.f(1); # the value at x=1
- a.fdf([0,0.5]); # value and derivatives
0.5 0.5 1.38629 0.693147]
In some cases an {\em order} can be specified as well (e.g. for