Package org.apache.commons.math

Examples of org.apache.commons.math.ConvergenceException


                } else if (b != 0) {
                    p2 = (a / b * p1) + p0;
                    q2 = (a / b * q1) + q0;
                } else {
                    // can not scale an convergent is unbounded.
                    throw new ConvergenceException(
                        "Continued fraction convergents diverged to +/- " +
                        "infinity.");
                }
            }
            double r = p2 / q2;
            relativeError = Math.abs(r / c - 1.0);
               
            // prepare for next iteration
            c = p2 / q2;
            p0 = p1;
            p1 = p2;
            q0 = q1;
            q1 = q2;
        }

        if (n >= maxIterations) {
            throw new ConvergenceException(
                "Continued fraction convergents failed to converge.");
        }

        return c;
    }
View Full Code Here


                stop = true;
            }
        } while (!stop);

        if (n >= maxIterations) {
            throw new ConvergenceException(
                    "Unable to convert double to fraction");
        }
       
        this.numerator = p2;
        this.denominator = q2;
View Full Code Here

                y2 = y0;
            }
            oldDelta = x2 - x1;
            i++;
        }
        throw new ConvergenceException("Maximal iteration number exceeded" + i);
    }
View Full Code Here

                return m;
            }
            ++i;
        }
       
        throw new ConvergenceException
            ("Maximum number of iterations exceeded: "  + maximalIterationCount);
    }
View Full Code Here

                // update partial sum
                sum = sum + an;
            }
            if (n >= maxIterations) {
                throw new ConvergenceException(
                    "maximum number of iterations reached");
            } else {
                ret = Math.exp(-x + (a * Math.log(x)) - logGamma(a)) * sum;
            }
        }
View Full Code Here

                } else if (b != 0) {
                    p2 = (a / b * p1) + p0;
                    q2 = (a / b * q1) + q0;
                } else {
                    // can not scale an convergent is unbounded.
                    throw new ConvergenceException(
                        "Continued fraction convergents diverged to +/- infinity for value {0}",
                        x);
                }
            }
            double r = p2 / q2;
View Full Code Here

                return result;
            }
        }

        // should never happen
        throw new ConvergenceException();
    }
View Full Code Here

            numIterations++ ;
        } while ((fa * fb > 0.0) && (numIterations < maximumIterations) &&
                ((a > lowerBound) || (b < upperBound)));
  
        if (fa * fb > 0.0 ) {
            throw new ConvergenceException(
                      "number of iterations={0}, maximum iterations={1}, " +
                      "initial={2}, lower bound={3}, upper bound={4}, final a value={5}, " +
                      "final b value={6}, f(a)={7}, f(b)={8}",
                      numIterations, maximumIterations, initial,
                      lowerBound, upperBound, a, b, fa, fb);
View Full Code Here

                // update partial sum
                sum = sum + an;
            }
            if (n >= maxIterations) {
                throw new ConvergenceException(
                    "maximum number of iterations reached");
            } else {
                ret = Math.exp(-x + (a * Math.log(x)) - logGamma(a)) * sum;
            }
        }
View Full Code Here

            Math.abs(epsilon * f[1][0] * f[1][1]))
        {
            ret = f[0][0] / f[1][0];
        } else {
            if (n >= maxIterations) {
                throw new ConvergenceException(
                    "Continued fraction convergents failed to converge.");
            }
            // compute next
            ret = evaluate(n + 1, x, f /* new a */
            , an /* reuse an */
 
View Full Code Here

TOP

Related Classes of org.apache.commons.math.ConvergenceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.