| 1 | package Math::Business::BlackScholes::Binaries::Greeks::Math; | ||
| 2 | 1 | ▶ | use strict; use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 1 | our $VERSION = '0.04'; | |
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | BOM::Utility::Math::Routines | ||
| 9 | |||
| 10 | =head1 DESCRIPTION | ||
| 11 | |||
| 12 | Misc math routines. | ||
| 13 | |||
| 14 | =cut | ||
| 15 | |||
| 16 | 1 | ▶ | use base qw( Exporter ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 1 | our @EXPORT_OK = qw( ddgauss dgauss ); | |
| 18 | |||
| 19 | =head2 dgauss | ||
| 20 | |||
| 21 | normal density | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | 1 | ▶ | use constant PI => 4 * atan2(1, 1); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | sub dgauss { | ||
| 28 | 459 | ▶ | my $x = shift; |
|
Subroutine
dgauss: called CC=1 SCAR=0.0
Pod
documented
| |||
| 29 | |||
| 30 | 459 | return exp(-1 * $x * $x / 2) / (2 * PI)**0.5; | |
| 31 | } | ||
| 32 | |||
| 33 | =head2 ddgauss | ||
| 34 | |||
| 35 | dnormal density | ||
| 36 | |||
| 37 | =cut | ||
| 38 | |||
| 39 | sub ddgauss { | ||
| 40 | 32 | ▶ | my $x = shift; |
|
Subroutine
ddgauss: called CC=1 SCAR=0.0
Pod
documented
| |||
| 41 | |||
| 42 | 32 | return -1 * $x * dgauss($x); | |
| 43 | } | ||
| 44 | |||
| 45 | 1 | 1; | |