4 Replies - 10492 Views - Last Post: 27 May 2011 - 05:27 PM Rate Topic: -----

#1 Radx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-May 11

Divide Polynomials Java - [Homework] Code inside

Posted 27 May 2011 - 10:43 AM

Hello everyone.
I am currently doing assignment for uni, we need to make a program that can solve polynomials and I am currently stuck on divide.

I think I almost have it - because most of my answres are right, and some are the wrong way around.

We need to use the code supplied to us and suggestions would be great.

my code - look under the 'final public Polynomial[] dividedBy(Polynomial that)' method
http://pastebin.com/mNK6UNKJ

the tester class
http://pastebin.com/z4UAiaw9

and the expected outcome of the tester class
http://pastebin.com/PspHABtw

if you want me to put code in the [code] tags I will be happy to, just didn't want to take up much room on the page just ask and I will.

thanks
Radx

Is This A Good Question/Topic? 0
  • +

Replies To: Divide Polynomials Java - [Homework] Code inside

#2 x68zeppelin80x  Icon User is offline

  • D.I.C Addict

Reputation: 130
  • View blog
  • Posts: 576
  • Joined: 07-March 09

Re: Divide Polynomials Java - [Homework] Code inside

Posted 27 May 2011 - 11:14 AM

I would create 3 arrays

int[] numer = new int[highest_degree_n]
int[] denom = new int[highest_degree_d]
int[] quotient = new int[highest_degree_n - highest_degree_d]


.........qoutient
denom )numer

compare the denom to the first part of the numerator
for (int i = 0; i < denom.lenght; i++) {
   qoutient[i] = numer[i] - denom[i]
}


This may not be what you are looking for, and if not, just ignore it.


I think you can understand this.

This post has been edited by x68zeppelin80x: 27 May 2011 - 11:15 AM

Was This Post Helpful? -1
  • +
  • -

#3 Radx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-May 11

Re: Divide Polynomials Java - [Homework] Code inside

Posted 27 May 2011 - 11:19 AM

I probably should of mention it supposed to be in a singly linked list, I dont think we are suppose to use arrays. thanks for taking the time to look at it, if all else fails I will try it.
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12174
  • View blog
  • Posts: 45,241
  • Joined: 27-December 08

Re: Divide Polynomials Java - [Homework] Code inside

Posted 27 May 2011 - 02:29 PM

@x68zeppelin80x: Don't use parallel arrays. Java is an OO language, so use a Fraction class instead (which it looks like the OP already has one). My tutorial Moving Away From Parallel Arrays goes into more detail on this.

@Radx: Please post your code using code tags. It add to the pedagogic value of the thread. Also, can you describe what is/isn't working more specifically. Telling us that it doesn't work doesn't help us much. :)
Was This Post Helpful? 0
  • +
  • -

#5 Radx  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-May 11

Re: Divide Polynomials Java - [Homework] Code inside

Posted 27 May 2011 - 05:27 PM

my code
 
/*
 * Data Structures - Assignment 2
 * Polynomials
 */
package datastructuresassignment2;

/**
 *
 * @author Randal Adamson 10191613 and Luke Spartalis 10194177
 */
public class Polynomial {

    final static private int mantissa = 52;
    final static private double epsilon = Math.pow(2.0, -mantissa);
    private double coefficient = 0.0;
    private int power = 0;
    private Polynomial successor = null;

    public Polynomial(double coefficient, int power) {
        if (Double.isNaN(coefficient)) {
            return;
        }
        if (Math.abs(coefficient) < epsilon) {
            return;
        }
        if (power < 0) {
            return;
        }
        this.coefficient = coefficient;
        this.power = power;
    }

    /* conditions
    this(X) => sum(coefficient(i)*X^i:for(i=degree;i>=0;i--)) && X^0=1
    this.degree()==this.power==highestPower
    this.highestPoweredCoefficient==this.coefficient
    this.successor!=null links to terms whose powers uniquely decrease
    Polynomial(0.0,0)=(coefficient=0.0,power=0,successor=null)==0.0
    if (coefficient==NaN) coefficient=0.0
    if (abs(coefficient)<epsilon)) coefficient=0.0
    if (power<0) power=0
    if (this.degree()==0) abs(coefficient(0))>=0.0
    if (this.degree()>0) abs(coefficient(i))>=epsilon for all i>=0
     */

    // cdd Method
    // validates the parameters before changing the state of polynomial
    // to reflect the addition of the term:
    // coefficient t X x power
    private static void add(Polynomial polynomial, double coefficient, int power) {
        /*students #1*/
        if (polynomial == null) return;
        if (Math.abs(coefficient) < epsilon) coefficient = 0.0;
        if (coefficient == 0.0) return;
        if (power < 0) return;

        // our part:
        if (polynomial.coefficient == 0.0)
        {
            polynomial.coefficient = coefficient;
            polynomial.power = power;
            return;
        }

        if (polynomial.power == power)
        {
            // case 3
            polynomial.coefficient += coefficient;
            if (Math.abs(polynomial.coefficient) < epsilon)
            polynomial.coefficient = 0.0;
            //subcase 3.1 and 3.2
            if (polynomial.coefficient != 0.0 || polynomial.power == 0) return;
            if (polynomial.successor == null)
            {
                polynomial.power = 0;
                return;
            }
            polynomial.coefficient = polynomial.successor.coefficient;
            polynomial.power = polynomial.successor.power;
            polynomial.successor = polynomial.successor.successor;
            return;
        }
        
        //
        Polynomial previous = null;
        Polynomial traverser = polynomial;
        
        // search the SLL to find a suitable place in the SLL
        while (traverser != null)
        {
            if (traverser.power <= power) break;
            previous = traverser;
            traverser = traverser.successor;
        }

        // 
        if (previous == null)
        {
            Polynomial term = new Polynomial(0.0,0);
            term.coefficient = polynomial.coefficient;
            term.power = polynomial.power;
            term.successor = polynomial.successor;
            polynomial.coefficient = coefficient;
            polynomial.power = power;
            polynomial.successor = term;
            return;
        }
        //
        if (traverser == null || traverser.power < power)
        {
            Polynomial term = new Polynomial(0.0,0);
            term.coefficient = coefficient;
            term.power = power;
            term.successor = traverser;
            previous.successor = term;
            return;
        }
        coefficient += traverser.coefficient;
        if (Math.abs(coefficient) < epsilon) coefficient = 0.0;
        if (coefficient == 0.0)
            previous.successor = traverser.successor;
        else
            traverser.coefficient = coefficient;
    }

    // cardinality Method
    // yields the number of terms in this polynomial
    final public int cardinality() {
        int count = 1;

        Polynomial traverser = this.successor;

        while (traverser != null) {
            count++;
            traverser = traverser.successor;
        }
        return count;
    }

    // clone Method
    // yields a link-by-link copy of this polynomial
    final public Polynomial clone() {
        Polynomial result = new Polynomial(0.0, 0);

        result.coefficient = this.coefficient;

        result.power = this.power;

        Polynomial traverserThis = this;

        Polynomial traverserResult = result;

        while (traverserThis.successor != null) {
            traverserResult.successor = new Polynomial(0.0, 0);
            traverserThis = traverserThis.successor;
            traverserResult = traverserResult.successor;
            traverserResult.coefficient = traverserThis.coefficient;
            traverserResult.power = traverserThis.power;
        }

        return result;
    }

    // coefficient Method
    // yields the coefficient of the term with that power
    // in this polynomial
    final public double coefficient(int power) {
        if (power < 0) {
            return 0.0;
        }

        Polynomial traverser = this;

        do {
            if (traverser.power < power) {
                return 0.0;
            }
            if (traverser.power == power) {
                return traverser.coefficient;
            }
            traverser = traverser.successor;
        } while (traverser != null);

        return 0.0;
    }

    // composite Method
    // validates the parameter and yields the polynomial result
    // for the operation: this(that(x))
            /**
         * validates the parameter and yields the polynomial result
         * for the operation: this(that(x))
         *
         * @param Polynomial that
         *
         * @return Polynomial outcome
         */
        final public Polynomial composite(Polynomial that) {
            /*students #2*/
            if (that == null) {
                return null;
            }
     
            // setup a clone for this Polynomial
            Polynomial thisClone = this.clone();
            // setup a clone for that Polynomial
            Polynomial thatClone = that.clone();
            // setup a provisional (temporary) Polynomial
            Polynomial provisional = new Polynomial(0.0, 0);
            // store the outcome (result) in this Polynomial
            Polynomial outcome = new Polynomial(0.0, 0);
     
            // formula is: this(that) = this.coeff(n).times(that(n)) + this.coeff(n-1).times(that(n-1))
     
            while(thisClone != null)
            {
                // expand this power by the coefficient
                for( int i = 1; i <= thisClone.power; i++)
                {
                    provisional.coefficient = thisClone.coefficient;
                    provisional = provisional.times(thatClone);
                }
                // add to the outcome
                outcome = outcome.plus(provisional);
                // clear the provisional for the next loop
                provisional = new Polynomial(0.0,0);
                // move to the next element
                thisClone = thisClone.successor;
            }
     
     
            return outcome;
        }


