HypergeometricEqualityLemma.java

  1. package org.drip.specialfunction.property;

  2. /*
  3.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  4.  */

  5. /*!
  6.  * Copyright (C) 2020 Lakshmi Krishnamurthy
  7.  * Copyright (C) 2019 Lakshmi Krishnamurthy
  8.  *
  9.  *  This file is part of DROP, an open-source library targeting analytics/risk, transaction cost analytics,
  10.  *      asset liability management analytics, capital, exposure, and margin analytics, valuation adjustment
  11.  *      analytics, and portfolio construction analytics within and across fixed income, credit, commodity,
  12.  *      equity, FX, and structured products. It also includes auxiliary libraries for algorithm support,
  13.  *      numerical analysis, numerical optimization, spline builder, model validation, statistical learning,
  14.  *      and computational support.
  15.  *  
  16.  *      https://lakshmidrip.github.io/DROP/
  17.  *  
  18.  *  DROP is composed of three modules:
  19.  *  
  20.  *  - DROP Product Core - https://lakshmidrip.github.io/DROP-Product-Core/
  21.  *  - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
  22.  *  - DROP Computational Core - https://lakshmidrip.github.io/DROP-Computational-Core/
  23.  *
  24.  *  DROP Product Core implements libraries for the following:
  25.  *  - Fixed Income Analytics
  26.  *  - Loan Analytics
  27.  *  - Transaction Cost Analytics
  28.  *
  29.  *  DROP Portfolio Core implements libraries for the following:
  30.  *  - Asset Allocation Analytics
  31.  *  - Asset Liability Management Analytics
  32.  *  - Capital Estimation Analytics
  33.  *  - Exposure Analytics
  34.  *  - Margin Analytics
  35.  *  - XVA Analytics
  36.  *
  37.  *  DROP Computational Core implements libraries for the following:
  38.  *  - Algorithm Support
  39.  *  - Computation Support
  40.  *  - Function Analysis
  41.  *  - Model Validation
  42.  *  - Numerical Analysis
  43.  *  - Numerical Optimizer
  44.  *  - Spline Builder
  45.  *  - Statistical Learning
  46.  *
  47.  *  Documentation for DROP is Spread Over:
  48.  *
  49.  *  - Main                     => https://lakshmidrip.github.io/DROP/
  50.  *  - Wiki                     => https://github.com/lakshmiDRIP/DROP/wiki
  51.  *  - GitHub                   => https://github.com/lakshmiDRIP/DROP
  52.  *  - Repo Layout Taxonomy     => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
  53.  *  - Javadoc                  => https://lakshmidrip.github.io/DROP/Javadoc/index.html
  54.  *  - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
  55.  *  - Release Versions         => https://lakshmidrip.github.io/DROP/version.html
  56.  *  - Community Credits        => https://lakshmidrip.github.io/DROP/credits.html
  57.  *  - Issues Catalog           => https://github.com/lakshmiDRIP/DROP/issues
  58.  *  - JUnit                    => https://lakshmidrip.github.io/DROP/junit/index.html
  59.  *  - Jacoco                   => https://lakshmidrip.github.io/DROP/jacoco/index.html
  60.  *
  61.  *  Licensed under the Apache License, Version 2.0 (the "License");
  62.  *      you may not use this file except in compliance with the License.
  63.  *  
  64.  *  You may obtain a copy of the License at
  65.  *      http://www.apache.org/licenses/LICENSE-2.0
  66.  *  
  67.  *  Unless required by applicable law or agreed to in writing, software
  68.  *      distributed under the License is distributed on an "AS IS" BASIS,
  69.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  70.  *  
  71.  *  See the License for the specific language governing permissions and
  72.  *      limitations under the License.
  73.  */

  74. /**
  75.  * <i>HypergeometricEqualityLemma</i> verifies the Hyper-geometric Equality Lemma Properties. The References
  76.  * are:
  77.  *
  78.  * <br><br>
  79.  *  <ul>
  80.  *      <li>
  81.  *          Gessel, I., and D. Stanton (1982): Strange Evaluations of Hyper-geometric Series <i>SIAM Journal
  82.  *              on Mathematical Analysis</i> <b>13 (2)</b> 295-308
  83.  *      </li>
  84.  *      <li>
  85.  *          Koepf, W (1995): Algorithms for m-fold Hyper-geometric Summation <i>Journal of Symbolic
  86.  *              Computation</i> <b>20 (4)</b> 399-417
  87.  *      </li>
  88.  *      <li>
  89.  *          Lavoie, J. L., F. Grondin, and A. K. Rathie (1996): Generalization of Whipple’s Theorem on the
  90.  *              Sum of a (_2^3)F(a,b;c;z) <i>Journal of Computational and Applied Mathematics</i> <b>72</b>
  91.  *              293-300
  92.  *      </li>
  93.  *      <li>
  94.  *          National Institute of Standards and Technology (2019): Hyper-geometric Function
  95.  *              https://dlmf.nist.gov/15
  96.  *      </li>
  97.  *      <li>
  98.  *          Wikipedia (2019): Hyper-geometric Function https://en.wikipedia.org/wiki/Hypergeometric_function
  99.  *      </li>
  100.  *  </ul>
  101.  *
  102.  *  <br><br>
  103.  *  <ul>
  104.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></li>
  105.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FunctionAnalysisLibrary.md">Function Analysis Library</a></li>
  106.  *      <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>
  107.  *      <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>
  108.  *  </ul>
  109.  *
  110.  * @author Lakshmi Krishnamurthy
  111.  */

  112. public class HypergeometricEqualityLemma
  113. {

  114.     private static final double RecursiveGaussContinedFraction (
  115.         final double a,
  116.         final double b,
  117.         final double c,
  118.         final double z,
  119.         final int termCurrent,
  120.         final int termCount)
  121.     {
  122.         if (termCurrent == termCount)
  123.         {
  124.             return 1.;
  125.         }

  126.         double gaussContinedFraction = 1. + ((b - c - termCurrent - 1.) * (a + termCurrent) /
  127.             ((c + termCurrent + 1.) * (c + termCurrent + 2.))) * z / RecursiveGaussContinedFraction (
  128.                 a,
  129.                 b,
  130.                 c,
  131.                 z,
  132.                 termCurrent + 1,
  133.                 termCount
  134.             );

  135.         return 1. + (a - c - termCurrent) * (b + termCurrent) /
  136.             ((c + termCurrent) * (c + termCurrent + 1)) * z / gaussContinedFraction;
  137.     }

  138.     /**
  139.      * Construct the First-Order Derivative Switch Verifier
  140.      *
  141.      * @param a A
  142.      * @param b B
  143.      *
  144.      * @return The First-Order Derivative Switch Verifier
  145.      */

  146.     public static final org.drip.function.definition.R1ToR1Property FirstOrderDerivativeSwitch (
  147.         final double a,
  148.         final double b)
  149.     {
  150.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  151.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (1000);

  152.         if (null == logBetaEstimator)
  153.         {
  154.             return null;
  155.         }

  156.         try
  157.         {
  158.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator1 =
  159.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  160.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  161.                         a,
  162.                         b,
  163.                         a + 1
  164.                     ),
  165.                     logBetaEstimator,
  166.                     10000
  167.                 );

  168.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator2 =
  169.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  170.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  171.                         b,
  172.                         a,
  173.                         a + 1
  174.                     ),
  175.                     logBetaEstimator,
  176.                     10000
  177.                 );

  178.             return new org.drip.function.definition.R1ToR1Property (
  179.                 org.drip.function.definition.R1ToR1Property.EQ,
  180.                 new org.drip.function.definition.R1ToR1 (null)
  181.                 {
  182.                     @Override public double evaluate (
  183.                         final double z)
  184.                         throws java.lang.Exception
  185.                     {
  186.                         return hypergeometricEstimator1.derivative (
  187.                             z,
  188.                             1
  189.                         );
  190.                     }
  191.                 },
  192.                 new org.drip.function.definition.R1ToR1 (null)
  193.                 {
  194.                     @Override public double evaluate (
  195.                         final double z)
  196.                         throws java.lang.Exception
  197.                     {
  198.                         return hypergeometricEstimator2.derivative (
  199.                             z,
  200.                             1
  201.                         );
  202.                     }
  203.                 },
  204.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  205.             );
  206.         }
  207.         catch (java.lang.Exception e)
  208.         {
  209.             e.printStackTrace();
  210.         }

  211.         return null;
  212.     }

  213.     /**
  214.      * Construct the First-Order Derivative Special Case Verifier
  215.      *
  216.      * @param a A
  217.      * @param b B
  218.      *
  219.      * @return The First-Order Derivative Special Case Verifier
  220.      */

  221.     public static final org.drip.function.definition.R1ToR1Property FirstOrderDerivativeSpecialCase (
  222.         final double a,
  223.         final double b)
  224.     {
  225.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  226.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (1000);

  227.         if (null == logBetaEstimator)
  228.         {
  229.             return null;
  230.         }

  231.         try
  232.         {
  233.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator =
  234.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  235.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  236.                         a,
  237.                         b,
  238.                         a + 1
  239.                     ),
  240.                     logBetaEstimator,
  241.                     10000
  242.                 );

  243.             return new org.drip.function.definition.R1ToR1Property (
  244.                 org.drip.function.definition.R1ToR1Property.EQ,
  245.                 new org.drip.function.definition.R1ToR1 (null)
  246.                 {
  247.                     @Override public double evaluate (
  248.                         final double z)
  249.                         throws java.lang.Exception
  250.                     {
  251.                         return hypergeometricEstimator.derivative (
  252.                             z,
  253.                             1
  254.                         );
  255.                     }
  256.                 },
  257.                 new org.drip.function.definition.R1ToR1 (null)
  258.                 {
  259.                     @Override public double evaluate (
  260.                         final double z)
  261.                         throws java.lang.Exception
  262.                     {
  263.                         return a / z * (
  264.                             java.lang.Math.pow (
  265.                                 1. - z,
  266.                                 -b
  267.                             ) - hypergeometricEstimator.regularHypergeometric (z)
  268.                         );
  269.                     }
  270.                 },
  271.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  272.             );
  273.         }
  274.         catch (java.lang.Exception e)
  275.         {
  276.             e.printStackTrace();
  277.         }

  278.         return null;
  279.     }

  280.     /**
  281.      * Construct the Log (1 + z) Special Case Verifier
  282.      *
  283.      * @return The Log (1 + z) Special Case Verifier
  284.      */

  285.     public static final org.drip.function.definition.R1ToR1Property LogOnePlusZ()
  286.     {
  287.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  288.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (1000);

  289.         if (null == logBetaEstimator)
  290.         {
  291.             return null;
  292.         }

  293.         try
  294.         {
  295.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator =
  296.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  297.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  298.                         1.,
  299.                         1.,
  300.                         2.
  301.                     ),
  302.                     logBetaEstimator,
  303.                     10000
  304.                 );

  305.             return new org.drip.function.definition.R1ToR1Property (
  306.                 org.drip.function.definition.R1ToR1Property.EQ,
  307.                 new org.drip.function.definition.R1ToR1 (null)
  308.                 {
  309.                     @Override public double evaluate (
  310.                         final double z)
  311.                         throws java.lang.Exception
  312.                     {
  313.                         return z * hypergeometricEstimator.evaluate (-z);
  314.                     }
  315.                 },
  316.                 new org.drip.function.definition.R1ToR1 (null)
  317.                 {
  318.                     @Override public double evaluate (
  319.                         final double z)
  320.                         throws java.lang.Exception
  321.                     {
  322.                         return java.lang.Math.log (1. + z);
  323.                     }
  324.                 },
  325.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  326.             );
  327.         }
  328.         catch (java.lang.Exception e)
  329.         {
  330.             e.printStackTrace();
  331.         }

  332.         return null;
  333.     }

  334.     /**
  335.      * Construct the Inverse Power A Special Case Verifier
  336.      *
  337.      * @param a A
  338.      *
  339.      * @return The Inverse Power A Special Case Verifier
  340.      */

  341.     public static final org.drip.function.definition.R1ToR1Property InversePowerA (
  342.         final double a)
  343.     {
  344.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  345.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (1000);

  346.         if (null == logBetaEstimator)
  347.         {
  348.             return null;
  349.         }

  350.         try
  351.         {
  352.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator =
  353.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  354.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  355.                         a,
  356.                         1.,
  357.                         1.
  358.                     ),
  359.                     logBetaEstimator,
  360.                     10000
  361.                 );

  362.             return new org.drip.function.definition.R1ToR1Property (
  363.                 org.drip.function.definition.R1ToR1Property.EQ,
  364.                 new org.drip.function.definition.R1ToR1 (null)
  365.                 {
  366.                     @Override public double evaluate (
  367.                         final double z)
  368.                         throws java.lang.Exception
  369.                     {
  370.                         return hypergeometricEstimator.evaluate (z);
  371.                     }
  372.                 },
  373.                 new org.drip.function.definition.R1ToR1 (null)
  374.                 {
  375.                     @Override public double evaluate (
  376.                         final double z)
  377.                         throws java.lang.Exception
  378.                     {
  379.                         return java.lang.Math.pow (
  380.                             1. - z,
  381.                             -a
  382.                         );
  383.                     }
  384.                 },
  385.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  386.             );
  387.         }
  388.         catch (java.lang.Exception e)
  389.         {
  390.             e.printStackTrace();
  391.         }

  392.         return null;
  393.     }

  394.     /**
  395.      * Construct the Inverse Sine Special Case Verifier
  396.      *
  397.      * @return The Inverse Sine Special Case Verifier
  398.      */

  399.     public static final org.drip.function.definition.R1ToR1Property InverseSine()
  400.     {
  401.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  402.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (1000);

  403.         if (null == logBetaEstimator)
  404.         {
  405.             return null;
  406.         }

  407.         try
  408.         {
  409.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator =
  410.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  411.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  412.                         0.5,
  413.                         0.5,
  414.                         1.5
  415.                     ),
  416.                     logBetaEstimator,
  417.                     10000
  418.                 );

  419.             return new org.drip.function.definition.R1ToR1Property (
  420.                 org.drip.function.definition.R1ToR1Property.EQ,
  421.                 new org.drip.function.definition.R1ToR1 (null)
  422.                 {
  423.                     @Override public double evaluate (
  424.                         final double z)
  425.                         throws java.lang.Exception
  426.                     {
  427.                         return z * hypergeometricEstimator.evaluate (z * z);
  428.                     }
  429.                 },
  430.                 new org.drip.function.definition.R1ToR1 (null)
  431.                 {
  432.                     @Override public double evaluate (
  433.                         final double z)
  434.                         throws java.lang.Exception
  435.                     {
  436.                         return java.lang.Math.asin (z);
  437.                     }
  438.                 },
  439.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  440.             );
  441.         }
  442.         catch (java.lang.Exception e)
  443.         {
  444.             e.printStackTrace();
  445.         }

  446.         return null;
  447.     }

  448.     /**
  449.      * Construct the Goursat Quadratic Transformation Verifier
  450.      *
  451.      * @param a A
  452.      * @param b B
  453.      *
  454.      * @return The Goursat Quadratic Transformation Verifier
  455.      */

  456.     public static final org.drip.function.definition.R1ToR1Property GoursatQuadraticTransformation (
  457.         final double a,
  458.         final double b)
  459.     {
  460.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  461.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  462.         if (null == logBetaEstimator)
  463.         {
  464.             return null;
  465.         }

  466.         try
  467.         {
  468.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator1 =
  469.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  470.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  471.                         a,
  472.                         b,
  473.                         2. * b
  474.                     ),
  475.                     logBetaEstimator,
  476.                     100000
  477.                 );

  478.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator2 =
  479.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  480.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  481.                         0.5 * a,
  482.                         b - 0.5 * a,
  483.                         b + 0.5
  484.                     ),
  485.                     logBetaEstimator,
  486.                     100000
  487.                 );

  488.             return new org.drip.function.definition.R1ToR1Property (
  489.                 org.drip.function.definition.R1ToR1Property.EQ,
  490.                 new org.drip.function.definition.R1ToR1 (null)
  491.                 {
  492.                     @Override public double evaluate (
  493.                         final double z)
  494.                         throws java.lang.Exception
  495.                     {
  496.                         return hypergeometricEstimator1.regularHypergeometric (z);
  497.                     }
  498.                 },
  499.                 new org.drip.function.definition.R1ToR1 (null)
  500.                 {
  501.                     @Override public double evaluate (
  502.                         final double z)
  503.                         throws java.lang.Exception
  504.                     {
  505.                         return java.lang.Math.pow (
  506.                             1. - z,
  507.                             -0.5 * a
  508.                         ) * hypergeometricEstimator2.regularHypergeometric (
  509.                             z * z / (4. * z - 4.)
  510.                         );
  511.                     }
  512.                 },
  513.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  514.             );
  515.         }
  516.         catch (java.lang.Exception e)
  517.         {
  518.             e.printStackTrace();
  519.         }

  520.         return null;
  521.     }

  522.     /**
  523.      * Construct the Goursat Cubic Transformation Verifier
  524.      *
  525.      * @param a A
  526.      *
  527.      * @return The Goursat Cubic Transformation Verifier
  528.      */

  529.     public static final org.drip.function.definition.R1ToR1Property GoursatCubicTransformation (
  530.         final double a)
  531.     {
  532.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  533.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  534.         if (null == logBetaEstimator)
  535.         {
  536.             return null;
  537.         }

  538.         try
  539.         {
  540.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator1 =
  541.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  542.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  543.                         1.5 * a,
  544.                         1.5 * a - 0.5,
  545.                         a + 0.5
  546.                     ),
  547.                     logBetaEstimator,
  548.                     100000
  549.                 );

  550.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator2 =
  551.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  552.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  553.                         a - (1. / 3.),
  554.                         a,
  555.                         2. * a
  556.                     ),
  557.                     logBetaEstimator,
  558.                     100000
  559.                 );

  560.             return new org.drip.function.definition.R1ToR1Property (
  561.                 org.drip.function.definition.R1ToR1Property.EQ,
  562.                 new org.drip.function.definition.R1ToR1 (null)
  563.                 {
  564.                     @Override public double evaluate (
  565.                         final double z)
  566.                         throws java.lang.Exception
  567.                     {
  568.                         return hypergeometricEstimator1.regularHypergeometric (-1. * z * z / 3.);
  569.                     }
  570.                 },
  571.                 new org.drip.function.definition.R1ToR1 (null)
  572.                 {
  573.                     @Override public double evaluate (
  574.                         final double z)
  575.                         throws java.lang.Exception
  576.                     {
  577.                         double onePlusZ = 1. + z;

  578.                         return java.lang.Math.pow (
  579.                             onePlusZ,
  580.                             1. - 3. * a
  581.                         ) * hypergeometricEstimator2.regularHypergeometric (
  582.                             2. * z * (3. + z * z) / (onePlusZ * onePlusZ * onePlusZ)
  583.                         );
  584.                     }
  585.                 },
  586.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  587.             );
  588.         }
  589.         catch (java.lang.Exception e)
  590.         {
  591.             e.printStackTrace();
  592.         }

  593.         return null;
  594.     }

  595.     /**
  596.      * Construct the Vidunas Higher Order Transformation Verifier
  597.      *
  598.      * @return The Vidunas Higher Order Transformation Verifier
  599.      */

  600.     public static final org.drip.function.definition.R1ToR1Property VidunasHigherOrderTransformation()
  601.     {
  602.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  603.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  604.         if (null == logBetaEstimator)
  605.         {
  606.             return null;
  607.         }

  608.         try
  609.         {
  610.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator1 =
  611.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  612.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  613.                         0.25,
  614.                         0.375,
  615.                         0.875
  616.                     ),
  617.                     logBetaEstimator,
  618.                     100000
  619.                 );

  620.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator2 =
  621.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  622.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  623.                         1./ 48.,
  624.                         17. / 48.,
  625.                         0.875
  626.                     ),
  627.                     logBetaEstimator,
  628.                     100000
  629.                 );

  630.             return new org.drip.function.definition.R1ToR1Property (
  631.                 org.drip.function.definition.R1ToR1Property.EQ,
  632.                 new org.drip.function.definition.R1ToR1 (null)
  633.                 {
  634.                     @Override public double evaluate (
  635.                         final double z)
  636.                         throws java.lang.Exception
  637.                     {
  638.                         return java.lang.Math.pow (
  639.                             z * z * z * z - 60. * z * z * z + 134. * z * z - 60. * z + 1.,
  640.                             1. / 16.
  641.                         ) * hypergeometricEstimator1.regularHypergeometric (z);
  642.                     }
  643.                 },
  644.                 new org.drip.function.definition.R1ToR1 (null)
  645.                 {
  646.                     @Override public double evaluate (
  647.                         final double z)
  648.                         throws java.lang.Exception
  649.                     {
  650.                         return hypergeometricEstimator2.regularHypergeometric (
  651.                             -432. * z * (z - 1.) * (z - 1.) * java.lang.Math.pow (
  652.                                 z + 1.,
  653.                                 8.
  654.                             ) * java.lang.Math.pow (
  655.                                 z * z * z * z - 60. * z * z * z + 134. * z * z - 60. * z + 1.,
  656.                                 -3.
  657.                             )
  658.                         );
  659.                     }
  660.                 },
  661.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  662.             );
  663.         }
  664.         catch (java.lang.Exception e)
  665.         {
  666.             e.printStackTrace();
  667.         }

  668.         return null;
  669.     }

  670.     /**
  671.      * Construct the Gauss Van der Monde z = +1 Verifier
  672.      *
  673.      * @return The Gauss Van der Monde z = +1 Verifier
  674.      */

  675.     public static final org.drip.function.definition.R3ToR1Property GaussVanderMondeZPlusOne()
  676.     {
  677.         final org.drip.function.definition.R2ToR1 logBetaEstimator =
  678.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  679.         if (null == logBetaEstimator)
  680.         {
  681.             return null;
  682.         }

  683.         final org.drip.specialfunction.gamma.WindschitlTothAnalytic gammaEstimator =
  684.             new org.drip.specialfunction.gamma.WindschitlTothAnalytic (null);

  685.         try
  686.         {
  687.             return new org.drip.function.definition.R3ToR1Property (
  688.                 org.drip.function.definition.R1ToR1Property.EQ,
  689.                 new org.drip.function.definition.R3ToR1()
  690.                 {
  691.                     @Override public double evaluate (
  692.                         final double a,
  693.                         final double b,
  694.                         final double c)
  695.                         throws java.lang.Exception
  696.                     {
  697.                         return new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  698.                             new org.drip.specialfunction.definition.HypergeometricParameters (
  699.                                 a,
  700.                                 b,
  701.                                 c
  702.                             ),
  703.                             logBetaEstimator,
  704.                             100000
  705.                         ).regularHypergeometric (1.);
  706.                     }
  707.                 },
  708.                 new org.drip.function.definition.R3ToR1()
  709.                 {
  710.                     @Override public double evaluate (
  711.                         final double a,
  712.                         final double b,
  713.                         final double c)
  714.                         throws java.lang.Exception
  715.                     {
  716.                         return gammaEstimator.evaluate (c) * gammaEstimator.evaluate (c - a - b) / (
  717.                             gammaEstimator.evaluate (c - a) * gammaEstimator.evaluate (c - b)
  718.                         );
  719.                     }
  720.                 },
  721.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  722.             );
  723.         }
  724.         catch (java.lang.Exception e)
  725.         {
  726.             e.printStackTrace();
  727.         }

  728.         return null;
  729.     }

  730.     /**
  731.      * Construct the Gauss-Dougall z = +1 Verifier
  732.      *
  733.      * @return The Gauss-Dougall z = +1 Verifier
  734.      */

  735.     public static final org.drip.function.definition.R3ToR1Property GaussDougallZPlusOne()
  736.     {
  737.         final org.drip.function.definition.R2ToR1 logBetaEstimator =
  738.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  739.         if (null == logBetaEstimator)
  740.         {
  741.             return null;
  742.         }

  743.         try
  744.         {
  745.             return new org.drip.function.definition.R3ToR1Property (
  746.                 org.drip.function.definition.R1ToR1Property.EQ,
  747.                 new org.drip.function.definition.R3ToR1()
  748.                 {
  749.                     @Override public double evaluate (
  750.                         final double m,
  751.                         final double b,
  752.                         final double c)
  753.                         throws java.lang.Exception
  754.                     {
  755.                         return new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  756.                             new org.drip.specialfunction.definition.HypergeometricParameters (
  757.                                 -m,
  758.                                 b,
  759.                                 c
  760.                             ),
  761.                             logBetaEstimator,
  762.                             100000
  763.                         ).regularHypergeometric (1.);
  764.                     }
  765.                 },
  766.                 new org.drip.function.definition.R3ToR1()
  767.                 {
  768.                     @Override public double evaluate (
  769.                         final double m,
  770.                         final double b,
  771.                         final double c)
  772.                         throws java.lang.Exception
  773.                     {
  774.                         return org.drip.numerical.common.NumberUtil.PochhammerSymbol (
  775.                             c - b,
  776.                             (int) m
  777.                         ) / org.drip.numerical.common.NumberUtil.PochhammerSymbol (
  778.                             c,
  779.                             (int) m
  780.                         );
  781.                     }
  782.                 },
  783.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  784.             );
  785.         }
  786.         catch (java.lang.Exception e)
  787.         {
  788.             e.printStackTrace();
  789.         }

  790.         return null;
  791.     }

  792.     /**
  793.      * Construct the Gauss Kummer z = -1 Verifier
  794.      *
  795.      * @return The Gauss Kummer z = -1 Verifier
  796.      */

  797.     public static final org.drip.function.definition.R2ToR1Property GaussKummerZMinusOne()
  798.     {
  799.         final org.drip.function.definition.R2ToR1 logBetaEstimator =
  800.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  801.         if (null == logBetaEstimator)
  802.         {
  803.             return null;
  804.         }

  805.         final org.drip.specialfunction.gamma.WindschitlTothAnalytic gammaEstimator =
  806.             new org.drip.specialfunction.gamma.WindschitlTothAnalytic (null);

  807.         try
  808.         {
  809.             return new org.drip.function.definition.R2ToR1Property (
  810.                 org.drip.function.definition.R1ToR1Property.EQ,
  811.                 new org.drip.function.definition.R2ToR1()
  812.                 {
  813.                     @Override public double evaluate (
  814.                         final double a,
  815.                         final double b)
  816.                         throws java.lang.Exception
  817.                     {
  818.                         return new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  819.                             new org.drip.specialfunction.definition.HypergeometricParameters (
  820.                                 a,
  821.                                 b,
  822.                                 1. + a - b
  823.                             ),
  824.                             logBetaEstimator,
  825.                             100000
  826.                         ).regularHypergeometric (-1.);
  827.                     }
  828.                 },
  829.                 new org.drip.function.definition.R2ToR1()
  830.                 {
  831.                     @Override public double evaluate (
  832.                         final double a,
  833.                         final double b)
  834.                         throws java.lang.Exception
  835.                     {
  836.                         return gammaEstimator.evaluate (1. + a - b) * gammaEstimator.evaluate (1. + 0.5 * a)
  837.                         / (
  838.                             gammaEstimator.evaluate (1. + a) * gammaEstimator.evaluate (1. + 0.5 * a - b)
  839.                         );
  840.                     }
  841.                 },
  842.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  843.             );
  844.         }
  845.         catch (java.lang.Exception e)
  846.         {
  847.             e.printStackTrace();
  848.         }

  849.         return null;
  850.     }

  851.     /**
  852.      * Construct the Gauss Second Summation z = 0.5 Verifier
  853.      *
  854.      * @return The Gauss Second Summation z = 0.5 Verifier
  855.      */

  856.     public static final org.drip.function.definition.R2ToR1Property GaussSecondSummationZPlusHalf()
  857.     {
  858.         final org.drip.function.definition.R2ToR1 logBetaEstimator =
  859.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  860.         if (null == logBetaEstimator)
  861.         {
  862.             return null;
  863.         }

  864.         final org.drip.specialfunction.gamma.WindschitlTothAnalytic gammaEstimator =
  865.             new org.drip.specialfunction.gamma.WindschitlTothAnalytic (null);

  866.         try
  867.         {
  868.             return new org.drip.function.definition.R2ToR1Property (
  869.                 org.drip.function.definition.R1ToR1Property.EQ,
  870.                 new org.drip.function.definition.R2ToR1()
  871.                 {
  872.                     @Override public double evaluate (
  873.                         final double a,
  874.                         final double b)
  875.                         throws java.lang.Exception
  876.                     {
  877.                         return new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  878.                             new org.drip.specialfunction.definition.HypergeometricParameters (
  879.                                 a,
  880.                                 b,
  881.                                 0.5 * (1. + a + b)
  882.                             ),
  883.                             logBetaEstimator,
  884.                             100000
  885.                         ).regularHypergeometric (0.5);
  886.                     }
  887.                 },
  888.                 new org.drip.function.definition.R2ToR1()
  889.                 {
  890.                     @Override public double evaluate (
  891.                         final double a,
  892.                         final double b)
  893.                         throws java.lang.Exception
  894.                     {
  895.                         return gammaEstimator.evaluate (0.5) * gammaEstimator.evaluate (0.5 * (1. + a + b)) /
  896.                         (
  897.                             gammaEstimator.evaluate (0.5 * (1. + a)) *
  898.                             gammaEstimator.evaluate (0.5 * (1. + b))
  899.                         );
  900.                     }
  901.                 },
  902.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  903.             );
  904.         }
  905.         catch (java.lang.Exception e)
  906.         {
  907.             e.printStackTrace();
  908.         }

  909.         return null;
  910.     }

  911.     /**
  912.      * Construct the Gauss Bailey z = +0.5 Verifier
  913.      *
  914.      * @return The Gauss Bailey z = +0.5 Verifier
  915.      */

  916.     public static final org.drip.function.definition.R2ToR1Property GaussBaileyZPlusHalf()
  917.     {
  918.         final org.drip.function.definition.R2ToR1 logBetaEstimator =
  919.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  920.         if (null == logBetaEstimator)
  921.         {
  922.             return null;
  923.         }

  924.         final org.drip.specialfunction.gamma.WindschitlTothAnalytic gammaEstimator =
  925.             new org.drip.specialfunction.gamma.WindschitlTothAnalytic (null);

  926.         try
  927.         {
  928.             return new org.drip.function.definition.R2ToR1Property (
  929.                 org.drip.function.definition.R1ToR1Property.EQ,
  930.                 new org.drip.function.definition.R2ToR1()
  931.                 {
  932.                     @Override public double evaluate (
  933.                         final double a,
  934.                         final double c)
  935.                         throws java.lang.Exception
  936.                     {
  937.                         return new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  938.                             new org.drip.specialfunction.definition.HypergeometricParameters (
  939.                                 a,
  940.                                 1. - a,
  941.                                 c
  942.                             ),
  943.                             logBetaEstimator,
  944.                             100000
  945.                         ).regularHypergeometric (0.5);
  946.                     }
  947.                 },
  948.                 new org.drip.function.definition.R2ToR1()
  949.                 {
  950.                     @Override public double evaluate (
  951.                         final double a,
  952.                         final double c)
  953.                         throws java.lang.Exception
  954.                     {
  955.                         return gammaEstimator.evaluate (0.5 * c) * gammaEstimator.evaluate (0.5 * (1. + c)) /
  956.                         (
  957.                             gammaEstimator.evaluate (0.5 * (c + a)) *
  958.                             gammaEstimator.evaluate (0.5 * (1. + c - a))
  959.                         );
  960.                     }
  961.                 },
  962.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  963.             );
  964.         }
  965.         catch (java.lang.Exception e)
  966.         {
  967.             e.printStackTrace();
  968.         }

  969.         return null;
  970.     }

  971.     /**
  972.      * Construct the First Gessel Stanton Koepf Rational Z Verifier
  973.      *
  974.      * @return The First Gessel Stanton Koepf Rational Z Verifier
  975.      */

  976.     public static final org.drip.function.definition.R2ToR1Property FirstGesselStantonKoepf()
  977.     {
  978.         final org.drip.function.definition.R2ToR1 logBetaEstimator =
  979.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (100000);

  980.         if (null == logBetaEstimator)
  981.         {
  982.             return null;
  983.         }

  984.         try
  985.         {
  986.             return new org.drip.function.definition.R2ToR1Property (
  987.                 org.drip.function.definition.R1ToR1Property.EQ,
  988.                 new org.drip.function.definition.R2ToR1()
  989.                 {
  990.                     @Override public double evaluate (
  991.                         final double a,
  992.                         final double z)
  993.                         throws java.lang.Exception
  994.                     {
  995.                         return new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  996.                             new org.drip.specialfunction.definition.HypergeometricParameters (
  997.                                 a,
  998.                                 -1. * a,
  999.                                 0.5
  1000.                             ),
  1001.                             logBetaEstimator,
  1002.                             1000000
  1003.                         ).regularHypergeometric (0.25 * z * z / (z - 1.));
  1004.                     }
  1005.                 },
  1006.                 new org.drip.function.definition.R2ToR1()
  1007.                 {
  1008.                     @Override public double evaluate (
  1009.                         final double a,
  1010.                         final double z)
  1011.                         throws java.lang.Exception
  1012.                     {
  1013.                         return 0.5 * (
  1014.                             java.lang.Math.pow (
  1015.                                 1. - z,
  1016.                                 a
  1017.                             ) + java.lang.Math.pow (
  1018.                                 1. - z,
  1019.                                 -a
  1020.                             )
  1021.                         );
  1022.                     }
  1023.                 },
  1024.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  1025.             );
  1026.         }
  1027.         catch (java.lang.Exception e)
  1028.         {
  1029.             e.printStackTrace();
  1030.         }

  1031.         return null;
  1032.     }

  1033.     /**
  1034.      * Construct the Second Gessel Stanton Koepf Rational Z Verifier
  1035.      *
  1036.      * @return The Second Gessel Stanton Koepf Rational Z Verifier
  1037.      */

  1038.     public static final org.drip.function.definition.R2ToR1Property SecondGesselStantonKoepf()
  1039.     {
  1040.         final org.drip.function.definition.R2ToR1 logBetaEstimator =
  1041.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (100000);

  1042.         if (null == logBetaEstimator)
  1043.         {
  1044.             return null;
  1045.         }

  1046.         try
  1047.         {
  1048.             return new org.drip.function.definition.R2ToR1Property (
  1049.                 org.drip.function.definition.R1ToR1Property.EQ,
  1050.                 new org.drip.function.definition.R2ToR1()
  1051.                 {
  1052.                     @Override public double evaluate (
  1053.                         final double a,
  1054.                         final double z)
  1055.                         throws java.lang.Exception
  1056.                     {
  1057.                         return new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  1058.                             new org.drip.specialfunction.definition.HypergeometricParameters (
  1059.                                 a,
  1060.                                 -1. * a,
  1061.                                 0.5
  1062.                             ),
  1063.                             logBetaEstimator,
  1064.                             1000000
  1065.                         ).regularHypergeometric (0.5 * (1. - java.lang.Math.cos (z)));
  1066.                     }
  1067.                 },
  1068.                 new org.drip.function.definition.R2ToR1()
  1069.                 {
  1070.                     @Override public double evaluate (
  1071.                         final double a,
  1072.                         final double z)
  1073.                         throws java.lang.Exception
  1074.                     {
  1075.                         return java.lang.Math.cos (a * z);
  1076.                     }
  1077.                 },
  1078.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  1079.             );
  1080.         }
  1081.         catch (java.lang.Exception e)
  1082.         {
  1083.             e.printStackTrace();
  1084.         }

  1085.         return null;
  1086.     }

  1087.     /**
  1088.      * Construct the Gauss Continued Fraction Recursive Verifier
  1089.      *
  1090.      * @param a A
  1091.      * @param b B
  1092.      * @param c C
  1093.      *
  1094.      * @return The Gauss Continued Fraction Recursive Verifier
  1095.      */

  1096.     public static final org.drip.function.definition.R1ToR1Property GaussContinuedFractionRecursive (
  1097.         final double a,
  1098.         final double b,
  1099.         final double c)
  1100.     {
  1101.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  1102.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (1000);

  1103.         if (null == logBetaEstimator)
  1104.         {
  1105.             return null;
  1106.         }

  1107.         try
  1108.         {
  1109.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator1 =
  1110.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  1111.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  1112.                         a,
  1113.                         b,
  1114.                         c
  1115.                     ),
  1116.                     logBetaEstimator,
  1117.                     10000
  1118.                 );

  1119.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator2 =
  1120.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  1121.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  1122.                         a + 1,
  1123.                         b,
  1124.                         c + 1
  1125.                     ),
  1126.                     logBetaEstimator,
  1127.                     10000
  1128.                 );

  1129.             return new org.drip.function.definition.R1ToR1Property (
  1130.                 org.drip.function.definition.R1ToR1Property.EQ,
  1131.                 new org.drip.function.definition.R1ToR1 (null)
  1132.                 {
  1133.                     @Override public double evaluate (
  1134.                         final double z)
  1135.                         throws java.lang.Exception
  1136.                     {
  1137.                         return hypergeometricEstimator2.evaluate (z) / hypergeometricEstimator1.evaluate (z);
  1138.                     }
  1139.                 },
  1140.                 new org.drip.function.definition.R1ToR1 (null)
  1141.                 {
  1142.                     @Override public double evaluate (
  1143.                         final double z)
  1144.                         throws java.lang.Exception
  1145.                     {
  1146.                         return 1. / RecursiveGaussContinedFraction (
  1147.                             a,
  1148.                             b,
  1149.                             c,
  1150.                             z,
  1151.                             0,
  1152.                             10
  1153.                         );
  1154.                     }
  1155.                 },
  1156.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  1157.             );
  1158.         }
  1159.         catch (java.lang.Exception e)
  1160.         {
  1161.             e.printStackTrace();
  1162.         }

  1163.         return null;
  1164.     }

  1165.     /**
  1166.      * Construct the Incomplete Beta Verifier
  1167.      *
  1168.      * @param p P
  1169.      * @param q Q
  1170.      *
  1171.      * @return The Incomplete Beta Verifier
  1172.      */

  1173.     public static final org.drip.function.definition.R1ToR1Property IncompleteBeta (
  1174.         final double p,
  1175.         final double q)
  1176.     {
  1177.         org.drip.function.definition.R2ToR1 logBetaEstimator =
  1178.             org.drip.specialfunction.beta.LogGammaEstimator.Weierstrass (10000);

  1179.         if (null == logBetaEstimator)
  1180.         {
  1181.             return null;
  1182.         }

  1183.         final org.drip.specialfunction.beta.IncompleteIntegrandEstimator incompleteBetaEstimator =
  1184.             org.drip.specialfunction.beta.IncompleteIntegrandEstimator.EulerFirst (10000);

  1185.         try
  1186.         {
  1187.             final org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator hypergeometricEstimator =
  1188.                 new org.drip.specialfunction.hypergeometric.EulerQuadratureEstimator (
  1189.                     new org.drip.specialfunction.definition.HypergeometricParameters (
  1190.                         p,
  1191.                         1. - q,
  1192.                         p + 1.
  1193.                     ),
  1194.                     logBetaEstimator,
  1195.                     10000
  1196.                 );

  1197.             return new org.drip.function.definition.R1ToR1Property (
  1198.                 org.drip.function.definition.R1ToR1Property.EQ,
  1199.                 new org.drip.function.definition.R1ToR1 (null)
  1200.                 {
  1201.                     @Override public double evaluate (
  1202.                         final double z)
  1203.                         throws java.lang.Exception
  1204.                     {
  1205.                         return java.lang.Math.pow (
  1206.                             z,
  1207.                             p
  1208.                         ) * hypergeometricEstimator.evaluate (z) / p;
  1209.                     }
  1210.                 },
  1211.                 new org.drip.function.definition.R1ToR1 (null)
  1212.                 {
  1213.                     @Override public double evaluate (
  1214.                         final double z)
  1215.                         throws java.lang.Exception
  1216.                     {
  1217.                         return incompleteBetaEstimator.evaluate (
  1218.                             z,
  1219.                             p,
  1220.                             q
  1221.                         );
  1222.                     }
  1223.                 },
  1224.                 org.drip.function.definition.R1ToR1Property.MISMATCH_TOLERANCE
  1225.             );
  1226.         }
  1227.         catch (java.lang.Exception e)
  1228.         {
  1229.             e.printStackTrace();
  1230.         }

  1231.         return null;
  1232.     }
  1233. }