All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.lsmp.djep.groupJep.groups.AlgebraicExtension Maven / Gradle / Ivy

Go to download

JEP is a Java library for parsing and evaluating mathematical expressions.

There is a newer version: 2.4.2
Show newest version
/* @author rich
 * Created on 09-Mar-2004
 */
package org.lsmp.djep.groupJep.groups;
import org.lsmp.djep.groupJep.interfaces.*;
import org.lsmp.djep.groupJep.values.*;
import org.nfunk.jep.type.*;

/**
 * An Algebraic Extension of a Ring.
 * The ring generated by {1,t,...,t^n-1} where t is an algebraic number
 * i.e t is be a root of a monic polynomial equation.
 * 
 * @see AlgebraicExtensionElement
 * @author Rich Morris
 * Created on 09-Mar-2004
 */
public class AlgebraicExtension extends ExtendedFreeGroup implements RingI {

	private Polynomial poly;
	private Polynomial poly2;

	/**
	 * Create the ring K(t) where t is a solution of the monic polynomial p.
	 * 
	 * @param K the Ring this is an extension of.
	 * @param poly A monic polynomial whose solution gives an algebraic number which is used to generate this group.
	 * @throws IllegalArgumentException if the base ring of the poly is not the same.
	 * @throws IllegalArgumentException if the polynomial is not monic.
	 */
	public AlgebraicExtension(RingI K, Polynomial poly) {
		super(K,poly.getSymbol());
		this.poly = poly;
		if(baseRing != poly.getBaseRing())
			throw new IllegalArgumentException("The polynomial should be specified over the same base ring");
		// test for monic
		if(!baseRing.equals(
			poly.getCoeffs()[poly.getDegree()],
			baseRing.getONE()))
			throw new IllegalArgumentException("poly "+poly.toString()+" should be monic");
		
		// construct q = t^n - poly (deg n-1)	
		Number coeffs[] = new Number[poly.getDegree()];
		for(int i=0;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy