csp2348-5243 data structures assignment 2: mini ...€¦ · 02/06/2013 · csp2348-5243 data...

67
Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 1 CSP2348-5243 Data Structures Assignment 2: Mini Programming Project Objectives from the Unit Outline Describe the general principles of algorithm complexity and performance; Describe the concept, application, and specification of an Abstract Data Type (ADT) and employ Java classes to encapsulate ADTs. General Information: This mini project requires you to design, implement, test and document a set of Java methods for a particular application scenario, using specific data structures to store the required information. Part of the work (e.g., Java codes) has been done, and you are requested to complete the rest. This is a group assignment. The group should have no more than two students. However, if you prefer you can opt to do it as an individual assignment. Only one submission will be required per group. Please don’t forget to include the names of your team members. Submission Due date: Monday at 09:00 am, 03 June 2013 (see unit Schedule) Value: 20% Background Information: A linked list consists of a sequence of nodes, connected by links. Each node contains a single element, together with links to one or both neighbouring nodes. The linked list is one of the most important yet easiest dynamic data structures. Many applications employ linked list to create dynamical sequential data structures. This assignment enables you to practice creating Single-Linked-List (SLL) and manipulating SLL data structures, such as SSL insertion, deletion and searching etc. These skills are important first steps in constructing higher level data structures and applications. In this assignment, you are requested to use a SLL to represent/store a polynomial and subsequently implement those traditional polynomial operations, such as polynomial addition, subtraction, multiplication, division, composition, differentiation, integrations and evaluations. The following is some preliminaries about polynomials and their operations (further information about polynomials and their operations can be found from Tutorial 05). Some preliminaries of polynomials: a) A real polynomial p in a variable x is defined for known coefficients c i : i = 0, 1, 2, … n, as p n (x) = c n x n + c n-1 x n-1 + c n-2 x n-2 + … +c 2 x 2 + c 1 x + c 0 x 0 , (c n 0 if n>0) where c i is a constant real number (i = 0, 1, 2, …, n), and x is a real variable (x 0 is defined as 1), and c n 0 if n>0. Practically, if n i c i 0 : 2 52 , that particular c i is reset to 0

Upload: ngoque

Post on 27-May-2018

229 views

Category:

Documents


1 download

TRANSCRIPT

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 1

CSP2348-5243 Data Structures

Assignment 2: Mini Programming Project

Objectives from the Unit Outline

Describe the general principles of algorithm complexity and performance;

Describe the concept, application, and specification of an Abstract Data Type (ADT)

and employ Java classes to encapsulate ADTs.

General Information:

This mini project requires you to design, implement, test and document a set of Java

methods for a particular application scenario, using specific data structures to store the

required information. Part of the work (e.g., Java codes) has been done, and you are

requested to complete the rest.

This is a group assignment. The group should have no more than two students.

However, if you prefer you can opt to do it as an individual assignment.

Only one submission will be required per group. Please don’t forget to include the

names of your team members.

Submission Due date:

Monday at 09:00 am, 03 June 2013 (see unit Schedule)

Value: 20%

Background Information:

A linked list consists of a sequence of nodes, connected by links. Each node contains a single

element, together with links to one or both neighbouring nodes. The linked list is one of the most

important yet easiest dynamic data structures. Many applications employ linked list to create

dynamical sequential data structures.

This assignment enables you to practice creating Single-Linked-List (SLL) and manipulating SLL

data structures, such as SSL insertion, deletion and searching etc. These skills are important first

steps in constructing higher level data structures and applications.

In this assignment, you are requested to use a SLL to represent/store a polynomial and

subsequently implement those traditional polynomial operations, such as polynomial addition,

subtraction, multiplication, division, composition, differentiation, integrations and evaluations.

The following is some preliminaries about polynomials and their operations (further information

about polynomials and their operations can be found from Tutorial 05).

Some preliminaries of polynomials:

a) A real polynomial p in a variable x is defined for known coefficients ci: i = 0, 1, 2, … n, as

pn(x) = cn xn + cn-1 x

n-1 + cn-2 x

n-2 + … +c2 x

2 + c1 x + c0 x

0, (cn0 if n>0)

where ci is a constant real number (i = 0, 1, 2, …, n), and x is a real variable (x0 is defined as

1), and cn 0 if n>0. Practically, if nici 0:2 52 , that particular ci is reset to 0

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 2

and may not be stored. Some examples of polynomials are as blows (note: means “is defined

as”):

p0(x) -1 (i.e., n=0, c0 = -1)

q0(x) 0 (i.e., n=0, c0 = 0)

r0(x) +1 (i.e., n=0, c0 = +1)

p1(x) -x+1 (i.e., n=1, c1 = -1, c0 = +1)

p2(x) 2x2 -x+1 (i.e., n=2, c2 = 2, c1 = -1, c0 = +1)

p3(x) -3x3 +2x

2 -x+1 (i.e., n=3, c3 = -3, c2 = +2, c1 = -1, c0 = +1)

p4(x) 4x4 - 2x

2 +1 (i.e., n=4, c4 = 4, c2 = -2, c0 = +1, and, implicitly c3 = c1 =

0)

p5(x) -5x5 +3x

3 - x (i.e., n=5, c5 = -5, c3 = +3, c1 = -1, and, implicitly c4 = c2 =

c0 = 0)

b) Some polynomial operations:

Addition: e.g., p5(x)+ p4(x) = (-5x5 +3x

3 - x)+( 4x

4 - 2x

2 +1 ) = -5x

5 +4x

4 +3x

3 -2x

2- x

+1

subtraction: e.g., p5(x) - p4(x) = (-5x5 +3x

3 - x) - ( 4x

4 - 2x

2 +1 ) = -5x

5 -4x

4 +3x

3 +2x

2+

x -1

multiplication: e.g., p5(x) p4(x) (-5x5 +3x

3 - x) ( 4x

4 - 2x

2 +1 ) =-20x

9 + 22x

7 -15x

5

+5x3- x

division: e.g., p5(x)÷ p4(x) = (-5x5 +3x

3 - x) ÷ ( 4x

4 - 2x

2 +1 ) = x

4

5 (quotient), with a

remainder of xx4

1

2

1 3

differentiation: e.g., 1925 24

5 xxxpdx

d

integration: e.g., 246

52

1

4

3

6

5xxxdxxp

composition: e.g., p5(p4(x)) =-5(p4(x))5 +3(p4(x))

3 - (p4(x))

= -5(4x4 - 2x

2 +1 )

5+3(4x

4 - 2x

2 +1 )

3-(4x

4 - 2x

2 +1 )

= -5120x

20 +12800x

18 - 19200x

16 +19200x

14 - 14208x

12 +

7872x10

- 3312x

8 + 1032x

6 - 232x

4 - 34x

2 - 3

evaluation p5(-2) = -5(2)5 +3(-2)

3 - (-2) = 160 – 24 + 2 = 138.

Assignment Requirements:

You are required to employ single linked lists (SLL) data structure to store polynomials. Refer to

Tutorial 05 for details on how to store polynomial using SLL. To this end, you should consider:

1. Designing, implementing, testing and documenting a Polynomial class.

The Polynomial class has been partially completed for you, namely:

a. the data structure, the constructor, and the method signatures have been given

(see Appendix 1)).

b. 13 out of the 17 methods have been implemented, which are described in

Appendix 2. You may include them as part of your mini-project solution.

c. 4 methods have been partially implemented; these four methods (or polynomial

operations) are given in the Appendix 3. You are required complete them in

Java in order to complete the implementation of the Polynomial Java class.

When you have completed the implementation of the Polynomial class, run the

PolynomialTester class (see Appendix 4) to test your Java implementation. Please do

not modified the provided PolynomialTester class. However, if you have modified it

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 3

please ensure to submit your version of the class (source code) with your Polynomial

class. As it will be required to test your implementation.

2. What you should do (for your A2 documentation):

Write a mini-project report (in Word or PDF format):

a. Design an algorithm for each of those 4 incomplete methods (write the algorithm in

pseudocode). Wherever necessary, explain your design logic;

b. Analyse each of your algorithms in terms of Big-O notation, whenever possible;

c. Organize your project report in a structured manner. In a single compressed

(zipped) file submit your report together with your source code of your

implemented.

Implement the Polynomial class in Java:

a. Convert all the 4 algorithms (i.e., the pseudocode) into the above mentioned Java

methods. In your Java source ensure where possible to include Java comments to

document your design and/or provide relevant explanations;

Test your Polynomial class using the provided Java PolynomialTester class (provided

on BB):

o Run the tester class and ensure that the tester outputs for each method is/are as

specified in the PolynomialTesterOutput.txt file; The latter can be found on

Blackboard, as a part of supporting document for this assignment.

Submission Instructions

You are required to submit your Assignment 2 via Blackboard electronic assessment

submission facility. For a detailed assessment submission procedure, please refer to

“How to submit your Assignment online” item in the Assessment section of this unit

website.

Your submission should include the assignment main report including your Java

classes’ source code. The main assignment document must be in report style, in Word

(or PDF) format, pages must be numbered.

Your Java source code file (e.g., Polynomial.java) must compile and run with the

provided PolynomialTester class. The output of your implementation should conform to

the output model specified in the provided polynomial-tester-output.txt file.

Your submission should be in a single compressed file (.zip), which contains your main

report and Java source code. Please name the zip file as follow <your Student ID>_<

your full name>_A2_<unit_code>.zip.

Remember to keep the copy of your assignment.

Note:

Your attention is drawn to the University rules governing cheating and referencing. In

general, cheating is the inclusion of the unacknowledged work of another person.

Plagiarism (presenting other people's work and ideas as your own) will result in a zero

mark.

University rules/policies will apply for late submission of the assignment.

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 4

Indicative Marking Guide:

Total Marks

(100%)

Algorithm & Analysis 20

Algorithm/Pseudocode

Analysis in Big-O notation

Java codes 40

add(…) method

differentiate() method

integrate() method

times() method

Explanation of design

Full implementation

Output matches that in "polynomial-tester-output.txt" 10

Programming Style 10

Code readability

Documentation 10

Overall 10

Total (%) 100

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 5

Appendices

Appendix 1: The polynomial data structure, the constructor, and the method signatures.

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 & explanations

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

*/

final static private void add(Polynomial polynomial,

double coefficient,

int power) { //student’s work #1 }

final public int cardinality() { //given }

final public Polynomial clone() { //given }

final public double coefficient(int power) { //given }

final public Polynomial composite(Polynomial that) { //given }

final public int degree() { //given }

final public Polynomial differentiate() { //students #2 }

final public Polynomial[] dividedBy(Polynomial that) {//given}

final public boolean equals(Polynomial that) { //given }

final public double evaluate(double variable) { //given }

final public Polynomial integrate() { //students #3 }

final public Polynomial minus(Polynomial that) { //given }

final public Polynomial plus(Polynomial that) { //given }

final public int powerMax() { //given }

final public int powerMin() { //given }

final public Polynomial times(Polynomial that) { //students #4 }

final public String toString() { //given }

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 6

}

(a) The methods given (implemented)

o The method cardinality() 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;

}

o The method clone() 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;

}

o The method coefficient(power) 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;

}

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 7

o The method degree() yields the degree (highest power) of this

polynomial.

final public int degree()

{ return this.power;

}

o The method equals(that) 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);

}

o The method minus(that) 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;

}

o The method plus(that) yields a hard-copy of the result of this

polynomial add 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;

}

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 8

while (traverser!=null);

return result;

}

o The method powerMax()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;

}

o The method powerMin()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;

}

o The method toString()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;

}

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 9

o The method composite(that) yields the polynomial result for the operation

this(that(x)).

final public Polynomial composite(Polynomial that)

{ if (that==null) return null;

if (this.power==0) return this.clone();

Polynomial result=new Polynomial(0.0,0);

if (that.power==0)

{ result.coefficient=this.evaluate(that.coefficient);

return result;

}

Polynomial traverser=this;

do

{ if (traverser.power==0)

{ add(result,traverser.coefficient,0);

break;

}

Polynomial temp=that;

for (int i=1; i<traverser.power; i++)

temp=temp.times(that);

do

{ add(result,traverser.coefficient*temp.coefficient,temp.power);

temp=temp.successor;

}

while(temp!=null);

traverser=traverser.successor;

}

while (traverser!=null);

return result;

}

o The method dividedBy(that) validates the parameter and yields the

quotient and the remainder (as a 2-array of polynomials) for the operation

xthatxthis .

final public Polynomial[] dividedBy(Polynomial that)

{ if (that==null) return null;

if (that.coefficient==0.0) return null;

Polynomial quotient=new Polynomial(0.0,0);

Polynomial remainder=this.clone();

while (remainder.power>=that.power){

Polynomial temp=new Polynomial(0.0,0);

temp.coefficient=remainder.coefficient/that.coefficient;

temp.power=remainder.power-that.power;

add(quotient,temp.coefficient,temp.power);

remainder=remainder.minus(that.times(temp));

if (remainder.coefficient==0.0) break;

}

Polynomial[] result=new Polynomial[2];

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 10

result[0]=quotient;

result[1]=remainder;

return result;

}

o The method evaluate(variable) validates the parameter and yields the

double result for the operation variablethis .

final public double evaluate(double variable)

{ if (Double.isNaN(variable)) variable=0.0;

if (Math.abs(variable)<epsilon) variable=0.0;

double value=0.0;

Polynomial traverser=this;

do

{ value+=traverser.coefficient*Math.pow(variable,traverser.power);

traverser=traverser.successor;

}

while (traverser!=null);

return value;

}

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 11

Appendix 2: The 4 methods to be completed by students

o The method add(polynomial,coefficient,power)validates the

parameters before changing the state of polynomial to reflect the addition of

the term powerxtcoefficien .

final static private void add(Polynomial polynomial, double coefficient,

int power) {

if (polynomial==null) return;

if (Math.abs(coefficient)<epsilon) coefficient=0.0;

if (coefficient==0.0) return;

if (power<0) return;

//••• more to add here •••

}

o The method differentiate()yields the polynomial result for the

operation xthisdx

d

final public Polynomial differentiate()

{ if (this.power==0) return new Polynomial(0.0,0);

//••• more to add here •••

}

o The method integrate()yields the polynomial result for the operation

dxxthis .

final public Polynomial integrate()

{ if (this.coefficient==0.0) return new Polynomial(0.0,0);

Polynomial result=this.clone();

//••• more to add here •••

return result;

}

o The method times(that) validates the parameter and yields the

polynomial result for the operation xthatxthis .

final public Polynomial times(Polynomial that)

{ if (that==null) return null;

Polynomial result=new Polynomial(0.0,0);

//••• more to add here •••

return result;

}

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 12

Appendix 3: The polynomial tester (used to test your completed work).

abstract class PolynomialTester

{ 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};

static void main()

{ 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"+

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 13

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;

Polynomial[] result=polynomials[i].dividedBy(polynomials[9]);

System.out.println("\n("+polynomials[i]+").dividedBy("+

polynomials[9]+"):"+

(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]));

}

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 14

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 15

Appendix 4: tester

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 16

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 17

(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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 18

(-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)=

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 19

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-

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 20

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 21

(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-

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 22

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 23

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 24

(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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 25

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

quotient=0.0

remainder=-1.0

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 26

quotient=0.0

remainder=0.0

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

quotient=0.0

remainder=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

(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

(-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

(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

(-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

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

quotient=0.0

remainder=0.0

(-1.0).equals(null)=

false

(-1.0).equals(-1.0)=

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 27

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 28

(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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 29

(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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 30

(-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)=

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 31

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 32

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 33

(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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 34

(-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)=

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 35

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 36

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 37

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 38

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 39

(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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 40

(-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)=

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 41

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 42

(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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 43

(-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.0*X^2-1.0*X^1+1.0).minus(1.0)=

2.0*X^2-1.0*X^1

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

2.0*X^2

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

0.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+4.0*X^2-1.0*X^1

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 44

(2.0*X^2-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+2.0*X^2+1.0

(2.0*X^2-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+2.0*X^2+1.0

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

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(null)=

null

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

-3.0*X^3+2.0*X^2-1.0*X^1+2.0

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

-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(1.0)=

-3.0*X^3+2.0*X^2-1.0*X^1

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

-3.0*X^3+2.0*X^2

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

-3.0*X^3

(-3.0*X^3+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)=

0.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-3.0*X^3+4.0*X^2-1.0*X^1

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

5.0*X^5-6.0*X^3+2.0*X^2+1.0

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 45

5.0*X^5-6.0*X^3+2.0*X^2+1.0

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

-3.0*X^3+2.0*X^2-1.0*X^1+1.0

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

null

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

4.0*X^4-2.0*X^2+2.0

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

4.0*X^4-2.0*X^2+1.0

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

4.0*X^4-2.0*X^2

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

4.0*X^4-2.0*X^2+1.0*X^1

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

4.0*X^4-4.0*X^2+1.0*X^1

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

4.0*X^4+3.0*X^3-4.0*X^2+1.0*X^1

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

0.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+4.0*X^4-3.0*X^3-2.0*X^2+1.0*X^1+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+4.0*X^4-3.0*X^3-2.0*X^2+1.0*X^1+1.0

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

4.0*X^4-2.0*X^2+1.0

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 46

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

null

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

-5.0*X^5+3.0*X^3-1.0*X^1+1.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

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

-5.0*X^5+3.0*X^3-1.0*X^1-1.0

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

-5.0*X^5+3.0*X^3-1.0

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

-5.0*X^5+3.0*X^3-2.0*X^2-1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).minus(-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

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

null

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 47

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

-5.0*X^5+3.0*X^3-1.0*X^1+1.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

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

-5.0*X^5+3.0*X^3-1.0*X^1-1.0

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

-5.0*X^5+3.0*X^3-1.0

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

-5.0*X^5+3.0*X^3-2.0*X^2-1.0

(-5.0*X^5+3.0*X^3-1.0*X^1).minus(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 48

(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)=

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 49

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 50

(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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 51

(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

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

-1.0*X^1+1.0

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

-1.0*X^1+2.0

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

-2.0*X^1+2.0

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

2.0*X^2-2.0*X^1+2.0

(-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-2.0*X^1+2.0

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 52

(-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*X^1+2.0

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

-5.0*X^5+3.0*X^3-2.0*X^1+1.0

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

-5.0*X^5+3.0*X^3-2.0*X^1+1.0

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

-1.0*X^1+1.0

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

null

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

2.0*X^2-1.0*X^1

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

2.0*X^2-1.0*X^1+1.0

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

2.0*X^2-1.0*X^1+2.0

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

2.0*X^2-2.0*X^1+2.0

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

4.0*X^2-2.0*X^1+2.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+4.0*X^2-2.0*X^1+2.0

(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-1.0*X^1+2.0

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 53

-5.0*X^5+3.0*X^3+2.0*X^2-2.0*X^1+1.0

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

-5.0*X^5+3.0*X^3+2.0*X^2-2.0*X^1+1.0

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

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(null)=

null

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

-3.0*X^3+2.0*X^2-1.0*X^1

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

-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(1.0)=

-3.0*X^3+2.0*X^2-1.0*X^1+2.0

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

-3.0*X^3+2.0*X^2-2.0*X^1+2.0

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

-3.0*X^3+4.0*X^2-2.0*X^1+2.0

(-3.0*X^3+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)=

-6.0*X^3+4.0*X^2-2.0*X^1+2.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-3.0*X^3-1.0*X^1+2.0

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

-5.0*X^5+2.0*X^2-2.0*X^1+1.0

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

-5.0*X^5+2.0*X^2-2.0*X^1+1.0

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 54

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

-3.0*X^3+2.0*X^2-1.0*X^1+1.0

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

null

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

4.0*X^4-2.0*X^2

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

4.0*X^4-2.0*X^2+1.0

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

4.0*X^4-2.0*X^2+2.0

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

4.0*X^4-2.0*X^2-1.0*X^1+2.0

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

4.0*X^4-1.0*X^1+2.0

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

4.0*X^4-3.0*X^3-1.0*X^1+2.0

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

8.0*X^4-4.0*X^2+2.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+4.0*X^4+3.0*X^3-2.0*X^2-1.0*X^1+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+4.0*X^4+3.0*X^3-2.0*X^2-1.0*X^1+1.0

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

4.0*X^4-2.0*X^2+1.0

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 55

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

null

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

-5.0*X^5+3.0*X^3-1.0*X^1-1.0

(-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

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

-5.0*X^5+3.0*X^3-1.0*X^1+1.0

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

-5.0*X^5+3.0*X^3-2.0*X^1+1.0

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

-5.0*X^5+3.0*X^3+2.0*X^2-2.0*X^1+1.0

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

-5.0*X^5+2.0*X^2-2.0*X^1+1.0

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

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

null

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 56

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

-5.0*X^5+3.0*X^3-1.0*X^1-1.0

(-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

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

-5.0*X^5+3.0*X^3-1.0*X^1+1.0

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

-5.0*X^5+3.0*X^3-2.0*X^1+1.0

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

-5.0*X^5+3.0*X^3+2.0*X^2-2.0*X^1+1.0

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

-5.0*X^5+2.0*X^2-2.0*X^1+1.0

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 57

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 58

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 59

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 60

(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)=

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 61

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 62

(-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.0*X^4-4.0*X^3+5.0*X^2-2.0*X^1+1.0

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 63

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

-6.0*X^5+7.0*X^4-7.0*X^3+5.0*X^2-2.0*X^1+1.0

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

8.0*X^6-4.0*X^5+2.0*X^3-1.0*X^1+1.0

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

-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

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

-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

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

0.0

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

null

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

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).times(0.0)=

0.0

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

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

3.0*X^4-5.0*X^3+3.0*X^2-2.0*X^1+1.0

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

-6.0*X^5+7.0*X^4-7.0*X^3+5.0*X^2-2.0*X^1+1.0

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

9.0*X^6-12.0*X^5+10.0*X^4-10.0*X^3+5.0*X^2-2.0*X^1+1.0

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 64

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

-12.0*X^7+8.0*X^6+2.0*X^5-1.0*X^3-1.0*X^1+1.0

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

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

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

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

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

0.0

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

null

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

-4.0*X^4+2.0*X^2-1.0

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

0.0

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

4.0*X^4-2.0*X^2+1.0

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

-4.0*X^5+4.0*X^4+2.0*X^3-2.0*X^2-1.0*X^1+1.0

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

8.0*X^6-4.0*X^5+2.0*X^3-1.0*X^1+1.0

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

-12.0*X^7+8.0*X^6+2.0*X^5-1.0*X^3-1.0*X^1+1.0

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

16.0*X^8-16.0*X^6+12.0*X^4-4.0*X^2+1.0

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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 65

-20.0*X^9+22.0*X^7-15.0*X^5+5.0*X^3-1.0*X^1

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

-20.0*X^9+22.0*X^7-15.0*X^5+5.0*X^3-1.0*X^1

(4.0*X^4-2.0*X^2+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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 66

(-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

Unit: CSP2348-5243, Assignment: 2, Due date: Monday 3 June 2013 at 09:00am. Page 67

(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