view release on metacpan or search on metacpan
lib/MKDoc/resources/misc/mime.types view on Meta::CPAN
application/vnd.japannet-verification
application/vnd.japannet-verification-wakeup
application/vnd.jisp
application/vnd.kde.karbon
application/vnd.kde.kchart
application/vnd.kde.kformula
application/vnd.kde.kivio
application/vnd.kde.kontour
application/vnd.kde.kpresenter
application/vnd.kde.kspread
application/vnd.kde.kword
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MLDBM/TinyDB.pm view on Meta::CPAN
($aref_of_href1, @get_recs_indices1) = $obj{TABLE}->get_recs;
@indices_of_recs_found = $obj{TABLE}->search($criteria, [$limit]);
@indices_of_recs_found = $obj{TABLE}->lsearch($criteria, [$limit]);
@indices_and_sort_field_values = $obj{TABLE}->sort($sort_formula_string);
@indices_and_sort_field_values = $obj{TABLE}->lsort($sort_formula_string);
$obj{TABLEn}->delete([LIST]);
$obj{TABLEn}->last;
lib/MLDBM/TinyDB.pm view on Meta::CPAN
=item sort
=item lsort
Sort the all records of table associated with object according to C<$sort_formula_string> which
must be specified. Returns array of array references, where each pointed array contains
as first element index of record followed by sorted fields values in order they appear in
C<$sort_formula_string>. Sort formula string is similar to perl sort function BLOCK
i.e. C<< a(field_name) <=> b(field_name) >> - in this case C<field_name> value will be
second element of each pointed array C<< a(field_name1) cmp b(field_name1)||length a(field_test2) <=> length b(field_test2) >>
- in this case C<field_name1> and C<field_name2> value will be second and third
element of each pointed array. If empty array is returned then something went wrong.
C<lsort> differs from C<sort> method in one way - it uses C<locale> pragma - it sorts
view all matches for this distribution
view release on metacpan or search on metacpan
bin/unimod2storable.pl view on Meta::CPAN
for my $el (keys %elements) {
say STDERR "Fetching $el";
my $url = sprintf
"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastformula/%s/JSON?MaxRecords=1",
$elements{$el},
;
my $res = $ua->get($url);
view all matches for this distribution
view release on metacpan or search on metacpan
MODULE INFORMATION:
The input file may contain one or more sequences (should be in FASTA format).
The formulas used to calculate molecular weight of ssDNA and ssRNA are;
ssDNA : ssdna = (An * 313.2) + (Tn * 304.2) + (Gn * 329.2) + (Cn * 289.2);
ssRNA : ssrna = (An * 329.2) + (Un * 306.2) + (Gn * 345.2) + (Cn * 305.2);
view all matches for this distribution
view release on metacpan or search on metacpan
share/effective_tld_names.dat view on Meta::CPAN
mil.pe
org.pe
com.pe
net.pe
// pf : http://www.gobin.info/domainname/formulaire-pf.pdf
pf
com.pf
org.pf
edu.pf
view all matches for this distribution
view release on metacpan or search on metacpan
share/public_suffix_list view on Meta::CPAN
mil.pe
net.pe
nom.pe
org.pe
// pf : http://www.gobin.info/domainname/formulaire-pf.pdf
pf
com.pf
edu.pf
org.pf
view all matches for this distribution
view release on metacpan or search on metacpan
sub _get_digest_list {
my ($config_in_ref, $config_out_ref) = @_;
opendir(DIR, ${$config_out_ref}{'dir_digest'}) || die "no ${$config_out_ref}{'dir_digest'}?: $!";
my @digests =
sort { lc($a) cmp lc($b) }
grep { /${$config_in_ref}{'grep_formula'}/ }
readdir(DIR);
closedir(DIR) || die "Could not close ${$config_out_ref}{'dir_digest'}: $!";
return \@digests;
}
To correctly identify Perl-Win32-Users digest files from any other files in
the same directory, we compose a string which would form the core of a Perl
regular expression, I<i.e.,> everything in a pattern except the outer
delimiters. Internally, Mail::Digest::Tools passes the file name through a
C<grep { /regexp/ }> pattern, so the first key is called C<grep_formula>.
%pw32u_config_in = (
grep_formula => 'Perl-Win32-Users Digest',
...
);
The equivalent pattern for the Perl Beginners digest would be:
%pbml_config_in = (
grep_formula => '\[PBML\]',
...
);
Note that the C<[> and C<]> characters have to be escaped with a C<\>
backslash because they are normally metacharacters inside Perl regular
the example above we need to capture both the C<1> as volume number and C<1771>
as digest number. The next key in our configuration hash is called
C<pattern_target>:
%pw32u_config_in = (
grep_formula => 'Perl-Win32-Users Digest',
pattern_target => '.*Vol\s(\d+),\sIssue\s(\d+)\.txt',
...
);
Note the two sets of capturing parentheses.
Other digests, such as those at Yahoo! Groups, dispense with a volume number
and simply increment each digest number:
%pbml_config_in = (
grep_formula => '\[PBML\]',
pattern_target => '.*\s(\d+)\.txt$',
...
);
Note that this C<pattern_target> contains only one pair of capturing
individual message in the digest and all subsequent messages from one another.
Continuing with our two examples from above, we provide values for keys
C<topics_intro> and C<source_msg_delimiter>:
%pw32u_config_in = (
grep_formula => 'Perl-Win32-Users digest',
pattern_target => '.*Vol\s(\d+),\sIssue\s(\d+)\.txt',
topics_intro => 'Today\'s Topics:',
source_msg_delimiter => "--__--__--\n\n",
...
);
Note the escaped C<'> apostrophe character in the value for key
C<topics_intro>.
%pbml_config_in = (
grep_formula => '\[PBML\]',
pattern_target => '.*\s(\d+)\.txt$',
topics_intro => 'Topics in this digest:',
source_msg_delimiter => "________________________________________________________________________\n________________________________________________________________________\n\n",
...
);
Patterns are easily developed to capture this information and store it in the
configuration hash:
%pw32u_config_in = (
grep_formula => 'Perl-Win32-Users digest',
pattern_target => '.*Vol\s(\d+),\sIssue\s(\d+)\.txt',
topics_intro => 'Today\'s Topics:',
source_msg_delimiter => "--__--__--\n\n",
message_style_flag => '^Message:\s+(\d+)$',
from_style_flag => '^From:\s+(.+)$',
The patterns developed to capture this information and store it in the
configuration hash would be as follows:
%pbml_config_in = (
grep_formula => '\[PBML\]',
pattern_target => '.*\s(\d+)\.txt$',
topics_intro => 'Topics in this digest:',
source_msg_delimiter => "________________________________________________________________________\n________________________________________________________________________\n\n",
message_style_flag => '^Message:\s+(\d+)$',
from_style_flag => '^\s+From:\s+(.+)$',
And with that you have completed your analysis of the internal structure of a
given digest and entered the relevant information into the first configuration
hash:
%pw32u_config_in = (
grep_formula => 'Perl-Win32-Users digest',
pattern_target => '.*Vol\s(\d+),\sIssue\s(\d+)\.txt',
topics_intro => 'Today\'s Topics:',
source_msg_delimiter => "--__--__--\n\n",
message_style_flag => '^Message:\s+(\d+)$',
from_style_flag => '^From:\s+(.+)$',
reply_to_style_flag => '^Reply-To:\s+(.+)$',
MIME_cleanup_flag => 1,
);
%pbml_config_in = (
grep_formula => '\[PBML\]',
pattern_target => '.*\s(\d+)\.txt$',
topics_intro => 'Topics in this digest:',
source_msg_delimiter => "________________________________________________________________________\n________________________________________________________________________\n\n",
message_style_flag => '^Message:\s+(\d+)$',
from_style_flag => '^\s+From:\s+(.+)$',
use of the Perl-Win32-Users digest, along with a script making use of that file.
# file: pw32u.digest.data
$topdir = "E:/Digest/pw32u";
%config_in = (
grep_formula => 'Perl-Win32-Users digest',
pattern_target => '.*Vol\s(\d+),\sIssue\s(\d+)\.txt',
# next element's value must be double-quoted
source_msg_delimiter => "--__--__--\n\n",
topics_intro => 'Today\'s Topics:',
message_style_flag => '^Message:\s+(\d+)$',
# digest.data
$topdir = "E:/Digest";
%digest_structure = (
pbml => {
grep_formula => '\[PBML\]',
pattern_target => '.*\s(\d+)\.txt$',
...
},
pw32u => {
grep_formula => 'Perl-Win32-Users digest',
pattern_target => '.*Vol\s(\d+),\sIssue\s(\d+)\.txt',
...
},
);
%digest_output_format = (
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mail/SpamAssassin/Plugin/Bayes.pm view on Meta::CPAN
my %tok_strength = map( ($_, abs($pw{$_}->{prob} - 0.5)), @pw_keys);
my $log_each_token = (would_log('dbg', 'bayes') > 1);
# now take the most significant tokens and calculate probs using
# Robinson's formula.
@pw_keys = sort { $tok_strength{$b} <=> $tok_strength{$a} } @pw_keys;
if (@pw_keys > N_SIGNIFICANT_TOKENS) { $#pw_keys = N_SIGNIFICANT_TOKENS - 1 }
view all matches for this distribution
view release on metacpan or search on metacpan
DNSBLserver/extra_docs/rfc1035.txt view on Meta::CPAN
must wait for answers from foreign name servers.
7.2. Sending the queries
As described in [RFC-1034], the basic task of the resolver is to
formulate a query which will answer the client's request and direct that
query to name servers which can provide the information. The resolver
will usually only have very strong hints about which servers to ask, in
the form of NS RRs, and may have to revise the query, in response to
CNAMEs, or revise the set of name servers the resolver is asking, in
response to delegation responses which point the resolver to name
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Mail/Field.pod view on Meta::CPAN
I<name> is then created from these elements by using the first
N characters from each element.
=item *
N is calculated by using the formula :-
int((7 + #elements) / #elements)
=item *
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Maplat/Web/DocsSpreadSheet.pm view on Meta::CPAN
Of course, full text search is available through DocsSearch.
=head1 DESCRIPTION
With the fantastic jquery plugin jQuery.sheet(), this module provides a full-fledged Spreadsheet,
complete with formulas, charts and graphs. Most of the actions are done through AJAX.
Full-text search is provided by DocsSearch.
=head1 Configuration
view all matches for this distribution
view release on metacpan or search on metacpan
pod/Glade.pod view on Meta::CPAN
Takes two arguments, both required.
The first is an ASF, and the second is a reference to an array of ambiguities,
in the format returned by L<the ambiguities() method|/"ambiguities()">.
Major applications will often have their own
customized ambiguity formatting routine, one which can formulate
error messages based, not just on the names of the rules and symbols,
but on knowledge of the role that
the rules and symbols play in
the application.
This method is intended for applications which do not have
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MarpaX/ESLIF/URI/tag.pm view on Meta::CPAN
=head2 $self->dnsname($type)
Returns the tag's DNS name when entity is made from it. C<$type> is either 'decoded' (default value), 'origin' or 'normalized'.
As per RFC4151: "It is RECOMMENDED that the domain name should be in lowercase form. Alternative formulations of the same authority name will be counted as distinct".
=head2 $self->email($type)
Returns the tag email when entity is made from it. C<$type> is either 'decoded' (default value), 'origin' or 'normalized'.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/MarpaX/Hoonlint/Policy/Test/Whitespace.pm view on Meta::CPAN
$gap,
{
mainColumn => $anchorColumn,
preColumn => $elementsColumn,
runeName => $runeName,
subpolicy => [ $runeName, 'formulas-initial-vgap' ],
}
)
};
if ( $expectedElementsColumn != $elementsColumn ) {
my $msg = sprintf 'formula %s; %s',
describeLC( $elementsLine, $elementsColumn ),
describeMisindent2( $elementsColumn, $expectedElementsColumn );
push @mistakes,
{
desc => $msg,
subpolicy => [ $runeName, 'formula-body-indent' ],
parentLine => $parentLine,
parentColumn => $parentColumn,
line => $elementsLine,
column => $elementsColumn,
reportLine => $elementsLine,
lib/MarpaX/Hoonlint/Policy/Test/Whitespace.pm view on Meta::CPAN
$tistisGap,
{
mainColumn => $anchorColumn,
preColumn => $elementsColumn,
runeName => $runeName,
subpolicy => [ $runeName, 'formulas-final-gap' ],
topicLines => [$tistisLine],
}
)
};
lib/MarpaX/Hoonlint/Policy/Test/Whitespace.pm view on Meta::CPAN
$policy->checkTistis(
$finalTistis,
{
expectedColumn => $anchorColumn,
tag => $runeName,
subpolicy => [ $runeName, 'formulas-final-tistis' ],
}
)
};
return \@mistakes;
lib/MarpaX/Hoonlint/Policy/Test/Whitespace.pm view on Meta::CPAN
my $element = $children->[$childIX];
my ($cen, $sym, $gap, $body) = @{ $element->{children} };
push @nodesToAlign, $gap, $body;
}
my $alignmentData = $policy->findAlignment( \@nodesToAlign );
$policy->setInheritedAttribute($node, 'formulaAlignmentData', $alignmentData);
return $policy->checkSeq( $node, 'sigcen-formula' );
}
sub checkBonzElement {
my ( $policy, $node ) = @_;
my $instance = $policy->{lint};
lib/MarpaX/Hoonlint/Policy/Test/Whitespace.pm view on Meta::CPAN
my ( $bodyGap, $body ) = @{ $policy->gapSeq0($node) };
my ( $parentLine, $parentColumn ) = $instance->nodeLC($node);
my ( $bodyLine, $bodyColumn ) = $instance->nodeLC($body);
my $alignmentData = $policy->getInheritedAttribute($node, 'formulaAlignmentData');
my $bodyAlignmentColumn = @{$alignmentData};
my @mistakes = ();
my $runeName = 'sigcen';
BODY_ISSUES: {
if ( $parentLine != $bodyLine ) {
my $msg = sprintf 'formula body %s; must be on rune line',
describeLC( $bodyLine, $bodyColumn );
push @mistakes,
{
desc => $msg,
subpolicy => [ $runeName, 'formula-split' ],
parentLine => $parentLine,
parentColumn => $parentColumn,
line => $bodyLine,
column => $bodyColumn,
reportLine => $bodyLine,
lib/MarpaX/Hoonlint/Policy/Test/Whitespace.pm view on Meta::CPAN
my $gapLiteral = $instance->literalNode($bodyGap);
my $gapLength = $bodyGap->{length};
last BODY_ISSUES if $gapLength == 2;
my ( undef, $bodyGapColumn ) = $instance->nodeLC($bodyGap);
my $msg = sprintf 'formula body %s; %s',
describeLC( $bodyLine, $bodyColumn ),
describeMisindent2( $gapLength, 2 );
push @mistakes,
{
desc => $msg,
subpolicy => [ $runeName, 'formula-body-indent' ],
parentLine => $parentLine,
parentColumn => $parentColumn,
line => $bodyLine,
column => $bodyColumn,
reportLine => $bodyLine,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Algebra/Symbols/Sum.pm view on Meta::CPAN
my $S = $s->signature;
push @{$S{$S}}, $t;
}
#_______________________________________________________________________
# Square each partitions, as required by the formulae below.
#_______________________________________________________________________
my @t;
push @t, sigma(@n)->power($two) if scalar(@n); # Non sqrt partition
for my $s(keys(%S))
{push @t, sigma(@{$S{$s}})->power($two); # Sqrt partition
}
#_______________________________________________________________________
# I can multiply out upto 4 square roots using the formulae below.
# There are formula to multiply out more than 4 sqrts, but they are big.
# These formulae are obtained by squaring out and rearranging:
# sqrt(a)+sqrt(b)+sqrt(c)+sqrt(d) == 0 until no sqrts remain, and
# then matching terms to produce optimal execution.
# This remarkable result was obtained with the help of this package:
# demonstrating its utility in optimizing complex calculations written
# in Perl: which in of itself cannot optimize broadly.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/faulhaber_s_formula.pl view on Meta::CPAN
#!/usr/bin/perl
# The formula for calculating the sum of consecutive
# numbers raised to a given power, such as:
# 1^p + 2^p + 3^p + ... + n^p
# where p is a positive integer.
# See also:
# https://en.wikipedia.org/wiki/Faulhaber%27s_formula
use 5.020;
use strict;
use warnings;
examples/faulhaber_s_formula.pl view on Meta::CPAN
}
return $B[-1] * factorial($#B);
}
# The Faulhaber's formula
# See: https://en.wikipedia.org/wiki/Faulhaber%27s_formula
sub faulhaber_s_formula ($n, $p) {
my $sum = 0;
for my $k (0 .. $p) {
$sum += (-1)**$k * binomial($p + 1, $k) * bernoulli_number($k) * $n**($p - $k + 1);
examples/faulhaber_s_formula.pl view on Meta::CPAN
return $sum / ($p + 1);
}
# Alternate expression using Bernoulli polynomials
# See: https://en.wikipedia.org/wiki/Faulhaber%27s_formula#Alternate_expressions
sub bernoulli_polynomials ($n, $x) {
my $sum = 0;
for my $k (0 .. $n) {
$sum += binomial($n, $k) * bernoulli_number($n - $k) * $x**$k;
}
return $sum;
}
sub faulhaber_s_formula_2 ($n, $p) {
(bernoulli_polynomials($p + 1, $n + 1) - bernoulli_number($p + 1)) / ($p + 1);
}
foreach my $m (1 .. 15) {
my $n = int(rand(100));
my $t1 = faulhaber_s_formula($n, $m);
my $t2 = faulhaber_s_formula_2($n, $m);
my $t3 = faulhaber_sum($n, $m);
say "Sum_{k=1..$n} k^$m = $t1";
die "error: $t1 != $t2" if ($t1 != $t2);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/BLAS/Legacy.pm view on Meta::CPAN
=back
=head2 Level 2 BLAS
The underlying mathematical formulation is
=over
S<I<y> â α I<A>·I<x> + β I<y>>
lib/Math/BLAS/Legacy.pm view on Meta::CPAN
=back
=head2 Level 3 BLAS
The underlying mathematical formulation is
=over
S<I<C> â α I<A>·I<B> + β I<C>>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/BSpline/Basis.pm view on Meta::CPAN
# The variable names are inspired by the theory as laid out in the
# NURBS book. We want to calculate N_{i,p}, that inspires $N and
# $p. U is the knot vector, left and right are inspired by the
# terms in the formulas used in the theoretical derivation.
sub evaluate_basis_functions {
my ($self, $i, $u) = @_;
my $p = $self->degree;
my $U = $self->knot_vector;
my $n = (@$U - 1) - $p - 1;
view all matches for this distribution
view release on metacpan or search on metacpan
examples/faulhaber_s_formula.pl view on Meta::CPAN
#!/usr/bin/perl
# The formula for calculating the sum of consecutive
# numbers raised to a given power, such as:
# 1^p + 2^p + 3^p + ... + n^p
# where p is a positive integer.
# See also:
# https://en.wikipedia.org/wiki/Faulhaber%27s_formula
use 5.010;
use strict;
use warnings;
use lib qw(../lib);
use Math::Bacovia qw(:all);
use Math::AnyNum qw(binomial bernfrac);
# The Faulhaber's formula
# See: https://en.wikipedia.org/wiki/Faulhaber%27s_formula
sub faulhaber_s_formula {
my ($p, $n) = @_;
my $sum = Sum();
for my $j (0 .. $p) {
$sum += Number(binomial($p + 1, $j)) * Number(bernfrac($j)) * $n**($p + 1 - $j);
examples/faulhaber_s_formula.pl view on Meta::CPAN
Fraction($sum, ($p + 1));
}
# Alternate expression using Bernoulli polynomials
# See: https://en.wikipedia.org/wiki/Faulhaber%27s_formula#Alternate_expressions
sub bernoulli_polynomials {
my ($n, $x) = @_;
my $sum = Sum();
for my $k (0 .. $n) {
examples/faulhaber_s_formula.pl view on Meta::CPAN
}
$sum;
}
sub faulhaber_s_formula_2 {
my ($p, $n) = @_;
1 + Fraction((bernoulli_polynomials($p + 1, $n) - bernoulli_polynomials($p + 1, 1)), ($p + 1));
}
foreach my $i (0 .. 10) {
say "F($i) = ", faulhaber_s_formula($i, Symbol('n'))->simple->pretty;
say "F($i) = ", faulhaber_s_formula_2($i, Symbol('n'))->simple->pretty;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/BigFloat.pm view on Meta::CPAN
_e => $LIB -> _new($n - 1),
}, $class;
} else {
# For large accuracy, the arctan formulas become very inefficient with
# Math::BigFloat, so use Brent-Salamin (aka AGM or Gauss-Legendre).
# Use a few more digits in the intermediate computations.
$n += 8;
lib/Math/BigFloat.pm view on Meta::CPAN
# computing log(1) is fastest, and the further away we get from 1, the
# longer it takes. So we also 'break' this down by multiplying $x with 10
# and subtract the log(10) afterwards to get the correct result.
# To get $x even closer to 1, we also divide by 2 and then use log(2) to
# correct for this. For instance if $x is 2.4, we use the formula:
# blog(2.4 * 2) == blog(1.2) + blog(2)
# and thus calculate only blog(1.2) and blog(2), which is faster in total
# than calculating blog(2.4).
# In addition, the values for blog(2) and blog(10) are cached.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/faulhaber_s_formula.pl view on Meta::CPAN
#!/usr/bin/perl
# The formula for calculating the sum of consecutive
# numbers raised to a given power, such as:
# 1^p + 2^p + 3^p + ... + n^p
# where p is a positive integer.
# See also: https://en.wikipedia.org/wiki/Faulhaber%27s_formula
use 5.010;
use strict;
use warnings;
examples/faulhaber_s_formula.pl view on Meta::CPAN
}
return $A[0]; # which is Bn
}
# The Faulhaber's formula
# See: https://en.wikipedia.org/wiki/Faulhaber%27s_formula
sub faulhaber_s_formula {
my ($p, $n) = @_;
my $sum = 0;
for my $j (0 .. $p) {
$sum += binomial($p + 1, $j) * bernoulli_number($j) * ($n + 1)**($p + 1 - $j);
examples/faulhaber_s_formula.pl view on Meta::CPAN
$sum / ($p + 1);
}
# Alternate expression using Bernoulli polynomials
# See: https://en.wikipedia.org/wiki/Faulhaber%27s_formula#Alternate_expressions
sub bernoulli_polynomials {
my ($n, $x) = @_;
my $sum = 0;
for my $k (0 .. $n) {
examples/faulhaber_s_formula.pl view on Meta::CPAN
}
$sum;
}
sub faulhaber_s_formula_2 {
my ($p, $n) = @_;
1 + (bernoulli_polynomials($p + 1, $n + 1) - bernoulli_polynomials($p + 1, 1)) / ($p + 1);
}
# Test for 1^4 + 2^4 + 3^4 + ... + 10^4
foreach my $i (0 .. 10) {
say "$i: ", faulhaber_s_formula(4, $i)->as_rat;
say "$i: ", faulhaber_s_formula_2(4, $i)->as_rat;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Business/BlackScholes/Binaries/Greeks/Delta.pm view on Meta::CPAN
# For delta, the stability function is $phi/$S, for gamma it is different,
# but we shall ignore for now.
#
if ($k == 1 and (not(abs($phi / $S) < $stability_constant))) {
die
"$0: PELSSER DELTA formula for S=$S, U=$U, D=$D, t=$t, r_q=$r_q, mu=$mu, vol=$vol, w=$w, eta=$eta cannot be evaluated because PELSSER DELTA stability conditions ($phi / $S less than $stability_constant) not met. This could be due to b...
}
}
# Need to take care when $mu goes to zero
if (abs($mu_new) < $Math::Business::BlackScholesMerton::Binaries::SMALL_VALUE_MU) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
0.11, # volatility (0.3 = 30%)
);
=head1 DESCRIPTION
Prices options using the GBM model, all closed formulas.
Important(a): Basically, onetouch, upordown and doubletouch have two cases of
payoff either at end or at hit. We treat them differently. We use parameter
$w to differ them.
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
Paying domestic currency (JPY if for USDJPY) = correlation coefficient is ZERO.
Paying foreign currency (USD if for USDJPY) = correlation coefficient is ONE.
Paying another currency = correlation is between negative ONE and positive ONE.
See [3] for Quanto formulas and examples
=head1 SUBROUTINES
=head2 call
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
DESCRIPTION
Price a Call and remove the N(d2) part if the time is too small
EXPLANATION
The definition of the contract is that if S > K, it gives
full payout (1). However the formula DC(T,K) = e**(-rT) N(d2) will not be
correct when T->0 and K=S. The value of DC(T,K) for this case will be 0.5.
The formula is actually "correct" because when T->0 and S=K, the probability
should just be 0.5 that the contract wins, moving up or down is equally
likely in that very small amount of time left. Thus the only problem is
that the math cannot evaluate at T=0, where divide by 0 error occurs. Thus,
we need this check that throws away the N(d2) part (N(d2) will evaluate
"wrongly" to 0.5 if S=K).
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
return exp(-$r_q * $t) * pnorm(-1 * d2($S, $K, $t, $r_q, $mu, $sigma));
}
=head2 d2
returns the DS term common to many BlackScholesMerton formulae.
=cut
sub d2 {
my ($S, $K, $t, undef, $mu, $sigma) = @_;
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# time to get paid = 0)
# w = 1, rebate paid at end.
# When the contract already reached it expiry and not yet reach it
# settlement time, it is consider an unexpired contract but will come to
# here with t=0 and it will caused the formula to die hence set it to the
# SMALLTIME which is 1 second
$t = max($SMALLTIME, $t);
$w ||= 0;
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# when added to the floating-point number 1.0, produces a
# floating-point result different from 1.0 is termed the
# machine accuracy, e.
#
# This value is very important for knowing stability to
# certain formulas used. e.g. Pelsser formula for UPORDOWN
# and RANGE contracts.
#
my $MACHINE_EPSILON = machine_epsilon();
=head2 upordown
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
sub upordown {
my ($S, $U, $D, $t, $r_q, $mu, $sigma, $w) = @_;
# When the contract already reached it's expiry and not yet reach it
# settlement time, it is considered an unexpired contract but will come to
# here with t=0 and it will caused the formula to die hence set it to the
# SMALLTIME whiich is 1 second
$t = max($t, $SMALLTIME);
# $w = 0, paid at hit
# $w = 1, paid at end
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
my $upordown_prob;
if ($onetouch_up_prob + $onetouch_down_prob < $MIN_ACCURACY_UPORDOWN_PELSSER_1997) {
# CONDITION 4:
# The probability is too small for the Pelsser formula to be correct.
# Do this check first to avoid PELSSER stability condition to be
# triggered.
# Here we assume that the ONETOUCH formula is perfect and never give
# wrong values (e.g. negative).
return 0;
} elsif ($onetouch_up_prob xor $onetouch_down_prob) {
# One of our ONETOUCH probabilities is 0.
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# always at end, and thus the value (DISCOUNT - UPORDOWN) is not
# evaluated.
if ($w == 1) {
# Since the difference is already less than the min accuracy,
# the value [payout - upordown], which is the RANGE formula
# can become negative.
if (abs(exp(-$r_q * $t) - $upordown_prob) < $MIN_ACCURACY_UPORDOWN_PELSSER_1997) {
$upordown_prob = exp(-$r_q * $t);
}
}
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# The number of iterations is important when recommending the
# range of the upper/lower barriers on our site. If we recommend
# a range that is too big and our iteration is too small, the
# price will be wrong! We must know the rate of convergence of
# the formula used.
my $iterations_required = get_min_iterations_pelsser_1997($S, $U, $D, $t, $r_q, $mu, $sigma, $w);
for (my $k = 1; $k < $iterations_required; $k++) {
my $lambda_k_dash = (0.5 * (($mu_dash * $mu_dash) / ($sigma * $sigma) + ($k * $k * $pi * $pi * $sigma * $sigma) / ($h * $h)));
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# stability constant will differ. However, for simplicity
# we will not bother (else the code will get messy), and
# just use the price stability constant.
#
if ($k == 1 and (not(abs($phi) < $stability_constant))) {
die "PELSSER VALUATION formula for S=$S, U=$U, D=$D, t=$t, r_q=$r_q, "
. "mu=$mu, vol=$sigma, w=$w, eta=$eta, cannot be evaluated because"
. "PELSSER VALUATION stability conditions ($phi less than "
. "$stability_constant) not met. This could be due to barriers "
. "too big, volatilities too low, interest/dividend rates too high, "
. "or machine accuracy too low. Machine accuracy is "
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
0.11, # volatility (0.3 = 30%)
);
=head1 DESCRIPTION
Prices options using the GBM model, all closed formulas.
Important(a): Basically, onetouch, upordown and doubletouch have two cases of
payoff either at end or at hit. We treat them differently. We use parameter
$w to differ them.
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
Paying domestic currency (JPY if for USDJPY) = correlation coefficient is ZERO.
Paying foreign currency (USD if for USDJPY) = correlation coefficient is ONE.
Paying another currency = correlation is between negative ONE and positive ONE.
See [3] for Quanto formulas and examples
=head1 SUBROUTINES
=head2 vanilla_call
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
DESCRIPTION
Price a Call and remove the N(d2) part if the time is too small
EXPLANATION
The definition of the contract is that if S > K, it gives
full payout (1). However the formula DC(T,K) = e^(-rT) N(d2) will not be
correct when T->0 and K=S. The value of DC(T,K) for this case will be 0.5.
The formula is actually "correct" because when T->0 and S=K, the probability
should just be 0.5 that the contract wins, moving up or down is equally
likely in that very small amount of time left. Thus the only problem is
that the math cannot evaluate at T=0, where divide by 0 error occurs. Thus,
we need this check that throws away the N(d2) part (N(d2) will evaluate
"wrongly" to 0.5 if S=K).
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
return exp(-$r_q * $t) * pnorm(-1 * d2($S, $K, $t, $r_q, $mu, $sigma));
}
=head2 d2
returns the DS term common to many BlackScholes formulae.
=cut
sub d2 {
my ($S, $K, $t, undef, $mu, $sigma) = @_;
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
# time to get paid = 0)
# w = 1, rebate paid at end.
# When the contract already reached it expiry and not yet reach it
# settlement time, it is consider an unexpired contract but will come to
# here with t=0 and it will caused the formula to die hence set it to the
# SMALLTIME which is 1 second
$t = max($SMALLTIME, $t);
$w ||= 0;
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
# when added to the floating-point number 1.0, produces a
# floating-point result different from 1.0 is termed the
# machine accuracy, e.
#
# This value is very important for knowing stability to
# certain formulas used. e.g. Pelsser formula for UPORDOWN
# and RANGE contracts.
#
my $MACHINE_EPSILON = machine_epsilon();
=head2 upordown
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
sub upordown {
my ($S, $U, $D, $t, $r_q, $mu, $sigma, $w) = @_;
# When the contract already reached it's expiry and not yet reach it
# settlement time, it is considered an unexpired contract but will come to
# here with t=0 and it will caused the formula to die hence set it to the
# SMALLTIME whiich is 1 second
$t = max($t, $SMALLTIME);
# $w = 0, paid at hit
# $w = 1, paid at end
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
my $upordown_prob;
if ($onetouch_up_prob + $onetouch_down_prob < $MIN_ACCURACY_UPORDOWN_PELSSER_1997) {
# CONDITION 4:
# The probability is too small for the Pelsser formula to be correct.
# Do this check first to avoid PELSSER stability condition to be
# triggered.
# Here we assume that the ONETOUCH formula is perfect and never give
# wrong values (e.g. negative).
return 0;
} elsif ($onetouch_up_prob xor $onetouch_down_prob) {
# One of our ONETOUCH probabilities is 0.
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
# always at end, and thus the value (DISCOUNT - UPORDOWN) is not
# evaluated.
if ($w == 1) {
# Since the difference is already less than the min accuracy,
# the value [payout - upordown], which is the RANGE formula
# can become negative.
if (abs(exp(-$r_q * $t) - $upordown_prob) < $MIN_ACCURACY_UPORDOWN_PELSSER_1997) {
$upordown_prob = exp(-$r_q * $t);
}
}
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
# The number of iterations is important when recommending the
# range of the upper/lower barriers on our site. If we recommend
# a range that is too big and our iteration is too small, the
# price will be wrong! We must know the rate of convergence of
# the formula used.
my $iterations_required = get_min_iterations_pelsser_1997($S, $U, $D, $t, $r_q, $mu, $sigma, $w);
for (my $k = 1; $k < $iterations_required; $k++) {
my $lambda_k_dash = (0.5 * (($mu_dash * $mu_dash) / ($sigma * $sigma) + ($k * $k * $pi * $pi * $sigma * $sigma) / ($h * $h)));
lib/Math/Business/BlackScholes/Binaries.pm view on Meta::CPAN
# stability constant will differ. However, for simplicity
# we will not bother (else the code will get messy), and
# just use the price stability constant.
#
if ($k == 1 and (not(abs($phi) < $stability_constant))) {
die "PELSSER VALUATION formula for S=$S, U=$U, D=$D, t=$t, r_q=$r_q, "
. "mu=$mu, vol=$sigma, w=$w, eta=$eta, cannot be evaluated because"
. "PELSSER VALUATION stability conditions ($phi less than "
. "$stability_constant) not met. This could be due to barriers "
. "too big, volatilities too low, interest/dividend rates too high, "
. "or machine accuracy too low. Machine accuracy is "
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
0.11, # volatility (0.3 = 30%)
);
=head1 DESCRIPTION
Prices options using the GBM model, all closed formulas.
Important(a): Basically, onetouch, upordown and doubletouch have two cases of
payoff either at end or at hit. We treat them differently. We use parameter
$w to differ them.
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
Paying domestic currency (JPY if for USDJPY) = correlation coefficient is ZERO.
Paying foreign currency (USD if for USDJPY) = correlation coefficient is ONE.
Paying another currency = correlation is between negative ONE and positive ONE.
See [3] for Quanto formulas and examples
=head1 SUBROUTINES
=head2 call
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
DESCRIPTION
Price a Call and remove the N(d2) part if the time is too small
EXPLANATION
The definition of the contract is that if S > K, it gives
full payout (1). However the formula DC(T,K) = e^(-rT) N(d2) will not be
correct when T->0 and K=S. The value of DC(T,K) for this case will be 0.5.
The formula is actually "correct" because when T->0 and S=K, the probability
should just be 0.5 that the contract wins, moving up or down is equally
likely in that very small amount of time left. Thus the only problem is
that the math cannot evaluate at T=0, where divide by 0 error occurs. Thus,
we need this check that throws away the N(d2) part (N(d2) will evaluate
"wrongly" to 0.5 if S=K).
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
return exp(-$r_q * $t) * pnorm(-1 * d2($S, $K, $t, $r_q, $mu, $sigma));
}
=head2 d2
returns the DS term common to many BlackScholesMerton formulae.
=cut
sub d2 {
my ($S, $K, $t, undef, $mu, $sigma) = @_;
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# time to get paid = 0)
# w = 1, rebate paid at end.
# When the contract already reached it expiry and not yet reach it
# settlement time, it is consider an unexpired contract but will come to
# here with t=0 and it will caused the formula to die hence set it to the
# SMALLTIME which is 1 second
$t = max($SMALLTIME, $t);
$w ||= 0;
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# when added to the floating-point number 1.0, produces a
# floating-point result different from 1.0 is termed the
# machine accuracy, e.
#
# This value is very important for knowing stability to
# certain formulas used. e.g. Pelsser formula for UPORDOWN
# and RANGE contracts.
#
my $MACHINE_EPSILON = machine_epsilon();
=head2 upordown
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
sub upordown {
my ($S, $U, $D, $t, $r_q, $mu, $sigma, $w) = @_;
# When the contract already reached it's expiry and not yet reach it
# settlement time, it is considered an unexpired contract but will come to
# here with t=0 and it will caused the formula to die hence set it to the
# SMALLTIME whiich is 1 second
$t = max($t, $SMALLTIME);
# $w = 0, paid at hit
# $w = 1, paid at end
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
my $upordown_prob;
if ($onetouch_up_prob + $onetouch_down_prob < $MIN_ACCURACY_UPORDOWN_PELSSER_1997) {
# CONDITION 4:
# The probability is too small for the Pelsser formula to be correct.
# Do this check first to avoid PELSSER stability condition to be
# triggered.
# Here we assume that the ONETOUCH formula is perfect and never give
# wrong values (e.g. negative).
return 0;
} elsif ($onetouch_up_prob xor $onetouch_down_prob) {
# One of our ONETOUCH probabilities is 0.
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# always at end, and thus the value (DISCOUNT - UPORDOWN) is not
# evaluated.
if ($w == 1) {
# Since the difference is already less than the min accuracy,
# the value [payout - upordown], which is the RANGE formula
# can become negative.
if (abs(exp(-$r_q * $t) - $upordown_prob) < $MIN_ACCURACY_UPORDOWN_PELSSER_1997) {
$upordown_prob = exp(-$r_q * $t);
}
}
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# The number of iterations is important when recommending the
# range of the upper/lower barriers on our site. If we recommend
# a range that is too big and our iteration is too small, the
# price will be wrong! We must know the rate of convergence of
# the formula used.
my $iterations_required = get_min_iterations_pelsser_1997($S, $U, $D, $t, $r_q, $mu, $sigma, $w);
for (my $k = 1; $k < $iterations_required; $k++) {
my $lambda_k_dash = (0.5 * (($mu_dash * $mu_dash) / ($sigma * $sigma) + ($k * $k * $pi * $pi * $sigma * $sigma) / ($h * $h)));
lib/Math/Business/BlackScholesMerton/Binaries.pm view on Meta::CPAN
# stability constant will differ. However, for simplicity
# we will not bother (else the code will get messy), and
# just use the price stability constant.
#
if ($k == 1 and (not(abs($phi) < $stability_constant))) {
die "PELSSER VALUATION formula for S=$S, U=$U, D=$D, t=$t, r_q=$r_q, "
. "mu=$mu, vol=$sigma, w=$w, eta=$eta, cannot be evaluated because"
. "PELSSER VALUATION stability conditions ($phi less than "
. "$stability_constant) not met. This could be due to barriers "
. "too big, volatilities too low, interest/dividend rates too high, "
. "or machine accuracy too low. Machine accuracy is "
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Business/Lookback.pm view on Meta::CPAN
use List::Util qw(max min);
use Math::CDF qw(pnorm);
use Math::Business::Lookback::Common;
# ABSTRACT: The Black-Scholes formula for Lookback options.
our $VERSION = '0.01';
=head1 NAME
lib/Math/Business/Lookback.pm view on Meta::CPAN
undef # minimum spot
);
=head1 DESCRIPTION
Prices lookback options using the GBM model, all closed formulas.
=head1 SUBROUTINES
=head2 lbfloatcall
lib/Math/Business/Lookback.pm view on Meta::CPAN
return $value;
}
=head2 d1_function
returns the d1 term common to many BlackScholes formulae.
=cut
sub d1_function {
my ($S, $K, $t, $r_q, $mu, $sigma) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
cdflib/dcdflib.c view on Meta::CPAN
then apply rational approximation number 5236 of
Hart et al, Computer Approximations, John Wiley and
Sons, NY, 1968.
If X .gt. 6.0, then use recursion to get X to at least 12 and
then use formula 5423 of the same source.
**********************************************************************
*/
{
#define hln2pi 0.91893853320467274178e0
cdflib/dcdflib.c view on Meta::CPAN
standard normal. Therefore no searches are necessary for any
parameter.
For X < -15, the asymptotic expansion for the normal is used as
the starting value in finding the inverse standard normal.
This is formula 26.2.12 of Abramowitz and Stegun.
Note
cdflib/dcdflib.c view on Meta::CPAN
Upper search bound if STATUS is 2.
Method
Upper tail of the cumulative noncentral t is calculated usin
formulae from page 532 of Johnson, Kotz, Balakrishnan, Coninuou
Univariate Distributions, Vol 2, 2nd Edition. Wiley (1995)
Computation of other parameters involve a seach for a value that
produces the desired value of P. The search relies on the
monotinicity of P with the other parameter.
cdflib/dcdflib.c view on Meta::CPAN
CCUM <-- Compliment of Cumulative non-central chi-square distribut
Method
Uses formula 26.4.25 of Abramowitz and Stegun, Handbook of
Mathematical Functions, US NBS (1966) to calculate the
non-central chi-square.
Variables
cdflib/dcdflib.c view on Meta::CPAN
Method
Uses formula 26.4.21 of Abramowitz and Stegun, Handbook of
Mathematical Functions to reduce the cumulative Poisson to
the cumulative chi-square distribution.
**********************************************************************
*/
cdflib/dcdflib.c view on Meta::CPAN
Method
Upper tail of the cumulative noncentral t using
formulae from page 532 of Johnson, Kotz, Balakrishnan, Coninuous
Univariate Distributions, Vol 2, 2nd Edition. Wiley (1995)
This implementation starts the calculation at i = lambda,
which is near the largest Di. It then sums forward and backward.
**********************************************************************/
view all matches for this distribution
view release on metacpan or search on metacpan
Units/Convert/Base.pm view on Meta::CPAN
# just as far away from 1 as 400 is). I then treat the allowed range
# as a one standard deviation wide segment of a normal distribution,
# and use appropriate modifiers to make the result range from 0.001 to
# 0.1.
#
# The above formula was carefully chosen from thousands of
# possibilities, by picking things at random and scribbling them down
# on a piece of paper, then pouring sparkling apple cider all over and
# using the one that was still readable.
#
# Ok, not really. Just pretend that I went to that much trouble.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Math/Cephes.pod view on Meta::CPAN
ei: Exponential integral
erf: Error function
erfc: Complementary error function
expn: Exponential integral En
fresnl: Fresnel integral
plancki: Integral of Planck's black body radiation formula
polylog: Polylogarithm function
shichi: Hyperbolic sine and cosine integrals
sici: Sine and cosine integrals
simpson: Simpson's rule to find an integral
spence: Dilogarithm
lib/Math/Cephes.pod view on Meta::CPAN
> ( ) p (1-p)
-- ( j )
j=0
The terms are not summed directly; instead the incomplete
beta integral is employed, according to the formula
y = bdtr( k, n, p ) = incbet( n-k, k+1, 1-p ).
The arguments must be positive, with p ranging from 0 to 1.
lib/Math/Cephes.pod view on Meta::CPAN
> ( ) p (1-p)
-- ( j )
j=k+1
The terms are not summed directly; instead the incomplete
beta integral is employed, according to the formula
y = bdtrc( k, n, p ) = incbet( k+1, n-k, p ).
The arguments must be positive, with p ranging from 0 to 1.
lib/Math/Cephes.pod view on Meta::CPAN
x
where x is the Chi-square variable.
The incomplete gamma integral is used, according to the
formula
y = chdtr( v, x ) = igam( v/2.0, x/2.0 ).
The arguments must both be positive.
lib/Math/Cephes.pod view on Meta::CPAN
x
where x is the Chi-square variable.
The incomplete gamma integral is used, according to the
formula
y = chdtrc( v, x ) = igamc( v/2.0, x/2.0 ).
The arguments must both be positive.
lib/Math/Cephes.pod view on Meta::CPAN
1
Both n and x must be nonnegative.
The routine employs either a power series, a continued
fraction, or an asymptotic formula depending on the
relative values of n and x.
ACCURACY:
Relative error:
lib/Math/Cephes.pod view on Meta::CPAN
of x = (u1/df1)/(u2/df2), where u1 and u2 are random
variables having Chi square distributions with df1
and df2 degrees of freedom, respectively.
The incomplete beta integral is used, according to the
formula
P(x) = incbet( df1/2, df2/2, df1*x/(df2 + df1*x) ).
The arguments a and b are greater than zero, and x is
nonnegative.
lib/Math/Cephes.pod view on Meta::CPAN
B(a,b) | |
-
x
The incomplete beta integral is used, according to the
formula
P(x) = incbet( df2/2, df1/2, df2/(df2 + df1*x) ).
ACCURACY:
lib/Math/Cephes.pod view on Meta::CPAN
function lgam().
Arguments |x| <= 34 are reduced by recurrence and the function
approximated by a rational function of degree 6/7 in the
interval (2,3). Large arguments are handled by Stirling's
formula. Large negative arguments are made positive using
a reflection formula.
ACCURACY:
Relative error:
arithmetic domain # trials peak rms
lib/Math/Cephes.pod view on Meta::CPAN
The sign (+1 or -1) of the gamma function is returned in a
global (extern) variable named sgngam.
For arguments greater than 13, the logarithm of the gamma
function is approximated by the logarithmic version of
Stirling's formula using a polynomial approximation of
degree 4. Arguments between -33 and +33 are reduced by
recurrence to the interval [2,3] of a rational approximation.
The cosecant reflection formula is employed for arguments
less than -33.
Arguments greater than MAXLGM return MAXNUM and an error
message. MAXLGM = 2.035093e36 for DEC
arithmetic or 2.556348e305 for IEEE arithmetic.
lib/Math/Cephes.pod view on Meta::CPAN
1 1 b 1! b(b+1) 2!
Many higher transcendental functions are special cases of
this power series.
As is evident from the formula, b must not be a negative
integer or zero unless a is an integer with 0 >= a > b.
The routine attempts both a direct summation of the series
and an asymptotic expansion. In each case error due to
roundoff, cancellation, and nonconvergence is estimated.
lib/Math/Cephes.pod view on Meta::CPAN
Returns modified Bessel function of order v of the
argument. If x is negative, v must be integer valued.
The function is defined as Iv(x) = Jv( ix ). It is
here computed in terms of the confluent hypergeometric
function, according to the formula
v -x
Iv(x) = (x/2) e hyperg( v+0.5, 2v+1, 2x ) / gamma(v+1)
If v is a negative integer, then v is replaced by -v.
lib/Math/Cephes.pod view on Meta::CPAN
In a sequence of Bernoulli trials, this is the probability
that k or fewer failures precede the nth success.
The terms are not computed individually; instead the incomplete
beta integral is employed, according to the formula
y = nbdtr( k, n, p ) = incbet( n, k+1, p ).
The arguments must be positive, with p ranging from 0 to 1.
lib/Math/Cephes.pod view on Meta::CPAN
> ( ) p (1-p)
-- ( j )
j=k+1
The terms are not computed individually; instead the incomplete
beta integral is employed, according to the formula
y = nbdtrc( k, n, p ) = incbet( k+1, n, 1-p ).
The arguments must be positive, with p ranging from 0 to 1.
lib/Math/Cephes.pod view on Meta::CPAN
> ( ) p (1-p)
-- ( j )
j=k+1
The terms are not computed individually; instead the incomplete
beta integral is employed, according to the formula
y = nbdtrc( k, n, p ) = incbet( k+1, n, 1-p ).
The arguments must be positive, with p ranging from 0 to 1.
lib/Math/Cephes.pod view on Meta::CPAN
> e --
-- j!
j=k+1
The terms are not summed directly; instead the incomplete
gamma integral is employed, according to the formula
y = pdtrc( k, m ) = igam( k+1, m ).
The arguments must both be positive.
lib/Math/Cephes.pod view on Meta::CPAN
-
psi(n) = -EUL + > 1/k.
-
k=1
This formula is used for 0 < n <= 10. If x is negative, it
is transformed to a positive argument by the reflection
formula psi(1-x) = psi(x) + pi cot(pi x).
For general positive x, the argument is made greater than 10
using the recurrence psi(x+1) = psi(x) + 1/x.
Then the following asymptotic expansion is applied:
inf. B
lib/Math/Cephes.pod view on Meta::CPAN
The function is approximated by a Chebyshev expansion in
the interval [0,1]. Range reduction is by recurrence
for arguments between -34.034 and +34.84425627277176174.
1/MAXNUM is returned for positive arguments outside this
range. For arguments less than -34.034 the cosecant
reflection formula is applied; lograrithms are employed
to avoid unnecessary overflow.
The reciprocal gamma function has no singularities,
but overflow and underflow may occur for large arguments.
These conditions return either MAXNUM or 1/MAXNUM with
lib/Math/Cephes.pod view on Meta::CPAN
| | t - 1
-
1
for x >= 0. A rational approximation gives the integral in
the interval (0.5, 1.5). Transformation formulas for 1/x
and 1-x are employed outside the basic expansion range.
ACCURACY:
Relative error:
lib/Math/Cephes.pod view on Meta::CPAN
ACCURACY:
Not accurately characterized, but spot checked against tables.
=item I<plancki>: Integral of Planck's black body radiation formula
SYNOPSIS:
# double lambda, T, y, plancki()
$y = plancki( $lambda, $T );
DESCRIPTION:
Evaluates the definite integral, from wavelength 0 to lambda,
of Planck's radiation formula
-5
c1 lambda
E = ------------------
c2/(lambda T)
e - 1
lib/Math/Cephes.pod view on Meta::CPAN
DESCRIPTION:
This evaluates the area under the graph of a function,
represented in a subroutine, from $a to $b, using an 8-point
Newton-Cotes formula. The routine divides up the interval into
equal segments, evaluates the integral, then compares that
to the result with double the number of segments. If the two
results agree, to within an absolute error $abs_err or a
relative error $rel_err, the result is returned; otherwise,
the number of segments is doubled again, and the results
lib/Math/Cephes.pod view on Meta::CPAN
zeta(x,q) = > (k+q)
-
k=0
where x > 1 and q is not a negative integer or zero.
The Euler-Maclaurin summation formula is used to obtain
the expansion
n
- -x
zeta(x,q) = > (k+q)
lib/Math/Cephes.pod view on Meta::CPAN
Extension of the function definition for x < 1 is implemented.
Zero is returned for x > log2(MAXNUM).
An overflow error may occur for large negative x, due to the
gamma function in the reflection formula.
ACCURACY:
Tabulated values have full machine accuracy.
view all matches for this distribution