1
1
2
2
package org .drip .specialfunction .property ;
3
3
4
+ import org .drip .function .definition .R1PropertyVerification ;
5
+ import org .drip .function .definition .R1ToR1Property ;
6
+ import org .drip .function .r1tor1 .MonicPolynomial ;
7
+ import org .drip .specialfunction .loggamma .InfiniteSumEstimator ;
8
+
4
9
/*
5
10
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
6
11
*/
7
12
8
13
/*!
14
+ * Copyright (C) 2025 Lakshmi Krishnamurthy
15
+ * Copyright (C) 2024 Lakshmi Krishnamurthy
16
+ * Copyright (C) 2023 Lakshmi Krishnamurthy
9
17
* Copyright (C) 2022 Lakshmi Krishnamurthy
10
18
* Copyright (C) 2021 Lakshmi Krishnamurthy
11
19
* Copyright (C) 2020 Lakshmi Krishnamurthy
78
86
79
87
/**
80
88
* <i>GammaPolynomialQuotientLemma</i> contains the Verifiable Gamma Polynomial Quotient Equality Lemma. The
81
- * References are:
89
+ * References are:
82
90
*
83
91
* <br><br>
84
92
* <ul>
102
110
* Wikipedia (2019): Gamma Function https://en.wikipedia.org/wiki/Gamma_function
103
111
* </li>
104
112
* </ul>
113
+ *
114
+ * It provides the following functionality:
105
115
*
106
- * <br><br>
107
116
* <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/property/README.md">Special Function Property Lemma Verifiers</a> </li>
117
+ * <li><i>GammaPolynomialQuotientLemma</i> Constructor </li>
118
+ * <li>Retrieve the Monic Polynomial "P" </li>
119
+ * <li>Retrieve the Monic Polynomial "Q" </li>
120
+ * <li>Run the Equality Lemma over the specified a and b </li>
112
121
* </ul>
113
122
*
123
+ * <br>
124
+ * <style>table, td, th {
125
+ * padding: 1px; border: 2px solid #008000; border-radius: 8px; background-color: #dfff00;
126
+ * text-align: center; color: #0000ff;
127
+ * }
128
+ * </style>
129
+ *
130
+ * <table style="border:1px solid black;margin-left:auto;margin-right:auto;">
131
+ * <tr><td><b>Module </b></td> <td><a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></td></tr>
132
+ * <tr><td><b>Library</b></td> <td><a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FunctionAnalysisLibrary.md">Function Analysis Library</a></td></tr>
133
+ * <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>
134
+ * <tr><td><b>Package</b></td> <td><a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/specialfunction/property/README.md">Special Function Property Lemma Verifiers</a></td></tr>
135
+ * </table>
136
+ *
114
137
* @author Lakshmi Krishnamurthy
115
138
*/
116
139
117
140
public class GammaPolynomialQuotientLemma
118
141
{
119
- private org .drip .function .r1tor1 .MonicPolynomial _monicPolynomialP = null ;
120
- private org .drip .function .r1tor1 .MonicPolynomial _monicPolynomialQ = null ;
142
+ private MonicPolynomial _monicPolynomialP = null ;
143
+ private MonicPolynomial _monicPolynomialQ = null ;
144
+
145
+ /**
146
+ * <i>GammaPolynomialQuotientLemma</i> Constructor
147
+ *
148
+ * @param monicPolynomialP Monic Polynomial "P"
149
+ * @param monicPolynomialQ Monic Polynomial "Q"
150
+ *
151
+ * @throws Exception Thrown if the Inputs are Invalid
152
+ */
153
+
154
+ public GammaPolynomialQuotientLemma (
155
+ final MonicPolynomial monicPolynomialP ,
156
+ final MonicPolynomial monicPolynomialQ )
157
+ throws Exception
158
+ {
159
+ if (null == (_monicPolynomialP = monicPolynomialP ) || null == (_monicPolynomialQ = monicPolynomialQ ))
160
+ {
161
+ throw new Exception ("GammaPolynomialQuotientLemma Constructor => Invalid Inputs" );
162
+ }
163
+ }
121
164
122
165
/**
123
166
* Retrieve the Monic Polynomial "P"
124
167
*
125
168
* @return The Monic Polynomial "P"
126
169
*/
127
170
128
- public org . drip . function . r1tor1 . MonicPolynomial _monicPolynomialP ()
171
+ public MonicPolynomial monicPolynomialP ()
129
172
{
130
173
return _monicPolynomialP ;
131
174
}
@@ -136,7 +179,7 @@ public org.drip.function.r1tor1.MonicPolynomial _monicPolynomialP()
136
179
* @return The Monic Polynomial "Q"
137
180
*/
138
181
139
- public org . drip . function . r1tor1 . MonicPolynomial _monicPolynomialQ ()
182
+ public MonicPolynomial monicPolynomialQ ()
140
183
{
141
184
return _monicPolynomialQ ;
142
185
}
@@ -150,57 +193,38 @@ public org.drip.function.r1tor1.MonicPolynomial _monicPolynomialQ()
150
193
* @return Result of the Equality Lemma Run
151
194
*/
152
195
153
- public org . drip . function . definition . R1PropertyVerification equalityLemma (
196
+ public R1PropertyVerification equalityLemma (
154
197
final int a ,
155
198
final int b )
156
199
{
157
- if (a >= b )
158
- {
200
+ if (a >= b ) {
159
201
return null ;
160
202
}
161
203
162
- org .drip .specialfunction .loggamma .InfiniteSumEstimator logGammaEstimator =
163
- org .drip .specialfunction .loggamma .InfiniteSumEstimator .Weierstrass (1638400 );
204
+ InfiniteSumEstimator logGammaEstimator = InfiniteSumEstimator .Weierstrass (1638400 );
164
205
165
- try
166
- {
206
+ try {
167
207
double lValue = 1. ;
168
208
169
- for (int i = a ; i <= b ; ++i )
170
- {
209
+ for (int i = a ; i <= b ; ++i ) {
171
210
lValue = lValue * _monicPolynomialP .evaluate (i ) / _monicPolynomialQ .evaluate (i );
172
211
}
173
212
174
- double rValue = java .lang .Math .exp (
175
- _monicPolynomialP .logGammaProduct (
176
- a ,
177
- b ,
178
- logGammaEstimator
179
- ) - _monicPolynomialQ .logGammaProduct (
180
- a ,
181
- b ,
182
- logGammaEstimator
183
- )
213
+ double rValue = Math .exp (
214
+ _monicPolynomialP .logGammaProduct (a , b , logGammaEstimator ) -
215
+ _monicPolynomialQ .logGammaProduct (a , b , logGammaEstimator )
184
216
);
185
217
186
- double leftTolerance = java .lang .Math .abs (lValue *
187
- org .drip .function .definition .R1ToR1Property .MISMATCH_TOLERANCE );
218
+ double leftTolerance = Math .abs (lValue * R1ToR1Property .MISMATCH_TOLERANCE );
188
219
189
- double rightTolerance = java .lang .Math .abs (rValue *
190
- org .drip .function .definition .R1ToR1Property .MISMATCH_TOLERANCE );
220
+ double rightTolerance = Math .abs (rValue * R1ToR1Property .MISMATCH_TOLERANCE );
191
221
192
222
double tolerance = leftTolerance < rightTolerance ? leftTolerance : rightTolerance ;
193
- tolerance = tolerance < org . drip . function . definition . R1ToR1Property .MISMATCH_TOLERANCE ?
194
- org . drip . function . definition . R1ToR1Property .MISMATCH_TOLERANCE : tolerance ;
223
+ tolerance = tolerance < R1ToR1Property .MISMATCH_TOLERANCE ?
224
+ R1ToR1Property .MISMATCH_TOLERANCE : tolerance ;
195
225
196
- return new org .drip .function .definition .R1PropertyVerification (
197
- lValue ,
198
- rValue ,
199
- java .lang .Math .abs (lValue - rValue ) < tolerance
200
- );
201
- }
202
- catch (java .lang .Exception e )
203
- {
226
+ return new R1PropertyVerification (lValue , rValue , Math .abs (lValue - rValue ) < tolerance );
227
+ } catch (Exception e ) {
204
228
e .printStackTrace ();
205
229
}
206
230
0 commit comments