Math::Fibonacci::Phi
Phi(3) User Contributed Perl Documentation Phi(3)
NAME
Math::Fibonacci::Phi - Perl extension for calculating Phi and phi for
Fibonacci numbers.
SYNOPSIS
use Math::Fibonacci::Phi;
use Math::Fibonacci::Phi qw(Phi phi);
use Math::Fibonacci::Phi ’:all’
DESCRIPTION
EXPORT
None by default. Everything in the function section below can be
imported and ’:all’ will do all functions.
Functions
Phi($fn)
Calculates and returns Phi (The Golden Number) for the given Fibonacci
Number. It returns undef if the argument is not part of the Fibonacci
sequence.
phi($fn)
Calculates and returns phi (opposite of Phi, antiPhi) for the given
Fibonacci Number. It returns undef if the argument is not part of the
Fibonacci sequence.
series_Phi($n)
Returns a hashref of the first $n Fibonacci Numbers where each key is
the Fibonacci and the value is its Phi.
series_phi($n)
Returns a hashref of the first $n Fibonacci Numbers where each key is
the Fibonacci and the value is its phi.
term_Phi($nth)
Returns Phi for the $nth Fibonacci number.
term_phi($nth)
Returns phi for the $nth Fibonacci number.
super_series($n)
Returns a hashref of the first $n Fibonacci Numbers where each key is
the Fibonacci and the value is a hashref that has these 3 keys:
’Phi’, ’phi’, and ’position’
’position’ is its location in the sequence (IE same number as the
argument you’d give to term_Phi() or term_phi() )
Format Options
$Math::Fibonacci::Phi::Precision
This can be a number from 1 - 14 to specify the decimal precision
you’d like.
use Math::Fibonacci::Phi ’Phi’;
print Phi(5), "\n";
$Math::Fibonacci::Phi::Precision = 7;
print Phi(5), "\n";
result is:
1.66666666666667
1.6666667
$Math::Fibonacci::Phi::TrailingZeros
If $Math::Fibonacci::Phi::Precision is set then you can set this to
true to keep the trailing zeros.
use Math::Fibonacci::Phi ’Phi’;
$Math::Fibonacci::Phi::Precision = 5;
print Phi(3), "\n";
$Math::Fibonacci::Phi::TrailingZeros=1
print Phi(3), "\n";
result is:
1.5
1.50000
SEE ALSO
Math::Fibonacci
AUTHOR
Daniel Muey, <http://drmuey.com/cpan_contact.pl>
COPYRIGHT AND LICENSE
Copyright 2005 by Daniel Muey
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
perl v5.8.8 2005-08-26 Phi(3)