    // degree Method
    // yields the degree (highest power) of this polynomial
    final public int degree() {
        return this.power;
    }

    // differentiate method
    // yields the polynomial result for the operation:
    // d/dx(this(x))
    final public Polynomial differentiate() {
        /*students #3*/
        // setup traverser Polynomial
        Polynomial traverser = this;
        // setup provisional (temporary) Polynomial
        Polynomial provisional = new Polynomial(0.0,0);
        // setup outcome (result) Polynomial
        Polynomial outcome = new Polynomial(0.0,0);

        if (this.power == 0)
        {
            return new Polynomial(0.0,0);
        }
        else
        {
            // search the Polynomial with traverser
            while (traverser!=null)
            {
                // Power > 1
                if(traverser.power >1)
                {
                    provisional.coefficient = traverser.coefficient * traverser.power;
                    provisional.power = traverser.power - 1;

                }
                // Power = 1
                if(traverser.power ==1)
                {
                    provisional.coefficient = traverser.coefficient;
                    provisional.power = 0;
                }
                // Power = 0
                if(traverser.power ==0)
                {
                    provisional.coefficient =0.0;
                    provisional.power =0;
                }
                // move the traverser to the next element
                traverser = traverser.successor;
                // add the provisional to the ouctome Polynomial
                outcome = outcome.plus(provisional);
            }
        }
        return outcome;
    }

    // dividedBy method
    // validates the parameter and yields the quotient and the
    // remainder (as a 2-array of polynomials) for
    // the operation: this(x) / that(x)
    final public Polynomial[] dividedBy(Polynomial that) {
        if (that == null) {
            return null;
        }
        if (that.coefficient == 0.0) {
            return null;
        }
        
        
        
     
        
        
        // Student Part
        
              
        double powerMaxM = that.powerMax();
        
       int provisionalpower = (int) (this.degree() - powerMaxM);

        // setup a provisional (temporary) Polynomial

//         setup two doubles used to divide the quotient coefficient
        Polynomial quotient = new Polynomial(0.0, provisionalpower);
        Polynomial reminder = this.clone();

  
        for (int i = this.degree(); i >= powerMaxM; i--) {
 
            quotient.coefficient = reminder.coefficient / that.coefficient;
            
            
            reminder = this.minus(that.times(quotient));
 
            
            
        }


        // end Student Part

        Polynomial[] result = new Polynomial[2];
        result[0] = quotient;
        result[1] = reminder;
        return result;
    }

    

    // equals Method
    // yields true when this polynomial is a hard-copy
    // of that polynomial; and false otherwise
    final public boolean equals(Polynomial that) {
        if (that == null) {
            return false;
        }

        if (this.coefficient != that.coefficient) {
            return false;
        }

        if (this.power != that.power) {
            return false;
        }

        if (this.successor == null && that.successor == null) {
            return true;
        }

        if (this.successor == null && that.successor != null) {
            return false;
        }

        if (this.successor != null && that.successor == null) {
            return false;
        }

        return this.successor.equals(that.successor);
    }

    // evaluate Method
    // validates the parameter and yields the double result
    // for the operation this(variable).
    final public double evaluate(double variable) {
        /*students #5 */
        if (Double.isNaN(variable)) {
            variable = 0.0;
        }
        if (Math.abs(variable) < epsilon) {
            variable = 0.0;
        }
        double value = 0.0;

        // Student Part

        // Setup a Polynomial for this Clone (pointer)
        Polynomial thisClone = this.clone();
        // search through this clone
        while(thisClone !=null)
        {
            // Power > 0
            if(thisClone.power > 0)
            {
                // append the clone's coeffeicient multiplied by the power
                value += thisClone.coefficient * Math.pow(variable, thisClone.power);
            }
            // Power is not > 0
            else
            {
                // append the clone's coefficient
                value += thisClone.coefficient;
            }
            // move the clone to the successor for the loop
            thisClone = thisClone.successor;
        }

        // End Student Part

        return value;
    }

    // integrate Method
    // yields the polynomial result for the operation
    // [ this(x) x dx
    final public Polynomial integrate() {
        /*students #6*/
        if (this.coefficient == 0.0) {
            return new Polynomial(0.0, 0);
        }
        Polynomial result = this.clone();

        // Student Part

        // Setup outcome (answer) Polynomial
        Polynomial outcome = new Polynomial(0.0, 0);
        // Setup provisional (temporary) Polynomial
        Polynomial provisional = new Polynomial(0.0, 0);

        while(result!=null)
        {
            // add 1 to the power for provisional
            provisional.power = result.power + 1;
            // make provisional coefficient equal
            // the result coefficient divided by
            // the new provisional power
            // provisional.coefficient = result.coefficient / provisional.power;
            provisional.coefficient = result.coefficient / (result.power +1);
            // move the result to the successor element
            result = result.successor;
            // add the provisional to the outcome and loop
            outcome = outcome.plus(provisional);
        }

        // End Student Part

        return result;
    }

    // minus Method
    // yields a hard-copy of the result of this polynomial
    // subtract that polynomial
    final public Polynomial minus(Polynomial that) {
        if (that == null) {
            return null;
        }

        if (this.equals(that)) {
            return new Polynomial(0.0, 0);
        }

        Polynomial result = this.clone();

        if (that.coefficient == 0.0) {
            return result;
        }

        Polynomial traverser = that;

        do {
            add(result, -traverser.coefficient, traverser.power);
            traverser = traverser.successor;
        } while (traverser != null);

        return result;
    }

    // plus Method
    // yields a hard-copy of the result of this polynomial
    // and that polynomial
    final public Polynomial plus(Polynomial that) {
        if (that == null) {
            return null;
        }

        if (this.coefficient == 0.0) {
            return that.clone();
        }

        Polynomial result = this.clone();

        if (that.coefficient == 0.0) {
            return result;
        }

        Polynomial traverser = that;

        do {
            add(result, traverser.coefficient, traverser.power);
            traverser = traverser.successor;
        } while (traverser != null);

        return result;
    }

    // powerMax Method
    // yields the highest power of this polynomial by traversing all
    // the terms
    final public int powerMax() {
        int max = Integer.MIN_VALUE;

        Polynomial traverser = this;

        do {
            if (max < traverser.power) {
                max = traverser.power;
            }

            traverser = traverser.successor;

        } while (traverser != null);

        return max;
    }

    // powerMin Method
    // yields the least power of this polynomial by traversing all
    // the terms
    final public int powerMin() {
        int min = Integer.MAX_VALUE;

        Polynomial traverser = this;

        do {
            if (min > traverser.power) {
                min = traverser.power;
            }
            traverser = traverser.successor;
        } while (traverser != null);

        return min;
    }

    // times Method
    // validates the parameter and yields the polynomial result
    // for the operation this(x) x that(x)
    final public Polynomial times(Polynomial that) {
        /*students #7*/
        if (that == null)
        {
            return null;
        }

        Polynomial result = new Polynomial(0.0, 0);

        // Student Part

        // Setup new polynomial for this clone
        Polynomial thisClone = this.clone();
        // Setup new polynomial for that clone
        Polynomial thatClone = that.clone();
        // Setup new provisional (temporary) polynomial
        Polynomial provisional = new Polynomial(0.0, 0);

        // search through this clone
	while (thisClone != null)
	{
            // search through that clone
            while (thatClone != null)
            {
                // Either clone's coefficient is equal to zero (0)
                if (thisClone.coefficient == 0.0 || thatClone.coefficient == 0.0)
                {
                    // make the provisional coefficient zero   
                    provisional.coefficient = 0.0;
                    // make the provisional power zero
                    provisional.power = 0;
                }
                // otherwise:
                else
                {
                    // make the provisional coefficient equal this clone's coefficient
                    // multiplied by that clone's coefficient
                    provisional.coefficient = thisClone.coefficient * thatClone.coefficient;
                    // make the provisional power equal to this clone's power
                    // multiplied by that clone's power
                    provisional.power = thisClone.power + thatClone.power;
                }
                // add the provisional to the result
                result = result.plus(provisional);
                // make that clone it's successor
                thatClone = thatClone.successor;
            }
            // clear that clone for next loop
            thatClone = that.clone();
            // make this clone it's successor
            thisClone = thisClone.successor;
	}

        // End Student Part

        return result;
        }

//    @Override
    // toString Method
    // yields a String representation of all the terms
    // of this polynomial
    final public String toString() {
        String string = "" + this.coefficient + (this.power == 0 ? "" : "*X^" + this.power);

        Polynomial traverser = this.successor;

        while (traverser != null) {
            string += (traverser.coefficient > 0.0 ? "+" : "")
                    + traverser.coefficient
                    + (traverser.power == 0 ? "" : "*X^"
                    + traverser.power);
            traverser = traverser.successor;
        }

        return string;
    }

}



tester class
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package datastructuresassignment2;

/**
 *
 * @author ranz
 */
public class Main {

    /**
     * @param args the command line arguments
     */

