From ff32c589881c77a1e3c043fe0fc29fc897cb11a2 Mon Sep 17 00:00:00 2001 From: Lakshmi Krishnamurthy Date: Sat, 3 Feb 2024 21:50:25 -0500 Subject: [PATCH] Features: - Utility Function Private Valuation Ojective (46) - Agent Optimization Utility Function Expectation (47, 48) - Utility Expectation Function Inventory Vertex (49, 50, 51) - Utility Expectation Function Money Market (52, 53) - Utility Expectation Function Evaluate #1 (54, 55, 56) - Utility Expectation Function Evaluate #2 (57, 58) - Utility Expectation Function Evaluate #3 (59, 60) Bug Fixes/Re-organization: - Special Function Definition Riccati Bessel Zita Estimator (1) - Special Function Definition Riccati Bessel Zita Estimator - Evaluate (2) - Special Function Definition Scaled Exponential Estimator (3, 4, 5) - Special Function Definition Scaled Exponential Estimator - Exponent (6, 7) - Special Function Definition Scaled Exponential Estimator - Characteristic Relaxation Time (8, 9) - Special Function Definition Scaled Exponential Estimator - Constructor (10, 11) - Special Function Definition Scaled Exponential Estimator - Evaluate (12, 13) - Special Function Definition Scaled Exponential Estimator - Evaluate Using Density (14, 15, 16) - Special Function Definition Scaled Exponential Estimator - Is Compressed (17) - Special Function Definition Scaled Exponential Estimator - Is Stretched (18) - Special Function Definition Scaled Exponential Estimator - Is Unscaled (19) - Special Function Definition Scaled Exponential Estimator - Is Normal (20) - Special Function Definition Scaled Exponential Estimator - First Moment (21, 22) - Special Function Definition Scaled Exponential Estimator - Higher Moment (23, 24) - Special Function Definition Scaled Exponential Estimator - Higher Moments Using Density #1 (25, 26) - Special Function Definition Scaled Exponential Estimator - Higher Moments Using Density #2 (27, 28) - Special Function Definition Scaled Exponential Estimator - Log Relaxation First Moment (29) - Special Function Definition Spherical Bessel First Kind Estimator (30, 31) - Special Function Definition Spherical Bessel First Kind Estimator - Small J (32) - Special Function Definition Spherical Bessel First Kind Estimator - Evaluate (33) - Special Function Definition Spherical Bessel Second Kind Estimator (34, 35) - Special Function Definition Spherical Bessel Second Kind Estimator - Small Y (36) - Special Function Definition Spherical Bessel First Kind Estimator - Evaluate (37) - Special Function Definition Spherical Hankel First Kind Estimator (38, 39) - Special Function Definition Spherical Hankel First Kind Estimator - Small H1 (40) - Special Function Definition Spherical Hankel First Kind Estimator - Evaluate (41) - Special Function Definition Spherical Bessel Second Kind Estimator - Evaluate (42, 43) - Special Function Definition Spherical Hankel Second Kind Estimator - Small H2 (44) - Special Function Definition Spherical Hankel Second Kind Estimator - Evaluate (45) Samples: IdeaDRIP: --- ReleaseNotes/06_12_2023.txt | 48 +++++ ScheduleSheet.xlsx | Bin 52175 -> 52168 bytes .../oms/indifference/UtilityFunction.java | 18 +- .../UtilityFunctionExpectation.java | 114 +++++++++++- .../ScaledExponentialEstimator.java | 172 +++++++++--------- .../SphericalBesselFirstKindEstimator.java | 42 +++-- .../SphericalBesselSecondKindEstimator.java | 42 +++-- .../SphericalHankelFirstKindEstimator.java | 44 +++-- .../SphericalHankelSecondKindEstimator.java | 44 +++-- 9 files changed, 372 insertions(+), 152 deletions(-) create mode 100644 ReleaseNotes/06_12_2023.txt diff --git a/ReleaseNotes/06_12_2023.txt b/ReleaseNotes/06_12_2023.txt new file mode 100644 index 000000000000..7ed9d6fa2a50 --- /dev/null +++ b/ReleaseNotes/06_12_2023.txt @@ -0,0 +1,48 @@ + +Features: + + - Utility Function Private Valuation Ojective (46) + - Agent Optimization Utility Function Expectation (47, 48) + - Utility Expectation Function Inventory Vertex (49, 50, 51) + - Utility Expectation Function Money Market (52, 53) + - Utility Expectation Function Evaluate #1 (54, 55, 56) + - Utility Expectation Function Evaluate #2 (57, 58) + - Utility Expectation Function Evaluate #3 (59, 60) + + +Bug Fixes/Re-organization: + + - Special Function Definition Riccati Bessel Zita Estimator (1) + - Special Function Definition Riccati Bessel Zita Estimator - Evaluate (2) + - Special Function Definition Scaled Exponential Estimator (3, 4, 5) + - Special Function Definition Scaled Exponential Estimator - Exponent (6, 7) + - Special Function Definition Scaled Exponential Estimator - Characteristic Relaxation Time (8, 9) + - Special Function Definition Scaled Exponential Estimator - Constructor (10, 11) + - Special Function Definition Scaled Exponential Estimator - Evaluate (12, 13) + - Special Function Definition Scaled Exponential Estimator - Evaluate Using Density (14, 15, 16) + - Special Function Definition Scaled Exponential Estimator - Is Compressed (17) + - Special Function Definition Scaled Exponential Estimator - Is Stretched (18) + - Special Function Definition Scaled Exponential Estimator - Is Unscaled (19) + - Special Function Definition Scaled Exponential Estimator - Is Normal (20) + - Special Function Definition Scaled Exponential Estimator - First Moment (21, 22) + - Special Function Definition Scaled Exponential Estimator - Higher Moment (23, 24) + - Special Function Definition Scaled Exponential Estimator - Higher Moments Using Density #1 (25, 26) + - Special Function Definition Scaled Exponential Estimator - Higher Moments Using Density #2 (27, 28) + - Special Function Definition Scaled Exponential Estimator - Log Relaxation First Moment (29) + - Special Function Definition Spherical Bessel First Kind Estimator (30, 31) + - Special Function Definition Spherical Bessel First Kind Estimator - Small J (32) + - Special Function Definition Spherical Bessel First Kind Estimator - Evaluate (33) + - Special Function Definition Spherical Bessel Second Kind Estimator (34, 35) + - Special Function Definition Spherical Bessel Second Kind Estimator - Small Y (36) + - Special Function Definition Spherical Bessel First Kind Estimator - Evaluate (37) + - Special Function Definition Spherical Hankel First Kind Estimator (38, 39) + - Special Function Definition Spherical Hankel First Kind Estimator - Small H1 (40) + - Special Function Definition Spherical Hankel First Kind Estimator - Evaluate (41) + - Special Function Definition Spherical Bessel Second Kind Estimator - Evaluate (42, 43) + - Special Function Definition Spherical Hankel Second Kind Estimator - Small H2 (44) + - Special Function Definition Spherical Hankel Second Kind Estimator - Evaluate (45) + + +Samples: + +IdeaDRIP: diff --git a/ScheduleSheet.xlsx b/ScheduleSheet.xlsx index a898e45b418aa920499854ee93ea4140eecc2cfe..14f2243e53b80e7983daa8ad5ad5fede486b7b76 100644 GIT binary patch delta 3690 zcmV-w4wdoGmjlR`1F-A{1wfJOaR!s|1}T4pkAO<61cFwn+oG&%Un*5DIK>KJW}7Be z)&IV064H;nbnT+V#=bYl=iYmKIX>Ogm2ppnWW0$HKC+QPo17P{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rn@It#_qlxUXM zQ2zvhzo{`6&OZ{7SHT94BC8PA+~rM6(wM4t;tk$3+s+p^#)#Uo(cvw)1XGk~&&uQ_ ze5_+KQdjmBZ~aBE#0hC=C(S6k`xwwND$mtPS zzRC5;@eUO-hRcs%BMW)_5#m`jIN_jTdq~48Bp<$5yOBn;Anrr#4li`jKzjA>kJf9x z4Ss{0vTM0BcaSJ55GB)B<+RJY)F;v^@pE24Yy8V%%I>H6X-Xd_wi z6~oe_XbXRO#Y_p*avDj+n6dgG_n*kq=RG2p%ngj@b*miz@MvA;+7Iov355=_`|)HG zTgmMaEhG)hnI@pt`t^ViI2{@J1XGLbPyphvk#(TdW@U6${t-`dqe8j9Ve;JmLYBYX zwrTL7I{h~O}gZXUUN6Av+4)1VAK+8n&Ty0 zQQGo_btN$lQc`w8@59P6VB7gfC_=*BhfDW};*K_?t-U~JDi>7Quc(lgjpwq3y2nCf zo#g901>W|-I#&rh6x#8V;tl30YAmqdVwiD4%d>)}@F~+gmdoVf?>~}mTeWukHvp~F zVMVGwvxTJO;e48XEKWcusMs$U(4e)}@z4F#+Pxe#H6Bz7<(}ZlQU~EjtTLQ-ErvLv zLFxXjvE?gb;`#?Ud^(CI!kffv!7*f}U6$UckLkjQGYGMo$X)xUO9S*jm5pLf4}$^# zL>VYQ%G3}@Ck@~NKmd$?fkhPXUkD4}`@8u+*%IS>Q3C%Y04C=5O9I7+L;aS(Y9f3 Invalid Inputs"); } } /** - * Retrieve the Agent's Objective Function + * Retrieve the Agent's Private Valuation Function * - * @return The Agent's Objective Function + * @return The Agent's Private Valuation Function */ - public R1ToR1 agentObjective() + public R1ToR1 privateValuationObjective() { - return _agentObjective; + return _privateValuationObjective; } /** @@ -162,6 +162,6 @@ public double evaluate ( throw new Exception ("UtilityFunction::evaluate => Invald Position Vertex"); } - return _agentObjective.evaluate (positionVertex.value()); + return _privateValuationObjective.evaluate (positionVertex.value()); } } diff --git a/src/main/java/org/drip/oms/indifference/UtilityFunctionExpectation.java b/src/main/java/org/drip/oms/indifference/UtilityFunctionExpectation.java index 6364e173448e..d999335ed87e 100644 --- a/src/main/java/org/drip/oms/indifference/UtilityFunctionExpectation.java +++ b/src/main/java/org/drip/oms/indifference/UtilityFunctionExpectation.java @@ -1,6 +1,9 @@ package org.drip.oms.indifference; +import org.drip.measure.continuous.R1Univariate; +import org.drip.measure.discrete.R1Distribution; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ @@ -112,5 +115,114 @@ public class UtilityFunctionExpectation { - private UtilityFunction _utilityFunction = null; + private double _moneyMarketPrice = Double.NaN; + private UtilityFunction _agentOptimizer = null; + private InventoryVertex _inventoryVertex = null; + + /** + * Retrieve the Agent Optimization Utility Function + * + * @return Agent Optimization Utility Function + */ + + public UtilityFunction agentOptimizer() + { + return _agentOptimizer; + } + + /** + * Retrieve the Inventory Vertex + * + * @return The Inventory Vertex + */ + + public InventoryVertex inventoryVertex() + { + return _inventoryVertex; + } + + /** + * Retrieve the Price of Money Market Entity + * + * @return Number of Money Market Entity + */ + + public double moneyMarketPrice() + { + return _moneyMarketPrice; + } + + /** + * Compute the Agent's Objective Function Value For the Underlier Price + * + * @param underlierPrice The Underlier Price + * + * @return The Agent's Objective Function Value For the Underlier Price + * + * @throws Exception Thrown if the Agent's Objective Function Value cannot be calculated + */ + + public double objectiveValue ( + final double underlierPrice) + throws Exception + { + return _agentOptimizer.evaluate ( + new PositionVertex ( + _inventoryVertex, + new RealizationVertex (_moneyMarketPrice, underlierPrice), + _agentOptimizer.privateValuationObjective() + ) + ); + } + + /** + * Compute the Expectation of the Agent Utility Function given the Underlier Price Array and Discrete + * Distribution + * + * @param underlierPriceDistribution Discrete Underlier Price Distribution + * @param underlierPriceArray Underlier Price Array + * + * @return Expectation of the Agent Utility Function + * + * @throws Exception Thrown if the Inputs are Invalid + */ + + public double evaluate ( + final R1Distribution underlierPriceDistribution, + final double[] underlierPriceArray) + throws Exception + { + if (null == underlierPriceDistribution || + null == underlierPriceArray || 0 == underlierPriceArray.length) { + throw new Exception ("UtilityFunctionExpectation::evaluate => Invalid Inputs"); + } + + double utilityFunctionExpectationValue = 0.; + + for (double underlierPrice : underlierPriceArray) { + utilityFunctionExpectationValue += underlierPriceDistribution.probability (underlierPrice) * + _agentOptimizer.evaluate ( + new PositionVertex ( + _inventoryVertex, + new RealizationVertex (_moneyMarketPrice, underlierPrice), + _agentOptimizer.privateValuationObjective() + ) + ); + } + + return utilityFunctionExpectationValue; + } + + public double evaluate ( + final R1Univariate underlierPriceDistribution) + throws Exception + { + if (null == underlierPriceDistribution) { + throw new Exception ("UtilityFunctionExpectation::evaluate => Invalid Inputs"); + } + + double utilityFunctionExpectationValue = 0.; + + return utilityFunctionExpectationValue; + } } diff --git a/src/main/java/org/drip/specialfunction/definition/ScaledExponentialEstimator.java b/src/main/java/org/drip/specialfunction/definition/ScaledExponentialEstimator.java index a5f90fa597b5..f33c388fdfc5 100644 --- a/src/main/java/org/drip/specialfunction/definition/ScaledExponentialEstimator.java +++ b/src/main/java/org/drip/specialfunction/definition/ScaledExponentialEstimator.java @@ -1,11 +1,19 @@ package org.drip.specialfunction.definition; +import org.drip.function.definition.R1ToR1; +import org.drip.numerical.common.NumberUtil; +import org.drip.numerical.integration.NewtonCotesQuadratureGenerator; +import org.drip.specialfunction.gamma.Definitions; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -78,7 +86,7 @@ /** * ScaledExponentialEstimator exposes the Estimator for the Scaled (i.e., Stretched/Compressed) - * Exponential Function. The References are: + * Exponential Function. The References are: * *

*
    @@ -104,44 +112,66 @@ * Physics 116 (8) 3204-3209 * *
+ * + * It provides the following functionality: * - *

*
    - *
  • Module = Computational Core Module
  • - *
  • Library = Function Analysis Library
  • - *
  • Project = Special Function Implementation Analysis
  • - *
  • Package = Definition of Special Function Estimators
  • + *
  • ScaledExponentialEstimator Constructor
  • + *
  • Retrieve the Exponent
  • + *
  • Retrieve the Characteristic Relaxation Time
  • + *
  • Evaluate using the Relaxation Time Density
  • + *
  • Indicate if the Function is Compressed Exponential
  • + *
  • Indicate if the Function is Stretched Exponential
  • + *
  • Indicate if the Function is Unscaled (i.e., Standard) Exponential
  • + *
  • Indicate if the Function is Normal (i.e., Gaussian) Exponential
  • + *
  • Compute the First Moment
  • + *
  • Compute the Higher Moment
  • + *
  • Compute the Higher Moment using the Relaxation Time Density
  • + *
  • Compute the First Moment of Log Relaxation Time
  • *
* + *
+ * + * + * + * + * + * + * + *
Module Product Core Module
Library Fixed Income Analytics
Project Special Function Implementation and Analysis
Package Definition of Special Function Estimators
+ * * @author Lakshmi Krishnamurthy */ -public class ScaledExponentialEstimator extends org.drip.function.definition.R1ToR1 +public class ScaledExponentialEstimator extends R1ToR1 { - private double _exponent = java.lang.Double.NaN; - private double _characteristicRelaxationTime = java.lang.Double.NaN; + private double _exponent = Double.NaN; + private double _characteristicRelaxationTime = Double.NaN; /** - * ScaledExponentialEstimator Constructor + * ScaledExponentialEstimator Constructor * * @param exponent The Exponent * @param characteristicRelaxationTime The Characteristic Relaxation Time * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public ScaledExponentialEstimator ( final double exponent, final double characteristicRelaxationTime) - throws java.lang.Exception + throws Exception { super (null); - if (!org.drip.numerical.common.NumberUtil.IsValid (_exponent = exponent) || 0. > _exponent || - !org.drip.numerical.common.NumberUtil.IsValid (_characteristicRelaxationTime = - characteristicRelaxationTime) || 0. > _characteristicRelaxationTime) - { - throw new java.lang.Exception ("ScaledExponentialEstimator Constructor => Invalid Inputs"); + if (!NumberUtil.IsValid (_exponent = exponent) || 0. > _exponent || + !NumberUtil.IsValid (_characteristicRelaxationTime = characteristicRelaxationTime) || + 0. > _characteristicRelaxationTime) { + throw new Exception ("ScaledExponentialEstimator Constructor => Invalid Inputs"); } } @@ -169,19 +199,13 @@ public double characteristicRelaxationTime() @Override public double evaluate ( final double t) - throws java.lang.Exception + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (t) || 0. > t) - { - throw new java.lang.Exception ("ScaledExponentialEstimator::evaluate => Invalid Inputs"); + if (!NumberUtil.IsValid (t) || 0. > t) { + throw new Exception ("ScaledExponentialEstimator::evaluate => Invalid Inputs"); } - return java.lang.Math.exp ( - -1. * java.lang.Math.pow ( - t / _characteristicRelaxationTime, - _exponent - ) - ); + return Math.exp (-1. * Math.pow (t / _characteristicRelaxationTime, _exponent)); } /** @@ -192,33 +216,25 @@ public double characteristicRelaxationTime() * * @return The Evaluation using the Relaxation Time Density * - * @throws java.lang.Exception Thrown if the Evaluation cannot be done + * @throws Exception Thrown if the Evaluation cannot be done */ public double evaluateUsingDensity ( final double t, - final org.drip.specialfunction.definition.RelaxationTimeDistributionEstimator - relaxationTimeDistributionEstimator) - throws java.lang.Exception + final RelaxationTimeDistributionEstimator relaxationTimeDistributionEstimator) + throws Exception { - if (!org.drip.numerical.common.NumberUtil.IsValid (t) || 0. > t || - null == relaxationTimeDistributionEstimator) - { - throw new java.lang.Exception - ("ScaledExponentialEstimator::evaluateUsingDensity => Invalid Inputs"); + if (!NumberUtil.IsValid (t) || 0. > t || null == relaxationTimeDistributionEstimator) { + throw new Exception ("ScaledExponentialEstimator::evaluateUsingDensity => Invalid Inputs"); } - return org.drip.numerical.integration.NewtonCotesQuadratureGenerator.GaussLaguerreLeftDefinite ( - 0., - 100 - ).integrate ( - new org.drip.function.definition.R1ToR1 (null) - { + return NewtonCotesQuadratureGenerator.GaussLaguerreLeftDefinite (0., 100).integrate ( + new R1ToR1 (null) { @Override public double evaluate ( final double u) - throws java.lang.Exception + throws Exception { - return java.lang.Double.isInfinite (u) || 0. == u ? 0. : java.lang.Math.exp (-t / u) * + return Double.isInfinite (u) || 0. == u ? 0. : Math.exp (-t / u) * relaxationTimeDistributionEstimator.relaxationTimeDensity (u); } } @@ -276,16 +292,15 @@ public boolean isNormal() * * @return The First Moment * - * @throws java.lang.Exception Thrown if the First Moment cannot be calculated + * @throws Exception Thrown if the First Moment cannot be calculated */ public double firstMoment ( - final org.drip.function.definition.R1ToR1 gammaEstimator) - throws java.lang.Exception + final R1ToR1 gammaEstimator) + throws Exception { - if (null == gammaEstimator) - { - throw new java.lang.Exception ("ScaledExponentialEstimator::firstMoment => Invalid Inputs"); + if (null == gammaEstimator) { + throw new Exception ("ScaledExponentialEstimator::firstMoment => Invalid Inputs"); } double inverseExponent = 1. / _exponent; @@ -301,26 +316,22 @@ public double firstMoment ( * * @return The Higher Moment * - * @throws java.lang.Exception Thrown if the Higher Moment cannot be calculated + * @throws Exception Thrown if the Higher Moment cannot be calculated */ public double higherMoment ( final int momentOrder, - final org.drip.function.definition.R1ToR1 gammaEstimator) - throws java.lang.Exception + final R1ToR1 gammaEstimator) + throws Exception { - if (0 > momentOrder || - null == gammaEstimator) - { - throw new java.lang.Exception ("ScaledExponentialEstimator::higherMoment => Invalid Inputs"); + if (0 > momentOrder || null == gammaEstimator) { + throw new Exception ("ScaledExponentialEstimator::higherMoment => Invalid Inputs"); } double inverseExponent = 1. / _exponent; - return java.lang.Math.pow ( - _characteristicRelaxationTime, - momentOrder - ) * inverseExponent * gammaEstimator.evaluate (momentOrder * inverseExponent); + return Math.pow (_characteristicRelaxationTime, momentOrder) * inverseExponent * + gammaEstimator.evaluate (momentOrder * inverseExponent); } /** @@ -332,41 +343,30 @@ public double higherMoment ( * * @return The Higher Moment using the Relaxation Time Density * - * @throws java.lang.Exception Thrown if the Higher Moment cannot be calculated + * @throws Exception Thrown if the Higher Moment cannot be calculated */ public double higherMomentUsingDensity ( final int momentOrder, - final org.drip.specialfunction.definition.RelaxationTimeDistributionEstimator - relaxationTimeDistributionEstimator, - final org.drip.function.definition.R1ToR1 gammaEstimator) - throws java.lang.Exception + final RelaxationTimeDistributionEstimator relaxationTimeDistributionEstimator, + final R1ToR1 gammaEstimator) + throws Exception { - if (0 > momentOrder || - null == relaxationTimeDistributionEstimator || - null == gammaEstimator) - { - throw new java.lang.Exception - ("ScaledExponentialEstimator::higherMomentUsingDensity => Invalid Inputs"); + if (0 > momentOrder || null == relaxationTimeDistributionEstimator || null == gammaEstimator) { + throw new Exception ("ScaledExponentialEstimator::higherMomentUsingDensity => Invalid Inputs"); } - return org.drip.numerical.integration.NewtonCotesQuadratureGenerator.GaussLaguerreLeftDefinite ( - 0., - 100 - ).integrate ( - new org.drip.function.definition.R1ToR1 (null) - { + return NewtonCotesQuadratureGenerator.GaussLaguerreLeftDefinite (0., 100).integrate ( + new R1ToR1 (null) { @Override public double evaluate ( final double t) - throws java.lang.Exception + throws Exception { - return java.lang.Double.isInfinite (t) || 0. == t ? 0. : java.lang.Math.pow ( - t, - momentOrder - ) * relaxationTimeDistributionEstimator.relaxationTimeDensity (t); + return Double.isInfinite (t) || 0. == t ? 0. : Math.pow (t, momentOrder) * + relaxationTimeDistributionEstimator.relaxationTimeDensity (t); } } - ) * gammaEstimator.evaluate (momentOrder + 1.) * java.lang.Math.pow ( + ) * gammaEstimator.evaluate (momentOrder + 1.) * Math.pow ( _characteristicRelaxationTime, momentOrder ); @@ -380,7 +380,7 @@ public double higherMomentUsingDensity ( public double logRelaxationFirstMoment() { - return (1. - (1. / _exponent)) * org.drip.specialfunction.gamma.Definitions.EULER_MASCHERONI + - java.lang.Math.log (_characteristicRelaxationTime); + return (1. - (1. / _exponent)) * Definitions.EULER_MASCHERONI + + Math.log (_characteristicRelaxationTime); } } diff --git a/src/main/java/org/drip/specialfunction/definition/SphericalBesselFirstKindEstimator.java b/src/main/java/org/drip/specialfunction/definition/SphericalBesselFirstKindEstimator.java index f49486e59e51..47cf26d242af 100644 --- a/src/main/java/org/drip/specialfunction/definition/SphericalBesselFirstKindEstimator.java +++ b/src/main/java/org/drip/specialfunction/definition/SphericalBesselFirstKindEstimator.java @@ -1,11 +1,16 @@ package org.drip.specialfunction.definition; +import org.drip.function.definition.R2ToR1; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -78,7 +83,7 @@ /** * SphericalBesselFirstKindEstimator exposes the Estimator for the Spherical Bessel Function of the - * First Kind. The References are: + * First Kind. The References are: * *

*
    @@ -102,19 +107,31 @@ * Wikipedia (2019): Bessel Function https://en.wikipedia.org/wiki/Bessel_function * *
+ * + * It provides the following functionality: * - *

* * + *
+ * + * + * + * + * + * + * + *
Module Product Core Module
Library Fixed Income Analytics
Project Special Function Implementation and Analysis
Package Definition of Special Function Estimators
+ * * @author Lakshmi Krishnamurthy */ -public abstract class SphericalBesselFirstKindEstimator implements org.drip.function.definition.R2ToR1 +public abstract class SphericalBesselFirstKindEstimator implements R2ToR1 { /** @@ -125,22 +142,19 @@ public abstract class SphericalBesselFirstKindEstimator implements org.drip.func * * @return Spherical Bessel Function First Kind j Value * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public abstract double smallJ ( final double alpha, final double z) - throws java.lang.Exception; + throws Exception; @Override public double evaluate ( final double alpha, final double z) - throws java.lang.Exception + throws Exception { - return smallJ ( - alpha, - z - ); + return smallJ (alpha, z); } } diff --git a/src/main/java/org/drip/specialfunction/definition/SphericalBesselSecondKindEstimator.java b/src/main/java/org/drip/specialfunction/definition/SphericalBesselSecondKindEstimator.java index 700c989dea99..7d53d2bb1082 100644 --- a/src/main/java/org/drip/specialfunction/definition/SphericalBesselSecondKindEstimator.java +++ b/src/main/java/org/drip/specialfunction/definition/SphericalBesselSecondKindEstimator.java @@ -1,11 +1,16 @@ package org.drip.specialfunction.definition; +import org.drip.function.definition.R2ToR1; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -78,7 +83,7 @@ /** * SphericalBesselSecondKindEstimator exposes the Estimator for the Spherical Bessel Function of the - * Second Kind. The References are: + * Second Kind. The References are: * *

*
    @@ -102,19 +107,31 @@ * Wikipedia (2019): Bessel Function https://en.wikipedia.org/wiki/Bessel_function * *
+ * + * It provides the following functionality: * - *

* * + *
+ * + * + * + * + * + * + * + *
Module Product Core Module
Library Fixed Income Analytics
Project Special Function Implementation and Analysis
Package Definition of Special Function Estimators
+ * * @author Lakshmi Krishnamurthy */ -public abstract class SphericalBesselSecondKindEstimator implements org.drip.function.definition.R2ToR1 +public abstract class SphericalBesselSecondKindEstimator implements R2ToR1 { /** @@ -125,22 +142,19 @@ public abstract class SphericalBesselSecondKindEstimator implements org.drip.fun * * @return Spherical Bessel Function Second Kind y Value * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public abstract double smallY ( final double alpha, final double z) - throws java.lang.Exception; + throws Exception; @Override public double evaluate ( final double alpha, final double z) - throws java.lang.Exception + throws Exception { - return smallY ( - alpha, - z - ); + return smallY (alpha, z); } } diff --git a/src/main/java/org/drip/specialfunction/definition/SphericalHankelFirstKindEstimator.java b/src/main/java/org/drip/specialfunction/definition/SphericalHankelFirstKindEstimator.java index 851ea8071fff..a30f21fa246f 100644 --- a/src/main/java/org/drip/specialfunction/definition/SphericalHankelFirstKindEstimator.java +++ b/src/main/java/org/drip/specialfunction/definition/SphericalHankelFirstKindEstimator.java @@ -1,11 +1,17 @@ package org.drip.specialfunction.definition; +import org.drip.function.definition.CartesianComplexNumber; +import org.drip.function.definition.R2ToZ1; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -78,7 +84,7 @@ /** * SphericalHankelFirstKindEstimator exposes the Estimator for the Spherical Hankel Function of the - * First Kind. The References are: + * First Kind. The References are: * *

*
    @@ -102,19 +108,31 @@ * Wikipedia (2019): Bessel Function https://en.wikipedia.org/wiki/Bessel_function * *
+ * + * It provides the following functionality: * - *

* * + *
+ * + * + * + * + * + * + * + *
Module Product Core Module
Library Fixed Income Analytics
Project Special Function Implementation and Analysis
Package Definition of Special Function Estimators
+ * * @author Lakshmi Krishnamurthy */ -public abstract class SphericalHankelFirstKindEstimator implements org.drip.function.definition.R2ToZ1 +public abstract class SphericalHankelFirstKindEstimator implements R2ToZ1 { /** @@ -126,17 +144,15 @@ public abstract class SphericalHankelFirstKindEstimator implements org.drip.func * @return Spherical Hankel Function First Kind h1 Value */ - public abstract org.drip.function.definition.CartesianComplexNumber smallH1 ( + public abstract CartesianComplexNumber smallH1 ( final double alpha, - final double z); + final double z + ); - @Override public org.drip.function.definition.CartesianComplexNumber evaluate ( + @Override public CartesianComplexNumber evaluate ( final double alpha, final double z) { - return smallH1 ( - alpha, - z - ); + return smallH1 (alpha, z); } } diff --git a/src/main/java/org/drip/specialfunction/definition/SphericalHankelSecondKindEstimator.java b/src/main/java/org/drip/specialfunction/definition/SphericalHankelSecondKindEstimator.java index 7987b2b0d539..39f8e1afbbde 100644 --- a/src/main/java/org/drip/specialfunction/definition/SphericalHankelSecondKindEstimator.java +++ b/src/main/java/org/drip/specialfunction/definition/SphericalHankelSecondKindEstimator.java @@ -1,11 +1,17 @@ package org.drip.specialfunction.definition; +import org.drip.function.definition.CartesianComplexNumber; +import org.drip.function.definition.R2ToZ1; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -78,7 +84,7 @@ /** * SphericalHankelSecondKindEstimator exposes the Estimator for the Spherical Hankel Function of the - * Second Kind. The References are: + * Second Kind. The References are: * *

*
    @@ -102,19 +108,31 @@ * Wikipedia (2019): Bessel Function https://en.wikipedia.org/wiki/Bessel_function * *
+ * + * It provides the following functionality: * - *

* * + *
+ * + * + * + * + * + * + * + *
Module Product Core Module
Library Fixed Income Analytics
Project Special Function Implementation and Analysis
Package Definition of Special Function Estimators
+ * * @author Lakshmi Krishnamurthy */ -public abstract class SphericalHankelSecondKindEstimator implements org.drip.function.definition.R2ToZ1 +public abstract class SphericalHankelSecondKindEstimator implements R2ToZ1 { /** @@ -126,17 +144,15 @@ public abstract class SphericalHankelSecondKindEstimator implements org.drip.fun * @return Spherical Hankel Function Second Kind h2 Value */ - public abstract org.drip.function.definition.CartesianComplexNumber smallH2 ( + public abstract CartesianComplexNumber smallH2 ( final double alpha, - final double z); + final double z + ); - @Override public org.drip.function.definition.CartesianComplexNumber evaluate ( + @Override public CartesianComplexNumber evaluate ( final double alpha, final double z) { - return smallH2 ( - alpha, - z - ); + return smallH2 (alpha, z); } }