.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Math::Amoeba 3pm" .TH Math::Amoeba 3pm "2023-01-03" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" .Vb 1 \& Math::Amoeba \- Multidimensional Function Minimisation .Ve .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 5 \& use Math::Amoeba qw(ConstructVertices EvaluateVertices Amoeba MinimiseND); \& my ($vertice,$y)=MinimiseND(\e@guess,\e@scales,\e&func,$tol,$itmax,$verbose); \& my @vertices=ConstructVertices(\e@vector,\e@offsets); \& my @y=EvaluateVertices(\e@vertices,\e&func); \& my ($vertice,$y)=Amoeba(\e@vertices,\e@y,\e&func,$tol,$itmax,$verbose); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is an implimenation of the Downhill Simpex Method in Multidimensions (Nelder and Mead) for finding the (local) minimum of a function. Doing this in Perl makes it easy for that function to actually be the output of another program such as a simulator. .PP Arrays and the function are passed by reference to the routines. .ie n .IP """MinimiseND""" 4 .el .IP "\f(CWMinimiseND\fR" 4 .IX Item "MinimiseND" The simplest use is the \fBMinimiseND\fR function. This takes a reference to an array of guess values for the parameters at the function minimum, a reference to an array of scales for these parameters (sensible ranges around the guess in which to look), a reference to the function, a convergence tolerence for the minimum, the maximum number of iterations to be taken and the verbose flag (default \s-1ON\s0). It returns an array consisting of a reference to the function parameters at the minimum and the value there. .ie n .IP """Amoeba""" 4 .el .IP "\f(CWAmoeba\fR" 4 .IX Item "Amoeba" The \fBAmoeba\fR function is the actual implimentation of the Downhill Simpex Method in Multidimensions. It takes a reference to an array of references to arrays which are the initial n+1 vertices (where n is the number of function parameters), a reference to the function valuation at these vertices, a reference to the function, a convergence tolerence for the minimum, the maximum number of iterations to be taken and the verbose flag (default \s-1ON\s0). It returns an array consisting of a reference to the function parameters at the minimum and the value there. .ie n .IP """ConstructVertices""" 4 .el .IP "\f(CWConstructVertices\fR" 4 .IX Item "ConstructVertices" The \fBConstructVertices\fR is used by \fBMinimiseND\fR to construct the initial vertices for \fBAmoeba\fR as the initial guess plus the parameter scale parameters as vectors along the parameter axis. .ie n .IP """EvaluateVertices""" 4 .el .IP "\f(CWEvaluateVertices\fR" 4 .IX Item "EvaluateVertices" The \fBEvaluateVertices\fR takes these set of vertices, calling the function for each one and returning the vector of results. .SH "EXAMPLE" .IX Header "EXAMPLE" .Vb 10 \& use Math::Amoeba qw(MinimiseND); \& sub afunc { \& my ($a,$b)=@_; \& print "$a\et$b\en"; \& return ($a\-7)**2+($b+3)**2; \& } \& my @guess=(1,1); \& my @scale=(1,1); \& ($p,$y)=MinimiseND(\e@guess,\e@scale,\e&afunc,1e\-7,100); \& print "(",join(\*(Aq,\*(Aq,@{$p}),")=$y\en"; .Ve .PP produces the output .PP (6.99978191653352,\-2.99981241563247)=1.00000008274829 .SH "LICENSE" .IX Header "LICENSE" \&\s-1PERL\s0 .SH "HISTORY" .IX Header "HISTORY" See \*(L"\s-1REAME\*(R".\s0 .SH "BUGS" .IX Header "BUGS" Let me know. .SH "AUTHOR" .IX Header "AUTHOR" John A.R. Williams .PP Tom Chau .SH "SEE ALSO" .IX Header "SEE ALSO" \&\*(L"Numerical Recipies: The Art of Scientific Computing\*(R" W.H. Press, B.P. Flannery, S.A. Teukolsky, W.T. Vetterling. Cambridge University Press. \s-1ISBN 0 521 30811 9.\s0 .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 1995 John A.R. Williams. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP Since 2005, this module was co-developed with Tom.