001    /*
002     * $Id: RealRoots.java 3579 2011-03-26 10:32:37Z kredel $
003     */
004    
005    package edu.jas.root;
006    
007    
008    import java.util.List;
009    
010    import edu.jas.arith.Rational;
011    import edu.jas.arith.BigRational;
012    import edu.jas.poly.GenPolynomial;
013    import edu.jas.structure.RingElem;
014    
015    
016    /**
017     * Real roots interface.
018     * @param <C> coefficient type.
019     * @author Heinz Kredel
020     */
021    public interface RealRoots<C extends RingElem<C> & Rational> {
022    
023    
024        /**
025         * Real root bound. With f(M) * f(-M) != 0.
026         * @param f univariate polynomial.
027         * @return M such that -M &lt; root(f) &gt; M.
028         */
029        public C realRootBound(GenPolynomial<C> f);
030    
031    
032        /**
033         * Isolating intervals for the real roots.
034         * @param f univariate polynomial.
035         * @return a list of isolating intervalls for the real roots of f.
036         */
037        public List<Interval<C>> realRoots(GenPolynomial<C> f);
038    
039    
040        /**
041         * Isolating intervals for the real roots.
042         * @param f univariate polynomial.
043         * @param eps requested intervals length.
044         * @return a list of isolating intervals v such that |v| &lt; eps.
045         */
046        public List<Interval<C>> realRoots(GenPolynomial<C> f, C eps);
047    
048    
049        /**
050         * Isolating intervals for the real roots.
051         * @param f univariate polynomial.
052         * @param eps requested intervals length.
053         * @return a list of isolating intervals v such that |v| &lt; eps.
054         */
055        public List<Interval<C>> realRoots(GenPolynomial<C> f, BigRational eps);
056    
057    
058        /**
059         * Sign changes on interval bounds.
060         * @param iv root isolating interval with f(left) * f(right) != 0.
061         * @param f univariate polynomial.
062         * @return true if f(left) * f(right) &lt; 0, else false
063         */
064        public boolean signChange(Interval<C> iv, GenPolynomial<C> f);
065    
066    
067        /**
068         * Number of real roots in interval.
069         * @param iv interval with f(left) * f(right) != 0.
070         * @param f univariate polynomial.
071         * @return number of real roots of f in I.
072         */
073        public long realRootCount(Interval<C> iv, GenPolynomial<C> f);
074    
075    
076        /**
077         * Refine interval.
078         * @param iv root isolating interval with f(left) * f(right) &lt; 0.
079         * @param f univariate polynomial, non-zero.
080         * @param eps requested interval length.
081         * @return a new interval v such that |v| &lt; eps.
082         */
083        public Interval<C> refineInterval(Interval<C> iv, GenPolynomial<C> f, C eps);
084    
085    
086        /**
087         * Refine intervals.
088         * @param V list of isolating intervals with f(left) * f(right) &lt; 0.
089         * @param f univariate polynomial, non-zero.
090         * @param eps requested intervals length.
091         * @return a list of new intervals v such that |v| &lt; eps.
092         */
093        public List<Interval<C>> refineIntervals(List<Interval<C>> V, GenPolynomial<C> f, C eps);
094    
095    
096        /**
097         * Real algebraic number sign.
098         * @param iv root isolating interval for f, with f(left) * f(right) &lt; 0.
099         * @param f univariate polynomial, non-zero.
100         * @param g univariate polynomial, gcd(f,g) == 1.
101         * @return sign(g(v)), with v a new interval contained in iv such that g(v) !=
102         *         0.
103         */
104        public int realSign(Interval<C> iv, GenPolynomial<C> f, GenPolynomial<C> g);
105    
106    
107        /**
108         * Real algebraic number magnitude.
109         * @param iv root isolating interval for f, with f(left) * f(right) &lt; 0.
110         * @param f univariate polynomial, non-zero.
111         * @param g univariate polynomial, gcd(f,g) == 1.
112         * @param eps length limit for interval length.
113         * @return g(iv).
114         */
115        public C realMagnitude(Interval<C> iv, GenPolynomial<C> f, GenPolynomial<C> g, C eps);
116    
117    }