Introduction

What JMathTools IS

JMathTools is a collection of independent packages designed to fit common engineering/scientific computing needs. For now, JMathTools contains:

  • JMathArray: simple linear algebra for double[][] arrays using static methods
  • JMathPlot: interactive plot in 2D / 3D
  • JMathIO: binary and ASCII input/output for double arrays

JMathTools is designed to be:

  • easy to integrate in your java applications
  • easy to extend and modify

It was initially developed to provide easy to use java API in Matlab to Java porting task.

What JMathTools IS NOT

JMathTools was NOT designed to be:

  • a high performance computing engine
  • a high performance 3D visualization tool

For such things, many free Java packages are available (see Links).

JMathArray: use double[][] arrays for linear algebra

Provides a list of static methods applicable on int and double arrays:

import static org.math.array.LinearAlgebra.*;
...
  // random 4 x 4 matrix + Id
  double[][] A = plus(random(4, 4), identity(4));
		
  // Eigen values Decomposition : A = V * D * V^-1
  EigenvalueDecomposition eig = eigen(A);
  double[][] V = eig.getV();
  double[][] D = eig.getD();

JMathArray syntax is stable. Only new features may be added, and current syntax will stay available.

Download jar
Doxygen doc
Tutorial

JMathPlot: interactive 2D and 3D plots

Provides :

  • 2D/3D scatter plot
  • 2D/3D line plot
  • 2D staircase plot
  • 2D/3D histogram plot
  • 2D/3D boxplot
  • 3D grid plot
  • 2D/3D quantiles on plots
import org.math.plot.*;
...
  
  double[] x = ...
  double[] y = ...
 
  // create your PlotPanel (you can use it as a JPanel)
  Plot2DPanel plot = new Plot2DPanel();
 
  // add a line plot to the PlotPanel
  plot.addLinePlot("my plot", x, y);
 
  // put the PlotPanel in a JFrame, as a JPanel
  JFrame frame = new JFrame("a plot panel");
  frame.setContentPane(plot);
  frame.setVisible(true);

JMathPlot syntax is NOT stable. As far as possible current syntax will stay available.

Download jar
Doxygen doc
Tutorial

JMathIO: easy to use read/write classes for double[][] arrays

JMathIO allows to create, read, write, append your datas in:

import static org.math.io.files.ASCIIFile.*;
import static org.math.io.parser.ArrayString.*;
 
...
 
  double[][] b = { { 1.0, 2.0, 3.0, 4.0 }, { 11.0, 12.0, 13.0, 14.0 } };
  // write file in ASCII
  writeDoubleArray(new File("b.txt"), b);
  // read this file
  double[][] b_read = readDoubleArray(new File("b.txt"));

JMathIO syntax is considered stable. Only new features may be added, and current syntax will stay available.

Download jar
Doxygen doc
Tutorial

start.txt · Last modified: 2007/09/05 14:10 by yannrichet
Creative Commons License Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0