Name : perl-Tie-Math
| |
Version : 0.10
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp156.6.1
| Date : 2024-07-03 19:15:42
|
Group : Development/Libraries/Perl
| Source RPM : perl-Tie-Math-0.10-lp156.6.1.src.rpm
|
Size : 0.01 MB
| |
Packager : https://www_suse_com/
| |
Summary : Hashes which represent mathematical functions.
|
Description :
Defines hashes which represent mathematical functions, such as the fibonacci sequence, factorials, etc... Functions can be expressed in a manner which a math or physics student might find a bit more familiar. It also automatically employs memoization.
Multi-variable functions are supported. f() is simply passed two variables (f(X,Y) for instance) and the hash is accessed in the same way ($func{3,-4}).
* *tie*
tie %func, \'Tie::Math\', \\&function; tie %func, \'Tie::Math\', \\&function, \\&initialization;
&function contains the definition of the mathematical function. Use the f() subroutine and N index provided. So to do a simple exponential function represented by \"f(N) = N**2\":
tie %exp, \'Tie::Math\', sub { f(N) = N**2 };
&initialization contains any special cases of the function you need to define. In the fibonacci example in the SYNOPSIS you have to define f(0) = 1 and f(1) = 1;
tie %fibo, \'Tie::Math\', sub { f(N) = f(N-1) + f(N-2) }, sub { f(0) = 1; f(1) = 1; };
The &initializaion routine is optional.
Each calculation is \"memoized\" so that for each element of the array the calculation is only done once.
While the variable N is given by default, A through Z are all available. Simply import them explicitly:
use Tie::Math qw(f X);
There\'s no real difference which variable you use, its just there for your preference. (NOTE: I had to use captial letters to avoid clashing with the y// operator)
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/15.6/noarch |