    static Polynomial p =null;
    static Polynomial p0 = new Polynomial(-1.0,0);
    static Polynomial q0 = new Polynomial(0.0,0);
    static Polynomial r0 = new Polynomial(1.0,0);
    static Polynomial p1 = new Polynomial(-1.0,1).plus(new Polynomial(1.0,0));
    static Polynomial p2 = new Polynomial(1.0,2).plus(new Polynomial(-1.0,1)).plus(new Polynomial(1.0,0)).plus(new Polynomial(1.0,2));
    static Polynomial p3 = new Polynomial(-3.0,3).plus(new Polynomial(2.0,2)).plus(new Polynomial(-1.0,1)).plus(new Polynomial(0.5,0)).plus(new Polynomial(0.5,0));
    static Polynomial p4 = new Polynomial(4.0,4).plus(new Polynomial(-2.0,2)).plus(new Polynomial(1.0,0));
    static Polynomial p5 = new Polynomial(-5.0,5).plus(new Polynomial(3.0,3)).plus(new Polynomial(-1.0,1));
    static Polynomial q5 = new Polynomial(-0.5,1).plus(new Polynomial(-2.5,5)).plus(new Polynomial(2.5,5)).plus(new Polynomial(-5.0,5)).plus(new Polynomial(3.0,3)).plus(new Polynomial(-0.5,1));
    static Polynomial s0 = new Polynomial(-5.0,5).plus(new Polynomial(5.0,5)).plus(new Polynomial(3.0,3)).plus(new Polynomial(-1.0,1)).plus(new Polynomial(1.0,1)).plus(new Polynomial(-3.0,3));
    static Polynomial[] polynomials = {p, p0, q0, r0, p1, p2, p3, p4, p5, q5, s0};
    static double[] variables = {-2.0, -1.0, 0.0, 1.0, 2.0};

   public static void main(String[] args) {

        for (int i = 0; i < polynomials.length; i++)
            System.out.println("\npolynomials[" + i + "]=" + polynomials[i]);
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            System.out.println("\n(" + polynomials[i] + ").cardinality()=" +
            polynomials[i].cardinality());
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            System.out.println("\n(" + polynomials[i] + ").clone()=\n" +
            polynomials[i].clone());
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            for (int power = polynomials[i].degree() + 1; power > -1; power--)
                System.out.println("\n(" + polynomials[i] + ").coeff(" + power + ")=" +
                polynomials[i].coefficient(power));
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            for (int j = 0; j < polynomials.length; j++)
                System.out.println("\n(" + polynomials[i] + ").composite(" +
                    polynomials[j] + ")=\n"+
                    polynomials[i].composite(polynomials[j]));
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            System.out.println("\n(" + polynomials[i] + ").degree()="+
                polynomials[i].degree());
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            System.out.println("\n(" + polynomials[i] + ").differentiate()=\n" +
                polynomials[i].differentiate());
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            for (int j = 0; j < polynomials.length; j++)
            {
                Polynomial[] result = polynomials[i].dividedBy(polynomials[j]);
                System.out.println("\n(" + polynomials[i] + ").dividedBy(" +
                    polynomials[j] + "):" +
                    (result == null ? " null": "\n quotient=" + result[0] + "\n remainder=" + result[1]));
            }
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            for (int j = 0; j < polynomials.length; j++)
                System.out.println("\n(" + polynomials[i] + ").equals(" +
                    polynomials[j] + ")=\n" +
                    polynomials[i].equals(polynomials[j]));
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            for (int j = 0; j < variables.length; j++)
                System.out.println("\n(" + polynomials[i] +
                    ").evaluate(" + variables[j] + ")=" +
                polynomials[i].evaluate(variables[j]));
            }
        for (int i = 0;  i <polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            System.out.println("\n(" + polynomials[i]  +").integrate()=\n" +
                polynomials[i].integrate());
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            for (int j = 0; j < polynomials.length; j++)
                System.out.println("\n(" + polynomials[i] + ").minus(" +
                    polynomials[j] + ")=\n" +
                    polynomials[i].minus(polynomials[j]));
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            for (int j = 0; j < polynomials.length; j++)
                System.out.println("\n(" + polynomials[i] + ").plus(" +
                    polynomials[j] + ")=\n" +
                    polynomials[i].plus(polynomials[j]));
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            System.out.println("\n(" + polynomials[i] + ").powerMax()=" +
                polynomials[i].powerMax());
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            System.out.println("\n(" + polynomials[i] + ").powerMin()=" +
                polynomials[i].powerMin());
        }
        for (int i = 0; i < polynomials.length; i++)
        {
            if (polynomials[i] == null)
                continue;
            for (int j = 0; j < polynomials.length; j++)
                System.out.println("\n(" + polynomials[i] + ").times(" +
                polynomials[j] + ")=\n" +
                polynomials[i].times(polynomials[j]));
        }
    }
}

// Math.pow(-0.0,-even) == POSITIVE_INFINITY == +1.0/0.0
// Math.pow(-0.0, -odd) == NEGATIVE_INFINITY == -1.0/0.0
// Math.pow(-0.0, 0) == +1.0
// Math.pow(-0.0,+even) == +0.0
// Math.pow(-0.0, +odd) == -0.0
// Math.pow(+0.0, -int) == POSITIVE_INFINITY == +1.0/0.0
// Math.pow(+0.0, 0) == +1.0
// Math.pow(+0.0, +int) == +0.0
// Math.pow(double, 0) == +1.0
// 0.0 == -0.0



and the expected output from the tester class
polynomials[0]=null

polynomials[1]=-1.0

polynomials[2]=0.0

polynomials[3]=1.0

polynomials[4]=-1.0*X^1+1.0

polynomials[5]=2.0*X^2-1.0*X^1+1.0

polynomials[6]=-3.0*X^3+2.0*X^2-1.0*X^1+1.0

polynomials[7]=4.0*X^4-2.0*X^2+1.0

polynomials[8]=-5.0*X^5+3.0*X^3-1.0*X^1

polynomials[9]=-5.0*X^5+3.0*X^3-1.0*X^1

polynomials[10]=0.0

(-1.0).cardinality()=1

(0.0).cardinality()=1

(1.0).cardinality()=1

(-1.0*X^1+1.0).cardinality()=2

(2.0*X^2-1.0*X^1+1.0).cardinality()=3

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).cardinality()=4

(4.0*X^4-2.0*X^2+1.0).cardinality()=3

(-5.0*X^5+3.0*X^3-1.0*X^1).cardinality()=3

(-5.0*X^5+3.0*X^3-1.0*X^1).cardinality()=3

(0.0).cardinality()=1

(-1.0).clone()=
-1.0

(0.0).clone()=
0.0

(1.0).clone()=
1.0

(-1.0*X^1+1.0).clone()=
-1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).clone()=
2.0*X^2-1.0*X^1+1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).clone()=
-3.0*X^3+2.0*X^2-1.0*X^1+1.0

(4.0*X^4-2.0*X^2+1.0).clone()=
4.0*X^4-2.0*X^2+1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).clone()=
-5.0*X^5+3.0*X^3-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).clone()=
-5.0*X^5+3.0*X^3-1.0*X^1

(0.0).clone()=
0.0

(-1.0).coeff(1)=0.0

(-1.0).coeff(0)=-1.0

(0.0).coeff(1)=0.0

(0.0).coeff(0)=0.0

(1.0).coeff(1)=0.0

(1.0).coeff(0)=1.0

(-1.0*X^1+1.0).coeff(2)=0.0

(-1.0*X^1+1.0).coeff(1)=-1.0

(-1.0*X^1+1.0).coeff(0)=1.0

(2.0*X^2-1.0*X^1+1.0).coeff(3)=0.0

(2.0*X^2-1.0*X^1+1.0).coeff(2)=2.0

(2.0*X^2-1.0*X^1+1.0).coeff(1)=-1.0

(2.0*X^2-1.0*X^1+1.0).coeff(0)=1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).coeff(4)=0.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).coeff(3)=-3.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).coeff(2)=2.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).coeff(1)=-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).coeff(0)=1.0

(4.0*X^4-2.0*X^2+1.0).coeff(5)=0.0

(4.0*X^4-2.0*X^2+1.0).coeff(4)=4.0

(4.0*X^4-2.0*X^2+1.0).coeff(3)=0.0

(4.0*X^4-2.0*X^2+1.0).coeff(2)=-2.0

(4.0*X^4-2.0*X^2+1.0).coeff(1)=0.0

(4.0*X^4-2.0*X^2+1.0).coeff(0)=1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(6)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(5)=-5.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(4)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(3)=3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(2)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(1)=-1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(0)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(6)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(5)=-5.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(4)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(3)=3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(2)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(1)=-1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).coeff(0)=0.0

(0.0).coeff(1)=0.0

(0.0).coeff(0)=0.0

(-1.0).composite(null)=
null

(-1.0).composite(-1.0)=
-1.0

(-1.0).composite(0.0)=
-1.0

(-1.0).composite(1.0)=
-1.0

