alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (PegasusSolver.java)

This example Java source code file (PegasusSolver.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

basesecantsolver, pegasussolver

The PegasusSolver.java Java example source code

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.math3.analysis.solvers;

/**
 * Implements the <em>Pegasus method for root-finding (approximating
 * a zero of a univariate real function). It is a modified
 * {@link RegulaFalsiSolver <em>Regula Falsi} method.
 *
 * <p>Like the Regula Falsi method, convergence is guaranteed by
 * maintaining a bracketed solution. The <em>Pegasus method however,
 * should converge much faster than the original <em>Regula Falsi
 * method. Furthermore, this implementation of the <em>Pegasus method
 * should not suffer from the same implementation issues as the <em>Regula
 * Falsi</em> method, which may fail to convergence in certain cases. Also,
 * the <em>Pegasus method should converge faster than the
 * {@link IllinoisSolver <em>Illinois} method, another Regula
 * Falsi</em>-based method.

* * <p>The Pegasus method assumes that the function is continuous, * but not necessarily smooth.</p> * * <p>Implementation based on the following article: M. Dowell and P. Jarratt, * <em>The "Pegasus" method for computing the root of an equation
, * BIT Numerical Mathematics, volume 12, number 4, pages 503-508, Springer, * 1972.</p> * * @since 3.0 */ public class PegasusSolver extends BaseSecantSolver { /** Construct a solver with default accuracy (1e-6). */ public PegasusSolver() { super(DEFAULT_ABSOLUTE_ACCURACY, Method.PEGASUS); } /** * Construct a solver. * * @param absoluteAccuracy Absolute accuracy. */ public PegasusSolver(final double absoluteAccuracy) { super(absoluteAccuracy, Method.PEGASUS); } /** * Construct a solver. * * @param relativeAccuracy Relative accuracy. * @param absoluteAccuracy Absolute accuracy. */ public PegasusSolver(final double relativeAccuracy, final double absoluteAccuracy) { super(relativeAccuracy, absoluteAccuracy, Method.PEGASUS); } /** * Construct a solver. * * @param relativeAccuracy Relative accuracy. * @param absoluteAccuracy Absolute accuracy. * @param functionValueAccuracy Maximum function value error. */ public PegasusSolver(final double relativeAccuracy, final double absoluteAccuracy, final double functionValueAccuracy) { super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, Method.PEGASUS); } }

Other Java examples (source code examples)

Here is a short list of links related to this Java PegasusSolver.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.