package edu.neu.ccs.satsolver; public class appSat { /* getPolynomial : creates a polynomial based off of * a relation Number * Returns : new Polynomial * * Based off of Ahmed's Code for relation and his * "magic" polynomial. */ public static Polynomial getPolynomial( int relationNumber ) { /* CoefficientThree is the coefficient for the * third degree (x^3) of the new polynomial */ double coefficientThree = (-1.0 * Relation.q(relationNumber,0)); coefficientThree += Relation.q(relationNumber, 1); coefficientThree += (-1.0 * Relation.q(relationNumber,2)); coefficientThree += Relation.q(relationNumber, 3); /* CoefficientTwo is the coefficient for the * second degree (x^2) of the new polynomial */ double coefficientTwo = 3 * Relation.q(relationNumber, 0); coefficientTwo += -2.0 * Relation.q(relationNumber,1); coefficientTwo += Relation.q(relationNumber, 2); /* CoefficientOne is the coefficient for the * first degree (x) of the new polynomial */ double coefficientOne = -3 * Relation.q(relationNumber,0); coefficientOne += Relation.q(relationNumber,1); /* Create the array of coefficients that will * be passed to the Polynomial constructor */ double[] coefficients = { coefficientThree, coefficientTwo, coefficientOne, Relation.q(relationNumber,0) }; return new Polynomial(coefficients); } }