(-1.0).composite(-1.0*X^1+1.0)=
-1.0

(-1.0).composite(2.0*X^2-1.0*X^1+1.0)=
-1.0

(-1.0).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
-1.0

(-1.0).composite(4.0*X^4-2.0*X^2+1.0)=
-1.0

(-1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
-1.0

(-1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
-1.0

(-1.0).composite(0.0)=
-1.0

(0.0).composite(null)=
null

(0.0).composite(-1.0)=
0.0

(0.0).composite(0.0)=
0.0

(0.0).composite(1.0)=
0.0

(0.0).composite(-1.0*X^1+1.0)=
0.0

(0.0).composite(2.0*X^2-1.0*X^1+1.0)=
0.0

(0.0).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
0.0

(0.0).composite(4.0*X^4-2.0*X^2+1.0)=
0.0

(0.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(0.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(0.0).composite(0.0)=
0.0

(1.0).composite(null)=
null

(1.0).composite(-1.0)=
1.0

(1.0).composite(0.0)=
1.0

(1.0).composite(1.0)=
1.0

(1.0).composite(-1.0*X^1+1.0)=
1.0

(1.0).composite(2.0*X^2-1.0*X^1+1.0)=
1.0

(1.0).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
1.0

(1.0).composite(4.0*X^4-2.0*X^2+1.0)=
1.0

(1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
1.0

(1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
1.0

(1.0).composite(0.0)=
1.0

(-1.0*X^1+1.0).composite(null)=
null

(-1.0*X^1+1.0).composite(-1.0)=
2.0

(-1.0*X^1+1.0).composite(0.0)=
1.0

(-1.0*X^1+1.0).composite(1.0)=
0.0

(-1.0*X^1+1.0).composite(-1.0*X^1+1.0)=
1.0*X^1

(-1.0*X^1+1.0).composite(2.0*X^2-1.0*X^1+1.0)=
-2.0*X^2+1.0*X^1

(-1.0*X^1+1.0).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
3.0*X^3-2.0*X^2+1.0*X^1

(-1.0*X^1+1.0).composite(4.0*X^4-2.0*X^2+1.0)=
-4.0*X^4+2.0*X^2

(-1.0*X^1+1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1+1.0

(-1.0*X^1+1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1+1.0

(-1.0*X^1+1.0).composite(0.0)=
1.0

(2.0*X^2-1.0*X^1+1.0).composite(null)=
null

(2.0*X^2-1.0*X^1+1.0).composite(-1.0)=
4.0

(2.0*X^2-1.0*X^1+1.0).composite(0.0)=
1.0

(2.0*X^2-1.0*X^1+1.0).composite(1.0)=
2.0

(2.0*X^2-1.0*X^1+1.0).composite(-1.0*X^1+1.0)=
2.0*X^2-3.0*X^1+2.0

(2.0*X^2-1.0*X^1+1.0).composite(2.0*X^2-1.0*X^1+1.0)=
8.0*X^4-8.0*X^3+8.0*X^2-3.0*X^1+2.0

(2.0*X^2-1.0*X^1+1.0).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
18.0*X^6-24.0*X^5+20.0*X^4-17.0*X^3+8.0*X^2-3.0*X^1+2.0

(2.0*X^2-1.0*X^1+1.0).composite(4.0*X^4-2.0*X^2+1.0)=
32.0*X^8-32.0*X^6+20.0*X^4-6.0*X^2+2.0

(2.0*X^2-1.0*X^1+1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
50.0*X^10-60.0*X^8+38.0*X^6+5.0*X^5-12.0*X^4-3.0*X^3+2.0*X^2+1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
50.0*X^10-60.0*X^8+38.0*X^6+5.0*X^5-12.0*X^4-3.0*X^3+2.0*X^2+1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).composite(0.0)=
1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(null)=
null

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(-1.0)=
7.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(0.0)=
1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(1.0)=
-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(-1.0*X^1+1.0)=
3.0*X^3-7.0*X^2+6.0*X^1-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(2.0*X^2-1.0*X^1+1.0)=
-24.0*X^6+36.0*X^5-46.0*X^4+31.0*X^3-19.0*X^2+6.0*X^1-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
81.0*X^9-162.0*X^8+189.0*X^7-195.0*X^6+147.0*X^5-88.0*X^4+49.0*X^3-19.0*X^2+6.0*X^1-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(4.0*X^4-2.0*X^2+1.0)=
-192.0*X^12+288.0*X^10-256.0*X^8+136.0*X^6-52.0*X^4+12.0*X^2-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
375.0*X^15-675.0*X^13+630.0*X^11+50.0*X^10-351.0*X^9-60.0*X^8+126.0*X^7+38.0*X^6-22.0*X^5-12.0*X^4+2.0*X^2+1.0*X^1+1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
375.0*X^15-675.0*X^13+630.0*X^11+50.0*X^10-351.0*X^9-60.0*X^8+126.0*X^7+38.0*X^6-22.0*X^5-12.0*X^4+2.0*X^2+1.0*X^1+1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).composite(0.0)=
1.0

(4.0*X^4-2.0*X^2+1.0).composite(null)=
null

(4.0*X^4-2.0*X^2+1.0).composite(-1.0)=
3.0

(4.0*X^4-2.0*X^2+1.0).composite(0.0)=
1.0

(4.0*X^4-2.0*X^2+1.0).composite(1.0)=
3.0

(4.0*X^4-2.0*X^2+1.0).composite(-1.0*X^1+1.0)=
4.0*X^4-16.0*X^3+22.0*X^2-12.0*X^1+3.0

(4.0*X^4-2.0*X^2+1.0).composite(2.0*X^2-1.0*X^1+1.0)=
64.0*X^8-128.0*X^7+224.0*X^6-224.0*X^5+188.0*X^4-104.0*X^3+46.0*X^2-12.0*X^1+3.0

(4.0*X^4-2.0*X^2+1.0).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
324.0*X^12-864.0*X^11+1296.0*X^10-1680.0*X^9+1720.0*X^8-1424.0*X^7+1046.0*X^6-632.0*X^5+320.0*X^4-140.0*X^3+46.0*X^2-12.0*X^1+3.0

(4.0*X^4-2.0*X^2+1.0).composite(4.0*X^4-2.0*X^2+1.0)=
1024.0*X^16-2048.0*X^14+2560.0*X^12-2048.0*X^10+1184.0*X^8-480.0*X^6+136.0*X^4-24.0*X^2+3.0

(4.0*X^4-2.0*X^2+1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
2500.0*X^20-6000.0*X^18+7400.0*X^16-5760.0*X^14+3084.0*X^12-1202.0*X^10+356.0*X^8-86.0*X^6+16.0*X^4-2.0*X^2+1.0

(4.0*X^4-2.0*X^2+1.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
2500.0*X^20-6000.0*X^18+7400.0*X^16-5760.0*X^14+3084.0*X^12-1202.0*X^10+356.0*X^8-86.0*X^6+16.0*X^4-2.0*X^2+1.0

(4.0*X^4-2.0*X^2+1.0).composite(0.0)=
1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(null)=
null

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-1.0)=
3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(0.0)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(1.0)=
-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-1.0*X^1+1.0)=
5.0*X^5-25.0*X^4+47.0*X^3-41.0*X^2+17.0*X^1-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(2.0*X^2-1.0*X^1+1.0)=
-160.0*X^10+400.0*X^9-800.0*X^8+1000.0*X^7-1026.0*X^6+769.0*X^5-471.0*X^4+211.0*X^3-75.0*X^2+17.0*X^1-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
1215.0*X^15-4050.0*X^14+7425.0*X^13-11025.0*X^12+13350.0*X^11-13360.0*X^10+11719.0*X^9-8888.0*X^8+5836.0*X^7-3387.0*X^6+1684.0*X^5-717.0*X^4+262.0*X^3-75.0*X^2+17.0*X^1-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(4.0*X^4-2.0*X^2+1.0)=
-5120.0*X^20+12800.0*X^18-19200.0*X^16+19200.0*X^14-14208.0*X^12+7872.0*X^10-3312.0*X^8+1032.0*X^6-232.0*X^4+34.0*X^2-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
15625.0*X^25-46875.0*X^23+71875.0*X^21-71250.0*X^19+50125.0*X^17-26340.0*X^15+10700.0*X^13-3480.0*X^11+926.0*X^9-201.0*X^7+37.0*X^5-6.0*X^3+1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
15625.0*X^25-46875.0*X^23+71875.0*X^21-71250.0*X^19+50125.0*X^17-26340.0*X^15+10700.0*X^13-3480.0*X^11+926.0*X^9-201.0*X^7+37.0*X^5-6.0*X^3+1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(0.0)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(null)=
null

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-1.0)=
3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(0.0)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(1.0)=
-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-1.0*X^1+1.0)=
5.0*X^5-25.0*X^4+47.0*X^3-41.0*X^2+17.0*X^1-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(2.0*X^2-1.0*X^1+1.0)=
-160.0*X^10+400.0*X^9-800.0*X^8+1000.0*X^7-1026.0*X^6+769.0*X^5-471.0*X^4+211.0*X^3-75.0*X^2+17.0*X^1-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
1215.0*X^15-4050.0*X^14+7425.0*X^13-11025.0*X^12+13350.0*X^11-13360.0*X^10+11719.0*X^9-8888.0*X^8+5836.0*X^7-3387.0*X^6+1684.0*X^5-717.0*X^4+262.0*X^3-75.0*X^2+17.0*X^1-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(4.0*X^4-2.0*X^2+1.0)=
-5120.0*X^20+12800.0*X^18-19200.0*X^16+19200.0*X^14-14208.0*X^12+7872.0*X^10-3312.0*X^8+1032.0*X^6-232.0*X^4+34.0*X^2-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
15625.0*X^25-46875.0*X^23+71875.0*X^21-71250.0*X^19+50125.0*X^17-26340.0*X^15+10700.0*X^13-3480.0*X^11+926.0*X^9-201.0*X^7+37.0*X^5-6.0*X^3+1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
15625.0*X^25-46875.0*X^23+71875.0*X^21-71250.0*X^19+50125.0*X^17-26340.0*X^15+10700.0*X^13-3480.0*X^11+926.0*X^9-201.0*X^7+37.0*X^5-6.0*X^3+1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).composite(0.0)=
0.0

(0.0).composite(null)=
null

(0.0).composite(-1.0)=
0.0

(0.0).composite(0.0)=
0.0

(0.0).composite(1.0)=
0.0

(0.0).composite(-1.0*X^1+1.0)=
0.0

(0.0).composite(2.0*X^2-1.0*X^1+1.0)=
0.0

(0.0).composite(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
0.0

(0.0).composite(4.0*X^4-2.0*X^2+1.0)=
0.0

(0.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(0.0).composite(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(0.0).composite(0.0)=
0.0

(-1.0).degree()=0

(0.0).degree()=0

(1.0).degree()=0

(-1.0*X^1+1.0).degree()=1

(2.0*X^2-1.0*X^1+1.0).degree()=2

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).degree()=3

(4.0*X^4-2.0*X^2+1.0).degree()=4

(-5.0*X^5+3.0*X^3-1.0*X^1).degree()=5

(-5.0*X^5+3.0*X^3-1.0*X^1).degree()=5

(0.0).degree()=0

(-1.0).differentiate()=
0.0

(0.0).differentiate()=
0.0

(1.0).differentiate()=
0.0

(-1.0*X^1+1.0).differentiate()=
-1.0

(2.0*X^2-1.0*X^1+1.0).differentiate()=
4.0*X^1-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).differentiate()=
-9.0*X^2+4.0*X^1-1.0

(4.0*X^4-2.0*X^2+1.0).differentiate()=
16.0*X^3-4.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).differentiate()=
-25.0*X^4+9.0*X^2-1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).differentiate()=
-25.0*X^4+9.0*X^2-1.0

(0.0).differentiate()=
0.0

(-1.0).dividedBy(null): null

(-1.0).dividedBy(-1.0):
  quotient=1.0
  remainder=0.0

(-1.0).dividedBy(0.0): null

(-1.0).dividedBy(1.0):
  quotient=-1.0
  remainder=0.0

(-1.0).dividedBy(-1.0*X^1+1.0):
  quotient=0.0
  remainder=-1.0

(-1.0).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=-1.0

(-1.0).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=-1.0

(-1.0).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=0.0
  remainder=-1.0

(-1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=-1.0

(-1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=-1.0

(-1.0).dividedBy(0.0): null

(0.0).dividedBy(null): null

(0.0).dividedBy(-1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(0.0): null

(0.0).dividedBy(1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(-1.0*X^1+1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(0.0): null

(1.0).dividedBy(null): null

(1.0).dividedBy(-1.0):
  quotient=-1.0
  remainder=0.0

(1.0).dividedBy(0.0): null

(1.0).dividedBy(1.0):
  quotient=1.0
  remainder=0.0

(1.0).dividedBy(-1.0*X^1+1.0):
  quotient=0.0
  remainder=1.0

(1.0).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=1.0

(1.0).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=1.0

(1.0).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=0.0
  remainder=1.0

(1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=1.0

(1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=1.0

(1.0).dividedBy(0.0): null

(-1.0*X^1+1.0).dividedBy(null): null

(-1.0*X^1+1.0).dividedBy(-1.0):
  quotient=1.0*X^1-1.0
  remainder=0.0

(-1.0*X^1+1.0).dividedBy(0.0): null

(-1.0*X^1+1.0).dividedBy(1.0):
  quotient=-1.0*X^1+1.0
  remainder=0.0

(-1.0*X^1+1.0).dividedBy(-1.0*X^1+1.0):
  quotient=1.0
  remainder=0.0

(-1.0*X^1+1.0).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=-1.0*X^1+1.0

(-1.0*X^1+1.0).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=-1.0*X^1+1.0

(-1.0*X^1+1.0).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=0.0
  remainder=-1.0*X^1+1.0

(-1.0*X^1+1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=-1.0*X^1+1.0

(-1.0*X^1+1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=-1.0*X^1+1.0

(-1.0*X^1+1.0).dividedBy(0.0): null

(2.0*X^2-1.0*X^1+1.0).dividedBy(null): null

(2.0*X^2-1.0*X^1+1.0).dividedBy(-1.0):
  quotient=-2.0*X^2+1.0*X^1-1.0
  remainder=0.0

(2.0*X^2-1.0*X^1+1.0).dividedBy(0.0): null

(2.0*X^2-1.0*X^1+1.0).dividedBy(1.0):
  quotient=2.0*X^2-1.0*X^1+1.0
  remainder=0.0

(2.0*X^2-1.0*X^1+1.0).dividedBy(-1.0*X^1+1.0):
  quotient=-2.0*X^1-1.0
  remainder=2.0

(2.0*X^2-1.0*X^1+1.0).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=1.0
  remainder=0.0

(2.0*X^2-1.0*X^1+1.0).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=2.0*X^2-1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=0.0
  remainder=2.0*X^2-1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=2.0*X^2-1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=2.0*X^2-1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).dividedBy(0.0): null

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(null): null

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(-1.0):
  quotient=3.0*X^3-2.0*X^2+1.0*X^1-1.0
  remainder=0.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(0.0): null

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(1.0):
  quotient=-3.0*X^3+2.0*X^2-1.0*X^1+1.0
  remainder=0.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(-1.0*X^1+1.0):
  quotient=3.0*X^2+1.0*X^1+2.0
  remainder=-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=-1.5*X^1+0.25
  remainder=0.75*X^1+0.75

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=1.0
  remainder=0.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=0.0
  remainder=-3.0*X^3+2.0*X^2-1.0*X^1+1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=-3.0*X^3+2.0*X^2-1.0*X^1+1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=-3.0*X^3+2.0*X^2-1.0*X^1+1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).dividedBy(0.0): null

(4.0*X^4-2.0*X^2+1.0).dividedBy(null): null

(4.0*X^4-2.0*X^2+1.0).dividedBy(-1.0):
  quotient=-4.0*X^4+2.0*X^2-1.0
  remainder=0.0

(4.0*X^4-2.0*X^2+1.0).dividedBy(0.0): null

(4.0*X^4-2.0*X^2+1.0).dividedBy(1.0):
  quotient=4.0*X^4-2.0*X^2+1.0
  remainder=0.0

(4.0*X^4-2.0*X^2+1.0).dividedBy(-1.0*X^1+1.0):
  quotient=-4.0*X^3-4.0*X^2-2.0*X^1-2.0
  remainder=3.0

(4.0*X^4-2.0*X^2+1.0).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=2.0*X^2+1.0*X^1-1.5
  remainder=-2.5*X^1+2.5

(4.0*X^4-2.0*X^2+1.0).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=-1.3333333333333333*X^1-0.8888888888888888
  remainder=-1.5555555555555554*X^2+0.4444444444444444*X^1+1.8888888888888888

(4.0*X^4-2.0*X^2+1.0).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=1.0
  remainder=0.0

(4.0*X^4-2.0*X^2+1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=4.0*X^4-2.0*X^2+1.0

(4.0*X^4-2.0*X^2+1.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=4.0*X^4-2.0*X^2+1.0

(4.0*X^4-2.0*X^2+1.0).dividedBy(0.0): null

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(null): null

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-1.0):
  quotient=5.0*X^5-3.0*X^3+1.0*X^1
  remainder=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(0.0): null

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(1.0):
  quotient=-5.0*X^5+3.0*X^3-1.0*X^1
  remainder=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-1.0*X^1+1.0):
  quotient=5.0*X^4+5.0*X^3+2.0*X^2+2.0*X^1+3.0
  remainder=-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=-2.5*X^3-1.25*X^2+2.125*X^1+1.6875
  remainder=-1.4375*X^1-1.6875

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=1.6666666666666667*X^2+1.1111111111111112*X^1-0.8148148148148149
  remainder=1.0740740740740742*X^2-2.925925925925926*X^1+0.8148148148148149

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=-1.25*X^1
  remainder=0.5*X^3+0.25*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=1.0
  remainder=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=1.0
  remainder=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(0.0): null

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(null): null

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-1.0):
  quotient=5.0*X^5-3.0*X^3+1.0*X^1
  remainder=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(0.0): null

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(1.0):
  quotient=-5.0*X^5+3.0*X^3-1.0*X^1
  remainder=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-1.0*X^1+1.0):
  quotient=5.0*X^4+5.0*X^3+2.0*X^2+2.0*X^1+3.0
  remainder=-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=-2.5*X^3-1.25*X^2+2.125*X^1+1.6875
  remainder=-1.4375*X^1-1.6875

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=1.6666666666666667*X^2+1.1111111111111112*X^1-0.8148148148148149
  remainder=1.0740740740740742*X^2-2.925925925925926*X^1+0.8148148148148149

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=-1.25*X^1
  remainder=0.5*X^3+0.25*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=1.0
  remainder=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=1.0
  remainder=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).dividedBy(0.0): null

(0.0).dividedBy(null): null

(0.0).dividedBy(-1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(0.0): null

(0.0).dividedBy(1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(-1.0*X^1+1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(-3.0*X^3+2.0*X^2-1.0*X^1+1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(4.0*X^4-2.0*X^2+1.0):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(-5.0*X^5+3.0*X^3-1.0*X^1):
  quotient=0.0
  remainder=0.0

(0.0).dividedBy(0.0): null

(-1.0).equals(null)=
false

(-1.0).equals(-1.0)=
true

(-1.0).equals(0.0)=
false

(-1.0).equals(1.0)=
false

(-1.0).equals(-1.0*X^1+1.0)=
false

(-1.0).equals(2.0*X^2-1.0*X^1+1.0)=
false

(-1.0).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(-1.0).equals(4.0*X^4-2.0*X^2+1.0)=
false

(-1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(-1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(-1.0).equals(0.0)=
false

(0.0).equals(null)=
false

(0.0).equals(-1.0)=
false

(0.0).equals(0.0)=
true

(0.0).equals(1.0)=
false

(0.0).equals(-1.0*X^1+1.0)=
false

(0.0).equals(2.0*X^2-1.0*X^1+1.0)=
false

(0.0).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(0.0).equals(4.0*X^4-2.0*X^2+1.0)=
false

(0.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(0.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(0.0).equals(0.0)=
true

(1.0).equals(null)=
false

(1.0).equals(-1.0)=
false

(1.0).equals(0.0)=
false

(1.0).equals(1.0)=
true

(1.0).equals(-1.0*X^1+1.0)=
false

(1.0).equals(2.0*X^2-1.0*X^1+1.0)=
false

(1.0).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(1.0).equals(4.0*X^4-2.0*X^2+1.0)=
false

(1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(1.0).equals(0.0)=
false

(-1.0*X^1+1.0).equals(null)=
false

(-1.0*X^1+1.0).equals(-1.0)=
false

(-1.0*X^1+1.0).equals(0.0)=
false

(-1.0*X^1+1.0).equals(1.0)=
false

(-1.0*X^1+1.0).equals(-1.0*X^1+1.0)=
true

(-1.0*X^1+1.0).equals(2.0*X^2-1.0*X^1+1.0)=
false

(-1.0*X^1+1.0).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(-1.0*X^1+1.0).equals(4.0*X^4-2.0*X^2+1.0)=
false

(-1.0*X^1+1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(-1.0*X^1+1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(-1.0*X^1+1.0).equals(0.0)=
false

(2.0*X^2-1.0*X^1+1.0).equals(null)=
false

(2.0*X^2-1.0*X^1+1.0).equals(-1.0)=
false

(2.0*X^2-1.0*X^1+1.0).equals(0.0)=
false

(2.0*X^2-1.0*X^1+1.0).equals(1.0)=
false

(2.0*X^2-1.0*X^1+1.0).equals(-1.0*X^1+1.0)=
false

(2.0*X^2-1.0*X^1+1.0).equals(2.0*X^2-1.0*X^1+1.0)=
true

(2.0*X^2-1.0*X^1+1.0).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(2.0*X^2-1.0*X^1+1.0).equals(4.0*X^4-2.0*X^2+1.0)=
false

(2.0*X^2-1.0*X^1+1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(2.0*X^2-1.0*X^1+1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(2.0*X^2-1.0*X^1+1.0).equals(0.0)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(null)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(-1.0)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(0.0)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(1.0)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(-1.0*X^1+1.0)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(2.0*X^2-1.0*X^1+1.0)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
true

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(4.0*X^4-2.0*X^2+1.0)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).equals(0.0)=
false

(4.0*X^4-2.0*X^2+1.0).equals(null)=
false

(4.0*X^4-2.0*X^2+1.0).equals(-1.0)=
false

(4.0*X^4-2.0*X^2+1.0).equals(0.0)=
false

(4.0*X^4-2.0*X^2+1.0).equals(1.0)=
false

(4.0*X^4-2.0*X^2+1.0).equals(-1.0*X^1+1.0)=
false

(4.0*X^4-2.0*X^2+1.0).equals(2.0*X^2-1.0*X^1+1.0)=
false

(4.0*X^4-2.0*X^2+1.0).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(4.0*X^4-2.0*X^2+1.0).equals(4.0*X^4-2.0*X^2+1.0)=
true

(4.0*X^4-2.0*X^2+1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(4.0*X^4-2.0*X^2+1.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(4.0*X^4-2.0*X^2+1.0).equals(0.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(null)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(0.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-1.0*X^1+1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(2.0*X^2-1.0*X^1+1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(4.0*X^4-2.0*X^2+1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
true

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
true

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(0.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(null)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(0.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-1.0*X^1+1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(2.0*X^2-1.0*X^1+1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(4.0*X^4-2.0*X^2+1.0)=
false

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
true

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
true

(-5.0*X^5+3.0*X^3-1.0*X^1).equals(0.0)=
false

(0.0).equals(null)=
false

(0.0).equals(-1.0)=
false

(0.0).equals(0.0)=
true

(0.0).equals(1.0)=
false

(0.0).equals(-1.0*X^1+1.0)=
false

(0.0).equals(2.0*X^2-1.0*X^1+1.0)=
false

(0.0).equals(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
false

(0.0).equals(4.0*X^4-2.0*X^2+1.0)=
false

(0.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(0.0).equals(-5.0*X^5+3.0*X^3-1.0*X^1)=
false

(0.0).equals(0.0)=
true

(-1.0).evaluate(-2.0)=-1.0

(-1.0).evaluate(-1.0)=-1.0

(-1.0).evaluate(0.0)=-1.0

(-1.0).evaluate(1.0)=-1.0

(-1.0).evaluate(2.0)=-1.0

(0.0).evaluate(-2.0)=0.0

(0.0).evaluate(-1.0)=0.0

(0.0).evaluate(0.0)=0.0

(0.0).evaluate(1.0)=0.0

(0.0).evaluate(2.0)=0.0

(1.0).evaluate(-2.0)=1.0

(1.0).evaluate(-1.0)=1.0

(1.0).evaluate(0.0)=1.0

(1.0).evaluate(1.0)=1.0

(1.0).evaluate(2.0)=1.0

(-1.0*X^1+1.0).evaluate(-2.0)=3.0

(-1.0*X^1+1.0).evaluate(-1.0)=2.0

(-1.0*X^1+1.0).evaluate(0.0)=1.0

(-1.0*X^1+1.0).evaluate(1.0)=0.0

(-1.0*X^1+1.0).evaluate(2.0)=-1.0

(2.0*X^2-1.0*X^1+1.0).evaluate(-2.0)=11.0

(2.0*X^2-1.0*X^1+1.0).evaluate(-1.0)=4.0

(2.0*X^2-1.0*X^1+1.0).evaluate(0.0)=1.0

(2.0*X^2-1.0*X^1+1.0).evaluate(1.0)=2.0

(2.0*X^2-1.0*X^1+1.0).evaluate(2.0)=7.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).evaluate(-2.0)=35.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).evaluate(-1.0)=7.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).evaluate(0.0)=1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).evaluate(1.0)=-1.0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).evaluate(2.0)=-17.0

(4.0*X^4-2.0*X^2+1.0).evaluate(-2.0)=57.0

(4.0*X^4-2.0*X^2+1.0).evaluate(-1.0)=3.0

(4.0*X^4-2.0*X^2+1.0).evaluate(0.0)=1.0

(4.0*X^4-2.0*X^2+1.0).evaluate(1.0)=3.0

(4.0*X^4-2.0*X^2+1.0).evaluate(2.0)=57.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(-2.0)=138.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(-1.0)=3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(0.0)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(1.0)=-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(2.0)=-138.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(-2.0)=138.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(-1.0)=3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(0.0)=0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(1.0)=-3.0

(-5.0*X^5+3.0*X^3-1.0*X^1).evaluate(2.0)=-138.0

(0.0).evaluate(-2.0)=0.0

(0.0).evaluate(-1.0)=0.0

(0.0).evaluate(0.0)=0.0

(0.0).evaluate(1.0)=0.0

(0.0).evaluate(2.0)=0.0

(-1.0).integrate()=
-1.0*X^1

(0.0).integrate()=
0.0

(1.0).integrate()=
1.0*X^1

(-1.0*X^1+1.0).integrate()=
-0.5*X^2+1.0*X^1

(2.0*X^2-1.0*X^1+1.0).integrate()=
0.6666666666666666*X^3-0.5*X^2+1.0*X^1

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).integrate()=
-0.75*X^4+0.6666666666666666*X^3-0.5*X^2+1.0*X^1

(4.0*X^4-2.0*X^2+1.0).integrate()=
0.8*X^5-0.6666666666666666*X^3+1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).integrate()=
-0.8333333333333334*X^6+0.75*X^4-0.5*X^2

(-5.0*X^5+3.0*X^3-1.0*X^1).integrate()=
-0.8333333333333334*X^6+0.75*X^4-0.5*X^2

(0.0).integrate()=
0.0

(-1.0).minus(null)=
null

(-1.0).minus(-1.0)=
0.0

(-1.0).minus(0.0)=
-1.0

(-1.0).minus(1.0)=
-2.0

(-1.0).minus(-1.0*X^1+1.0)=
1.0*X^1-2.0

(-1.0).minus(2.0*X^2-1.0*X^1+1.0)=
-2.0*X^2+1.0*X^1-2.0

(-1.0).minus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
3.0*X^3-2.0*X^2+1.0*X^1-2.0

(-1.0).minus(4.0*X^4-2.0*X^2+1.0)=
-4.0*X^4+2.0*X^2-2.0

(-1.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1-1.0

(-1.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1-1.0

(-1.0).minus(0.0)=
-1.0

(0.0).minus(null)=
null

(0.0).minus(-1.0)=
1.0

(0.0).minus(0.0)=
0.0

(0.0).minus(1.0)=
-1.0

(0.0).minus(-1.0*X^1+1.0)=
1.0*X^1-1.0

(0.0).minus(2.0*X^2-1.0*X^1+1.0)=
-2.0*X^2+1.0*X^1-1.0

(0.0).minus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
3.0*X^3-2.0*X^2+1.0*X^1-1.0

(0.0).minus(4.0*X^4-2.0*X^2+1.0)=
-4.0*X^4+2.0*X^2-1.0

(0.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1

(0.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1

(0.0).minus(0.0)=
0.0

(1.0).minus(null)=
null

(1.0).minus(-1.0)=
2.0

(1.0).minus(0.0)=
1.0

(1.0).minus(1.0)=
0.0

(1.0).minus(-1.0*X^1+1.0)=
1.0*X^1

(1.0).minus(2.0*X^2-1.0*X^1+1.0)=
-2.0*X^2+1.0*X^1

(1.0).minus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
3.0*X^3-2.0*X^2+1.0*X^1

(1.0).minus(4.0*X^4-2.0*X^2+1.0)=
-4.0*X^4+2.0*X^2

(1.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1+1.0

(1.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1+1.0

(1.0).minus(0.0)=
1.0

(-1.0*X^1+1.0).minus(null)=
null

(-1.0*X^1+1.0).minus(-1.0)=
-1.0*X^1+2.0

(-1.0*X^1+1.0).minus(0.0)=
-1.0*X^1+1.0

(-1.0*X^1+1.0).minus(1.0)=
-1.0*X^1

(-1.0*X^1+1.0).minus(-1.0*X^1+1.0)=
0.0

(-1.0*X^1+1.0).minus(2.0*X^2-1.0*X^1+1.0)=
-2.0*X^2

(-1.0*X^1+1.0).minus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
3.0*X^3-2.0*X^2

(-1.0*X^1+1.0).minus(4.0*X^4-2.0*X^2+1.0)=
-4.0*X^4+2.0*X^2-1.0*X^1

(-1.0*X^1+1.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0

(-1.0*X^1+1.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0

(-1.0*X^1+1.0).minus(0.0)=
-1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).minus(null)=
null

(2.0*X^2-1.0*X^1+1.0).minus(-1.0)=
2.0*X^2-1.0*X^1+2.0

(2.0*X^2-1.0*X^1+1.0).minus(0.0)=
2.0*X^2-1.0*X^1+1.0

(2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3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
-5.0*X^5+6.0*X^3-2.0*X^2-1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).minus(4.0*X^4-2.0*X^2+1.0)=
-5.0*X^5-4.0*X^4+3.0*X^3+2.0*X^2-1.0*X^1-1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).minus(0.0)=
-5.0*X^5+3.0*X^3-1.0*X^1

(0.0).minus(null)=
null

(0.0).minus(-1.0)=
1.0

(0.0).minus(0.0)=
0.0

(0.0).minus(1.0)=
-1.0

(0.0).minus(-1.0*X^1+1.0)=
1.0*X^1-1.0

(0.0).minus(2.0*X^2-1.0*X^1+1.0)=
-2.0*X^2+1.0*X^1-1.0

(0.0).minus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
3.0*X^3-2.0*X^2+1.0*X^1-1.0

(0.0).minus(4.0*X^4-2.0*X^2+1.0)=
-4.0*X^4+2.0*X^2-1.0

(0.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1

(0.0).minus(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1

(0.0).minus(0.0)=
0.0

(-1.0).plus(null)=
null

(-1.0).plus(-1.0)=
-2.0

(-1.0).plus(0.0)=
-1.0

(-1.0).plus(1.0)=
0.0

(-1.0).plus(-1.0*X^1+1.0)=
-1.0*X^1

(-1.0).plus(2.0*X^2-1.0*X^1+1.0)=
2.0*X^2-1.0*X^1

(-1.0).plus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
-3.0*X^3+2.0*X^2-1.0*X^1

(-1.0).plus(4.0*X^4-2.0*X^2+1.0)=
4.0*X^4-2.0*X^2

(-1.0).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1-1.0

(-1.0).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1-1.0

(-1.0).plus(0.0)=
-1.0

(0.0).plus(null)=
null

(0.0).plus(-1.0)=
-1.0

(0.0).plus(0.0)=
0.0

(0.0).plus(1.0)=
1.0

(0.0).plus(-1.0*X^1+1.0)=
-1.0*X^1+1.0

(0.0).plus(2.0*X^2-1.0*X^1+1.0)=
2.0*X^2-1.0*X^1+1.0

(0.0).plus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
-3.0*X^3+2.0*X^2-1.0*X^1+1.0

(0.0).plus(4.0*X^4-2.0*X^2+1.0)=
4.0*X^4-2.0*X^2+1.0

(0.0).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1

(0.0).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1

(0.0).plus(0.0)=
0.0

(1.0).plus(null)=
null

(1.0).plus(-1.0)=
0.0

(1.0).plus(0.0)=
1.0

(1.0).plus(1.0)=
2.0

(1.0).plus(-1.0*X^1+1.0)=
-1.0*X^1+2.0

(1.0).plus(2.0*X^2-1.0*X^1+1.0)=
2.0*X^2-1.0*X^1+2.0

(1.0).plus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
-3.0*X^3+2.0*X^2-1.0*X^1+2.0

(1.0).plus(4.0*X^4-2.0*X^2+1.0)=
4.0*X^4-2.0*X^2+2.0

(1.0).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1+1.0

(1.0).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1+1.0

(1.0).plus(0.0)=
1.0

(-1.0*X^1+1.0).plus(null)=
null

(-1.0*X^1+1.0).plus(-1.0)=
-1.0*X^1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-5.0*X^5+3.0*X^3-1.0*X^1)=
-10.0*X^5+6.0*X^3-2.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-10.0*X^5+6.0*X^3-2.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).plus(0.0)=
-5.0*X^5+3.0*X^3-1.0*X^1

(0.0).plus(null)=
null

(0.0).plus(-1.0)=
-1.0

(0.0).plus(0.0)=
0.0

(0.0).plus(1.0)=
1.0

(0.0).plus(-1.0*X^1+1.0)=
-1.0*X^1+1.0

(0.0).plus(2.0*X^2-1.0*X^1+1.0)=
2.0*X^2-1.0*X^1+1.0

(0.0).plus(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
-3.0*X^3+2.0*X^2-1.0*X^1+1.0

(0.0).plus(4.0*X^4-2.0*X^2+1.0)=
4.0*X^4-2.0*X^2+1.0

(0.0).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1

(0.0).plus(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1

(0.0).plus(0.0)=
0.0

(-1.0).powerMax()=0

(0.0).powerMax()=0

(1.0).powerMax()=0

(-1.0*X^1+1.0).powerMax()=1

(2.0*X^2-1.0*X^1+1.0).powerMax()=2

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).powerMax()=3

(4.0*X^4-2.0*X^2+1.0).powerMax()=4

(-5.0*X^5+3.0*X^3-1.0*X^1).powerMax()=5

(-5.0*X^5+3.0*X^3-1.0*X^1).powerMax()=5

(0.0).powerMax()=0

(-1.0).powerMin()=0

(0.0).powerMin()=0

(1.0).powerMin()=0

(-1.0*X^1+1.0).powerMin()=0

(2.0*X^2-1.0*X^1+1.0).powerMin()=0

(-3.0*X^3+2.0*X^2-1.0*X^1+1.0).powerMin()=0

(4.0*X^4-2.0*X^2+1.0).powerMin()=0

(-5.0*X^5+3.0*X^3-1.0*X^1).powerMin()=1

(-5.0*X^5+3.0*X^3-1.0*X^1).powerMin()=1

(0.0).powerMin()=0

(-1.0).times(null)=
null

(-1.0).times(-1.0)=
1.0

(-1.0).times(0.0)=
0.0

(-1.0).times(1.0)=
-1.0

(-1.0).times(-1.0*X^1+1.0)=
1.0*X^1-1.0

(-1.0).times(2.0*X^2-1.0*X^1+1.0)=
-2.0*X^2+1.0*X^1-1.0

(-1.0).times(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
3.0*X^3-2.0*X^2+1.0*X^1-1.0

(-1.0).times(4.0*X^4-2.0*X^2+1.0)=
-4.0*X^4+2.0*X^2-1.0

(-1.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1

(-1.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^5-3.0*X^3+1.0*X^1

(-1.0).times(0.0)=
0.0

(0.0).times(null)=
null

(0.0).times(-1.0)=
0.0

(0.0).times(0.0)=
0.0

(0.0).times(1.0)=
0.0

(0.0).times(-1.0*X^1+1.0)=
0.0

(0.0).times(2.0*X^2-1.0*X^1+1.0)=
0.0

(0.0).times(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
0.0

(0.0).times(4.0*X^4-2.0*X^2+1.0)=
0.0

(0.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(0.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(0.0).times(0.0)=
0.0

(1.0).times(null)=
null

(1.0).times(-1.0)=
-1.0

(1.0).times(0.0)=
0.0

(1.0).times(1.0)=
1.0

(1.0).times(-1.0*X^1+1.0)=
-1.0*X^1+1.0

(1.0).times(2.0*X^2-1.0*X^1+1.0)=
2.0*X^2-1.0*X^1+1.0

(1.0).times(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
-3.0*X^3+2.0*X^2-1.0*X^1+1.0

(1.0).times(4.0*X^4-2.0*X^2+1.0)=
4.0*X^4-2.0*X^2+1.0

(1.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1

(1.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
-5.0*X^5+3.0*X^3-1.0*X^1

(1.0).times(0.0)=
0.0

(-1.0*X^1+1.0).times(null)=
null

(-1.0*X^1+1.0).times(-1.0)=
1.0*X^1-1.0

(-1.0*X^1+1.0).times(0.0)=
0.0

(-1.0*X^1+1.0).times(1.0)=
-1.0*X^1+1.0

(-1.0*X^1+1.0).times(-1.0*X^1+1.0)=
1.0*X^2-2.0*X^1+1.0

(-1.0*X^1+1.0).times(2.0*X^2-1.0*X^1+1.0)=
-2.0*X^3+3.0*X^2-2.0*X^1+1.0

(-1.0*X^1+1.0).times(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
3.0*X^4-5.0*X^3+3.0*X^2-2.0*X^1+1.0

(-1.0*X^1+1.0).times(4.0*X^4-2.0*X^2+1.0)=
-4.0*X^5+4.0*X^4+2.0*X^3-2.0*X^2-1.0*X^1+1.0

(-1.0*X^1+1.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^6-5.0*X^5-3.0*X^4+3.0*X^3+1.0*X^2-1.0*X^1

(-1.0*X^1+1.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
5.0*X^6-5.0*X^5-3.0*X^4+3.0*X^3+1.0*X^2-1.0*X^1

(-1.0*X^1+1.0).times(0.0)=
0.0

(2.0*X^2-1.0*X^1+1.0).times(null)=
null

(2.0*X^2-1.0*X^1+1.0).times(-1.0)=
-2.0*X^2+1.0*X^1-1.0

(2.0*X^2-1.0*X^1+1.0).times(0.0)=
0.0

(2.0*X^2-1.0*X^1+1.0).times(1.0)=
2.0*X^2-1.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).times(-1.0*X^1+1.0)=
-2.0*X^3+3.0*X^2-2.0*X^1+1.0

(2.0*X^2-1.0*X^1+1.0).times(2.0*X^2-1.0*X^1+1.0)=
4.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1.0).times(0.0)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).times(null)=
null

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-1.0)=
5.0*X^5-3.0*X^3+1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(0.0)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).times(1.0)=
-5.0*X^5+3.0*X^3-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-1.0*X^1+1.0)=
5.0*X^6-5.0*X^5-3.0*X^4+3.0*X^3+1.0*X^2-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(2.0*X^2-1.0*X^1+1.0)=
-10.0*X^7+5.0*X^6+1.0*X^5-3.0*X^4+1.0*X^3+1.0*X^2-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
15.0*X^8-10.0*X^7-4.0*X^6+1.0*X^5+1.0*X^3+1.0*X^2-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(4.0*X^4-2.0*X^2+1.0)=
-20.0*X^9+22.0*X^7-15.0*X^5+5.0*X^3-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
25.0*X^10-30.0*X^8+19.0*X^6-6.0*X^4+1.0*X^2

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
25.0*X^10-30.0*X^8+19.0*X^6-6.0*X^4+1.0*X^2

(-5.0*X^5+3.0*X^3-1.0*X^1).times(0.0)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).times(null)=
null

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-1.0)=
5.0*X^5-3.0*X^3+1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(0.0)=
0.0

(-5.0*X^5+3.0*X^3-1.0*X^1).times(1.0)=
-5.0*X^5+3.0*X^3-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-1.0*X^1+1.0)=
5.0*X^6-5.0*X^5-3.0*X^4+3.0*X^3+1.0*X^2-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(2.0*X^2-1.0*X^1+1.0)=
-10.0*X^7+5.0*X^6+1.0*X^5-3.0*X^4+1.0*X^3+1.0*X^2-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
15.0*X^8-10.0*X^7-4.0*X^6+1.0*X^5+1.0*X^3+1.0*X^2-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(4.0*X^4-2.0*X^2+1.0)=
-20.0*X^9+22.0*X^7-15.0*X^5+5.0*X^3-1.0*X^1

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
25.0*X^10-30.0*X^8+19.0*X^6-6.0*X^4+1.0*X^2

(-5.0*X^5+3.0*X^3-1.0*X^1).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
25.0*X^10-30.0*X^8+19.0*X^6-6.0*X^4+1.0*X^2

(-5.0*X^5+3.0*X^3-1.0*X^1).times(0.0)=
0.0

(0.0).times(null)=
null

(0.0).times(-1.0)=
0.0

(0.0).times(0.0)=
0.0

(0.0).times(1.0)=
0.0

(0.0).times(-1.0*X^1+1.0)=
0.0

(0.0).times(2.0*X^2-1.0*X^1+1.0)=
0.0

(0.0).times(-3.0*X^3+2.0*X^2-1.0*X^1+1.0)=
0.0

(0.0).times(4.0*X^4-2.0*X^2+1.0)=
0.0

(0.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(0.0).times(-5.0*X^5+3.0*X^3-1.0*X^1)=
0.0

(0.0).times(0.0)=
0.0



Ok well so far I've been trying to get the divide method to work, at the present I have got it to give me mostly right answers but a few of my answers look as if they are around the wrong way. If you compare my output with the expected output.

I am not sure what the problem is with the divide method, I've tired a number of loops etc.

I dont know if I am missing a step when it comes to working out the polynomial or if there is something missing from my code.

my code is suppose to follow this:-

Quote

Method 4: divideBy(that)
This method validates the parameter and yields the quotient and remainder
(as a 2-array of polynomials) for the operation this(x) / that(x).
Fundamental:
Given two polynomials:
f1(x) = anxn + an-1xn-1 + an-2xn-2 + +a2x2 + a1x + a0, (an0)
f2(x) = bmxm + bm-1xm-1 + bm-2xm-2 + +b2x2 + b1x + b0. (bm0)
The divideBy(that) implements
f1(x)/ f2(x) = quotient polynomial q(x), and reminder r(x), such that
f1(x)=q(x) f2(x) +r(x)
How does it work?
The division starts with temporary set quotient q(x)=0, and reminder as r(x) =
f1(x), and then gradually calculate terms of quotient to grow q(x) and decrease
r(x). The algorithm can be briefed as:
quotient = Zero polynomial;
reminder = f1(x);
n = Maximum power of f1(x);
m= Maximum power of f2(x);
suppose bmxm is the term of highest power of f2(x);
while (n  m)
{suppose the term of the highest power of reminder is an xn ,
Set quotientTerm to
m
n
b
a xn-m ;
Set quotient to quotient + quotientTerm;
Set reminder to reminder - quotientTerm *f2(x);
Set the maximum power of polynomial reminder to n;
}
Terminate with an array containing quotient and reminder


Radx
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1