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

umontreal.iro.lecuyer.charts.exam.ChartTest1 Maven / Gradle / Ivy

Go to download

SSJ is a Java library for stochastic simulation, developed under the direction of Pierre L'Ecuyer, in the Département d'Informatique et de Recherche Opérationnelle (DIRO), at the Université de Montréal. It provides facilities for generating uniform and nonuniform random variates, computing different measures related to probability distributions, performing goodness-of-fit tests, applying quasi-Monte Carlo methods, collecting (elementary) statistics, and programming discrete-event simulations with both events and processes.

The newest version!
import umontreal.iro.lecuyer.charts.XYLineChart;

public class ChartTest1
{
   private static double[][] getPoints1() {
      double[][] points = new double[2][200];
      for (int i = 0; i < points[0].length; i++) {
         double x = i / 25.0;
         points[0][i] = x;
         points[1][i] = Math.sqrt (x);
      }
      return points;
   }

   private static double[][] getPoints2() {
      double[][] points = new double[2][21];
      for (int i = 0; i < points[0].length; i++) {
         double x = -Math.PI + 2 * i * Math.PI / (points[0].length - 1);
         points[0][i] = x;
         points[1][i] = Math.cos (x);
      }
      return points;
   }

   private static double[][] getPoints3() {
      double[][] points = new double[2][11];
      for (int i = 0; i < points[0].length; i++) {
         points[0][i] = -5 + i;
         points[1][i] = -3 + i;
      }
      return points;
   }

   public static void main(String[] args) {
      // Get data; data1 has length 2 and contains one array for
      // X-axis values, and one array for Y-axis values.
      double[][] data1 = getPoints1();
      double[][] data2 = getPoints2();
      double[][] data3 = getPoints3();

      // Create a new chart with the previous data series.
      XYLineChart chart = new XYLineChart(null, "X", "Y", data1, data2, data3);
      chart.toLatexFile("ChartTest1.tex", 12, 8);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy