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