Skip to content

Commit 84de62a

Browse files
committed
Features:
Bug Fixes/Re-organization: - Special Function Log Gamma Raabe Series Estimator (1) - Special Function Log Gamma Raabe Series Estimator - Constructor (2) - Special Function Log Gamma Raabe Series Estimator - Evaluate (3, 4) - Special Function Log Gamma Raabe Series Estimator - Inverted Rising Exponential Correction Estimate (5, 6, 7) - Special Function Log Gamma Raabe Series Estimator - Strip Integral (8, 9) - Special Function Log Gamma Ramanujam Series Estimator (10, 11, 12) - Special Function Log Gamma Ramanujam Series Estimator - Constructor (13) - Special Function Log Gamma Ramanujam Series Estimator - Evaluate (14, 15) - Special Function Log Gamma Ramanujam Series Estimator - Correction Estimate (16, 17, 18) - Special Function Log Gamma Stirling Series Estimator (19, 20, 21) - Special Function Log Gamma Stirling Series Estimator - Constructor (22) - Special Function Log Gamma Stirling Series Estimator - Log De-Moivre Term (23, 24) - Special Function Log Gamma Stirling Series Estimator - Evaluate (25) - Special Function Log Gamma Stirling Series Estimator - Nemes Correction Estimate (26, 27, 28) - Special Function Log Gamma Windschitl Toth Analytic Estimator (29, 30) - Special Function Log Gamma Windschitl Toth Analytic Estimator - Constructor (31) - Special Function Log Gamma Windschitl Toth Analytic Estimator - Evaluate (32, 33, 34) Samples: IdeaDRIP: - Carhart Four-Factor Model - Introduction (35-38) - Carhart Four-Factor Model - Development (39-60)
1 parent bd25d58 commit 84de62a

12 files changed

+209
-152
lines changed

AssetAllocationAnalyticsLibrary.md

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ Asset Allocation Analytics Library implements Optimal Portfolio Construction and
4444
* Discussion
4545
* Fama-French Five-Factor Model
4646
* References
47+
* Carhart Four-Factor Model
48+
* Introduction
49+
* Development
50+
* References
4751
* The Black Litterman Model
4852
* Overview
4953
* Introduction
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

ReleaseNotes/08_15_2023.txt

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
Features:
3+
4+
Bug Fixes/Re-organization:
5+
6+
- Special Function Log Gamma Raabe Series Estimator (1)
7+
- Special Function Log Gamma Raabe Series Estimator - Constructor (2)
8+
- Special Function Log Gamma Raabe Series Estimator - Evaluate (3, 4)
9+
- Special Function Log Gamma Raabe Series Estimator - Inverted Rising Exponential Correction Estimate (5, 6, 7)
10+
- Special Function Log Gamma Raabe Series Estimator - Strip Integral (8, 9)
11+
- Special Function Log Gamma Ramanujam Series Estimator (10, 11, 12)
12+
- Special Function Log Gamma Ramanujam Series Estimator - Constructor (13)
13+
- Special Function Log Gamma Ramanujam Series Estimator - Evaluate (14, 15)
14+
- Special Function Log Gamma Ramanujam Series Estimator - Correction Estimate (16, 17, 18)
15+
- Special Function Log Gamma Stirling Series Estimator (19, 20, 21)
16+
- Special Function Log Gamma Stirling Series Estimator - Constructor (22)
17+
- Special Function Log Gamma Stirling Series Estimator - Log De-Moivre Term (23, 24)
18+
- Special Function Log Gamma Stirling Series Estimator - Evaluate (25)
19+
- Special Function Log Gamma Stirling Series Estimator - Nemes Correction Estimate (26, 27, 28)
20+
- Special Function Log Gamma Windschitl Toth Analytic Estimator (29, 30)
21+
- Special Function Log Gamma Windschitl Toth Analytic Estimator - Constructor (31)
22+
- Special Function Log Gamma Windschitl Toth Analytic Estimator - Evaluate (32, 33, 34)
23+
24+
25+
Samples:
26+
27+
IdeaDRIP:
28+
29+
- Carhart Four-Factor Model - Introduction (35-38)
30+
- Carhart Four-Factor Model - Development (39-60)

