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

JSci.maths.chaos.StandardMap 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.chaos;

import JSci.maths.*;

/**
* The StandardMap class provides an object that encapsulates the Standard map.
* xn+1 = (xn + yn+1) mod 2pi
* yn+1 = (yn + k sin(xn)) mod 2pi
* (Chirikov, Taylor).
* @version 1.0
* @author Mark Hale
*/
public final class StandardMap extends Object implements MappingND {
        private final double k;
        /**
        * Constructs a Standard map.
        * @param kval the value of the k parameter
        */
        public StandardMap(double kval) {
                k=kval;
        }
        /**
        * Performs the mapping.
        * @param x a 2-D double array
        * @return a 2-D double array
        */
        public double[] map(double x[]) {
                double ans[]=new double[2];
                ans[1]=(x[1]+k*Math.sin(x[0]))%NumericalConstants.TWO_PI;
                ans[0]=(x[0]+ans[1])%NumericalConstants.TWO_PI;
                return ans;
        }
        /**
        * Iterates the map.
        * @param n the number of iterations
        * @param x the initial values (2-D)
        * @return a 2-D double array
        */
        public double[] iterate(int n,double x[]) {
                double xn[]=map(x);
                for(int i=1;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy