Java API By Example, From Geeks To Geeks.

# Java > Open Source Codes > org > lsmp > djep > groupJep > values > AlgebraicExtensionElement

 `1 /* @author rich2  * Created on 09-Mar-20043  *4  * This code is covered by a Creative Commons5  * Attribution, Non Commercial, Share Alike license6  * License7  */8 package org.lsmp.djep.groupJep.values;9 10 import org.lsmp.djep.groupJep.groups.AlgebraicExtension;11 12 /**13  * An element of the algrabraic extension K(t).14  * a0 + a1 t + a(n-1) t^(n-1) 15  * where t is defined to be the the solution of a polynomial equation.16  *17  * @see AlgebraicExtension18  * @author Rich Morris19  * Created on 09-Mar-200420  */21 public class AlgebraicExtensionElement extends FreeGroupElement {22 23     AlgebraicExtension ae;24 25     /**26      * An element of the algrabraic extension K(t).27      * a0 + a1 t + a(n-1) t^(n-1) 28      * where t is defined to be the the solution of a polynomial equation.29      * If the degree of the polynomial specified by coeffs is greater30      * than n then the polynomial will be reduced by using31      * the equation t^n = ..... 32      * @param the algebraic extension.33      * @param coeffs array of coeficients for this algebraic number. c0 + c1 t + ... + cn t^n 34      */35     public AlgebraicExtensionElement(AlgebraicExtension K, Number coeffs[])36     {37         super(K,coeffs);38         this.ae = K;39         int deg_p = ae.getPoly().getDegree();40         while(this.getCoeffs().length > deg_p)41         {42             Polynomial poly2 = ae.getSubsPoly();43             int deg_c = this.getCoeffs().length-1;44             // coeffs = (a_m s^(m-n)+...+a_n) s^n + (a_(n-1) s^(n-1)+...+a_0)45 // = p1 * s^n + p2;46 // = p2 - p1 * q;47 Number p1Coeffs[] = new Number [deg_c-deg_p+1];48             Number p2Coeffs[] = new Number [deg_p];49             System.arraycopy(this.getCoeffs(),deg_p,p1Coeffs,0,deg_c-deg_p+1);50             System.arraycopy(this.getCoeffs(),0,p2Coeffs,0,deg_p);51             Polynomial p1 = new Polynomial(ae.getBaseRing(),ae.getPoly().getSymbol(),p1Coeffs);52             Polynomial p2 = new Polynomial(ae.getBaseRing(),ae.getPoly().getSymbol(),p2Coeffs);53             Polynomial p3 = p1.mul(poly2);54             Polynomial p4 = p3.add(p2);55             super.setCoeffs(p4.getCoeffs());56         }57     }58 59     /** sub classes should overright this to make the correct type. */60     protected Polynomial valueOf(Number lcoeffs[])61     {62         AlgebraicExtensionElement g = new AlgebraicExtensionElement(ae,lcoeffs);63         return g;64     }65 }66 ` Popular Tags