ScheduleSheet.xlsx

7 Bytes
Binary file not shown.

src/main/java/org/drip/specialfunction/loggamma/RaabeSeriesEstimator.java

+36-49
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11

22
package org.drip.specialfunction.loggamma;
33

4+
import java.util.TreeMap;
5+
6+
import org.drip.numerical.common.NumberUtil;
7+
import org.drip.numerical.differentiation.DerivativeControl;
8+
import org.drip.numerical.estimation.R1Estimate;
9+
import org.drip.numerical.estimation.R1ToR1Estimator;
10+
import org.drip.numerical.estimation.R1ToR1Series;
11+
import org.drip.numerical.estimation.R1ToR1SeriesTerm;
12+
413
/*
514
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
615
*/
@@ -132,31 +141,30 @@
132141
* @author Lakshmi Krishnamurthy
133142
*/
134143

135-
public class RaabeSeriesEstimator extends org.drip.numerical.estimation.R1ToR1Estimator
144+
public class RaabeSeriesEstimator extends R1ToR1Estimator
136145
{
137146

138147
/**
139148
* <i>RaabeSeriesEstimator</i> Constructor
140149
*
141-
* @param dc The Derivative Control
150+
* @param derivativeControl The Derivative Control
142151
*/
143152

144153
public RaabeSeriesEstimator (
145-
final org.drip.numerical.differentiation.DerivativeControl dc)
154+
final DerivativeControl derivativeControl)
146155
{
147-
super (dc);
156+
super (derivativeControl);
148157
}
149158

