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

JSci.maths.Supernumber Maven / Gradle / Ivy

Go to download

JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software. It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ... Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).

The newest version!
package JSci.maths;

import JSci.maths.groups.AbelianGroup;
import JSci.maths.fields.Ring;

/**
* The Supernumber class encapsulates supernumbers.
* They are actually implemented as elements of the Grassmann algebra Lambda4
* rather than the full Lambdainfinity.
* @jsci.planetmath Supernumber
* @version 0.1
* @author Mark Hale
*/
public final class Supernumber implements Ring.Member {
        private final int N=4;
        private Complex body=Complex.ZERO;
        private Complex soul1[]={Complex.ZERO,Complex.ZERO,Complex.ZERO,Complex.ZERO};
        private Complex soul2[]={Complex.ZERO,Complex.ZERO,Complex.ZERO,Complex.ZERO,Complex.ZERO,Complex.ZERO};
        private Complex soul3[]={Complex.ZERO,Complex.ZERO,Complex.ZERO,Complex.ZERO};
        private Complex soul4=Complex.ZERO;
        /**
        * Constructs a supernumber.
        */
        public Supernumber() {}
        /**
        * Returns a string representing the value of this supernumber.
        */
        public String toString() {
                final StringBuffer buf=new StringBuffer(100);
                buf.append("(").append(body.toString()).append(")1+\n(");
                buf.append(soul1[0].toString()).append(", ");
                buf.append(soul1[1].toString()).append(", ");
                buf.append(soul1[2].toString()).append(", ");
                buf.append(soul1[3].toString()).append(")S1+\n(");
                buf.append(soul2[0].toString()).append(", ");
                buf.append(soul2[1].toString()).append(", ");
                buf.append(soul2[2].toString()).append(", ");
                buf.append(soul2[3].toString()).append(", ");
                buf.append(soul2[4].toString()).append(", ");
                buf.append(soul2[5].toString()).append(")S2+\n(");
                buf.append(soul3[0].toString()).append(", ");
                buf.append(soul3[1].toString()).append(", ");
                buf.append(soul3[2].toString()).append(", ");
                buf.append(soul3[3].toString()).append(")S3+\n(");
                buf.append(soul4.toString()).append(")S4");
                return buf.toString();
        }
        /**
        * Returns the body (rank 0) of this supernumber.
        */
        public Complex getBody() {
                return body;
        }
        /**
        * Sets the body (rank 0) of this supernumber.
        */
        public void setBody(final Complex b) {
                body=b;
        }
        /**
        * Returns the a-number soul (rank 1) of this supernumber.
        */
        public Complex getSoul1(final int i) {
                return soul1[i];
        }
        /**
        * Sets the a-number soul (rank 1) of this supernumber.
        */
        public void setSoul1(final int i,final Complex s) {
                soul1[i]=s;
        }
        /**
        * Returns the c-number soul (rank 2) of this supernumber.
        */
        public Complex getSoul2(final int i) {
                return soul2[i];
        }
        /**
        * Sets the c-number soul (rank 2) of this supernumber.
        */
        public void setSoul2(final int i,final Complex s) {
                soul2[i]=s;
        }
        /**
        * Returns the a-number soul (rank 3) of this supernumber.
        */
        public Complex getSoul3(final int i) {
                return soul3[i];
        }
        /**
        * Sets the a-number soul (rank 3) of this supernumber.
        */
        public void setSoul3(final int i,final Complex s) {
                soul3[i]=s;
        }
        /**
        * Returns the c-number soul (rank 4) of this supernumber.
        */
        public Complex getSoul4() {
                return soul4;
        }
        /**
        * Sets the c-number soul (rank 4) of this supernumber.
        */
        public void setSoul4(final Complex s) {
                soul4=s;
        }
        /**
        * Returns the dimension.
        */
        public int dimension() {
                return 1<




© 2015 - 2024 Weber Informatics LLC | Privacy Policy