150159
@Override public double evaluate (
151160
final double x)
152-
throws java.lang.Exception
161+
throws Exception
153162
{
154-
if (!org.drip.numerical.common.NumberUtil.IsValid (x) || 0. >= x)
155-
{
156-
throw new java.lang.Exception ("RaabeSeriesEstimator::evaluate => Invalid Inputs");
163+
if (!NumberUtil.IsValid (x) || 0. >= x) {
164+
throw new Exception ("RaabeSeriesEstimator::evaluate => Invalid Inputs");
157165
}
158166

159-
return x * java.lang.Math.log (x) - x + 0.5 * java.lang.Math.log (2. * java.lang.Math.PI / x);
167+
return x * Math.log (x) - x + 0.5 * Math.log (2. * Math.PI / x);
160168
}
161169

162170
/**
@@ -167,46 +175,26 @@ public RaabeSeriesEstimator (
167175
* @return The Bounded Function Estimates along with the Higher Order Inverted Rising Exponentials
168176
*/
169177

170-
public org.drip.numerical.estimation.R1Estimate invertedRisingExponentialCorrectionEstimate (
178+
public R1Estimate invertedRisingExponentialCorrectionEstimate (
171179
final double x)
172180
{
173-
java.util.TreeMap<java.lang.Integer, java.lang.Double> termWeightMap = new
174-
java.util.TreeMap<java.lang.Integer, java.lang.Double>();
175-
176-
termWeightMap.put (
177-
1,
178-
1. / 12.
179-
);
180-
181-
termWeightMap.put (
182-
2,
183-
1. / 12.
184-
);
185-
186-
termWeightMap.put (
187-
3,
188-
59. / 360.
189-
);
190-
191-
termWeightMap.put (
192-
4,
193-
29. / 60.
194-
);
195-
196-
try
197-
{
181+
TreeMap<Integer, Double> termWeightMap = new TreeMap<Integer, Double>();
182+
183+
termWeightMap.put (1, 1. / 12.);
184+
185+
termWeightMap.put (2, 1. / 12.);
186+
187+
termWeightMap.put (3, 59. / 360.);
188+
189+
termWeightMap.put (4, 29. / 60.);
190+
191+
try {
198192
return seriesEstimate (
199193
x,
200194
termWeightMap,
201-
new org.drip.numerical.estimation.R1ToR1Series (
202-
org.drip.numerical.estimation.R1ToR1SeriesTerm.InvertedRisingExponential(),
203-
false,
204-
termWeightMap
205-
)
195+
new R1ToR1Series (R1ToR1SeriesTerm.InvertedRisingExponential(), false, termWeightMap)
206196
);
207-
}
208-
catch (java.lang.Exception e)
209-
{
197+
} catch (Exception e) {
210198
e.printStackTrace();
211199
}
212200

@@ -220,18 +208,17 @@ public org.drip.numerical.estimation.R1Estimate invertedRisingExponentialCorrect
220208
*
221209
* @return The Raabe's Strip Integral between (a, a + 1) for the Log Gamma Function
222210
*
223-
* @throws java.lang.Exception Thrown if the Inputs are Invalid
211+
* @throws Exception Thrown if the Inputs are Invalid
224212
*/
225213

226214
public double stripIntegral (
227215
final double a)
228-
throws java.lang.Exception
216+
throws Exception
229217
{
230-
if (!org.drip.numerical.common.NumberUtil.IsValid (a) || 0. > a)
231-
{
232-
throw new java.lang.Exception ("RaabeSeriesEstimator::stripIntegral => Invalid Inputs");
218+
if (!NumberUtil.IsValid (a) || 0. > a) {
219+
throw new Exception ("RaabeSeriesEstimator::stripIntegral => Invalid Inputs");
233220
}
234221

235-
return 0.5 * java.lang.Math.log (2. * java.lang.Math.PI) + a * java.lang.Math.log (a) - a;
222+
return 0.5 * Math.log (2. * Math.PI) + a * Math.log (a) - a;
236223
}
237224
}

src/main/java/org/drip/specialfunction/loggamma/RamanujanSeriesEstimator.java

+46-33
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11

22
package org.drip.specialfunction.loggamma;
33

4+
import java.util.TreeMap;
5+
6+
import org.drip.numerical.common.NumberUtil;
7+
import org.drip.numerical.differentiation.DerivativeControl;
8+
import org.drip.numerical.estimation.R1Estimate;
9+
import org.drip.numerical.estimation.R1ToR1Estimator;
10+
import org.drip.numerical.estimation.R1ToR1Series;
11+
import org.drip.numerical.estimation.R1ToR1SeriesTerm;
12+
413
/*
514
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
615
*/
716

817
/*!
18+
* Copyright (C) 2025 Lakshmi Krishnamurthy
19+
* Copyright (C) 2024 Lakshmi Krishnamurthy
20+
* Copyright (C) 2023 Lakshmi Krishnamurthy
921
* Copyright (C) 2022 Lakshmi Krishnamurthy
1022
* Copyright (C) 2021 Lakshmi Krishnamurthy
1123
* Copyright (C) 2020 Lakshmi Krishnamurthy
@@ -102,44 +114,56 @@
102114
* https://en.wikipedia.org/wiki/Stirling%27s_approximation
103115
* </li>
104116
* </ul>
117+
*
118+
* It provides the following functionality:
105119
*
106-
* <br><br>
107120
* <ul>
108-
* <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></li>
109-
* <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FunctionAnalysisLibrary.md">Function Analysis Library</a></li>
110-
* <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/specialfunction/README.md">Special Function Implementation Analysis</a></li>
111-
* <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/specialfunction/loggamma/README.md">Analytic/Series/Integral Log Gamma Estimators</a></li>
121+
* <li><i>RamanujanSeriesEstimator</i> Constructor</li>
122+
* <li>Compute the Bounded Function Estimates along with the Higher Order Correction</li>
112123
* </ul>
113124
*
125+
* <br>
126+
* <style>table, td, th {
127+
* padding: 1px; border: 2px solid #008000; border-radius: 8px; background-color: #dfff00;
128+
* text-align: center; color: #0000ff;
129+
* }
130+
* </style>
131+
*
132+
* <table style="border:1px solid black;margin-left:auto;margin-right:auto;">
133+
* <tr><td><b>Module </b></td> <td><a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></td></tr>
134+
* <tr><td><b>Library</b></td> <td><a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FunctionAnalysisLibrary.md">Function Analysis Library</a></td></tr>
135+
* <tr><td><b>Project</b></td> <td><a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/specialfunction/README.md">Special Function Implementation and Analysis</a></td></tr>
136+
* <tr><td><b>Package</b></td> <td><a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/specialfunction/loggamma/README.md">Analytic/Series/Integral Log Gamma Estimators</a></td></tr>
137+
* </table>
138+
*
114139
* @author Lakshmi Krishnamurthy
115140
*/
116141

117-
public class RamanujanSeriesEstimator extends org.drip.numerical.estimation.R1ToR1Estimator
142+
public class RamanujanSeriesEstimator extends R1ToR1Estimator
118143
{
119144

120145
/**
121-
* RamanujanSeriesEstimator Constructor
146+
* <i>RamanujanSeriesEstimator</i> Constructor
122147
*
123-
* @param dc The Derivative Control
148+
* @param derivativeControl The Derivative Control
124149
*/
125150

126151
public RamanujanSeriesEstimator (
127-
final org.drip.numerical.differentiation.DerivativeControl dc)
152+
final DerivativeControl derivativeControl)
128153
{
129-
super (dc);
154+
super (derivativeControl);
130155
}
131156

132157
@Override public double evaluate (
133158
final double x)
134-
throws java.lang.Exception
159+
throws Exception
135160
{
136-
if (!org.drip.numerical.common.NumberUtil.IsValid (x) || 0. > x)
137-
{
138-
throw new java.lang.Exception ("RamanujanSeriesEstimator::evaluate => Invalid Inputs");
161+
if (!NumberUtil.IsValid (x) || 0. > x) {
162+
throw new Exception ("RamanujanSeriesEstimator::evaluate => Invalid Inputs");
139163
}
140164

141-
return x * java.lang.Math.log (x) - x + 0.5 * java.lang.Math.log (java.lang.Math.PI) +
142-
(java.lang.Math.log (8. * x * x * x + 4. * x * x + x + (1./ 30.))) / 6.;
165+
return x * Math.log (x) - x + 0.5 * Math.log (Math.PI) +
166+
(Math.log (8. * x * x * x + 4. * x * x + x + (1./ 30.))) / 6.;
143167
}
144168

145169
/**
@@ -150,31 +174,20 @@ public RamanujanSeriesEstimator (
150174
* @return The Bounded Function Estimates along with the Higher Order Correction
151175
*/
152176

153-
public org.drip.numerical.estimation.R1Estimate correctionEstimate (
177+
public R1Estimate correctionEstimate (
154178
final double x)
155179
{
156-
java.util.TreeMap<java.lang.Integer, java.lang.Double> termWeightMap = new
157-
java.util.TreeMap<java.lang.Integer, java.lang.Double>();
180+
TreeMap<Integer, Double> termWeightMap = new TreeMap<Integer, Double>();
158181

159-
termWeightMap.put (
160-
3,
161-
1. / 1400.
162-
);
182+
termWeightMap.put (3, 1. / 1400.);
163183

164-
try
165-
{
184+
try {
166185
return seriesEstimate (
167186
x,
168187
termWeightMap,
169-
new org.drip.numerical.estimation.R1ToR1Series (
170-
org.drip.numerical.estimation.R1ToR1SeriesTerm.Asymptotic(),
171-
false,
172-
termWeightMap
173-
)
188+
new R1ToR1Series (R1ToR1SeriesTerm.Asymptotic(), false, termWeightMap)
174189
);
175-
}
176-
catch (java.lang.Exception e)
177-
{
190+
} catch (Exception e) {
178191
e.printStackTrace();
179192
}
180193

0 commit comments

Comments
 (0)