Getting Started

Java

1. Setting up Java environment

If you are new to Java and you are interested in learning Java, I encourage you to use the Java Tutorial or get your hands on the book titled, The Java Programming Language, 4th Ed., by Arnold, Gosling and Holmes. You may use command line and a simple editor to edit your java codes but for any serious work you probably need an Interactive Development Environment (IDE). Here, we will use the free IDE called Netbeans and will go through the process of setting up Netbeans here:

    • Download and install the software bundle, which contains Java JDK and Netbeans (current version: JDK 6 Update 22 with NetBeans 6.9.1).
    • Open Netbeans and you will see the IDE similar to the picture shown below:
    • Create a project by click on the "File" menu on the top left corner and select "New Project ...", and a new dialog box such as the one shown below will pop up and you may simply click "Next".
    • You will be asked to name your project. In thee example shown below, we named the project "MyVeryFirstJava". Please uncheck all the options and click "Finish". (Remember the Project Location, which will be needed later)
    • The Projects window will show a new project called MyVeryFirstJava. Under MyVeryFirstJava, there are four folders, Source Packages, Test Packages, Libraries and Test Libraries.
    • To create a new Java class, move the mouse cursor to the "<default package>" of the Source Packages and right click (click the right button) to select "New" and click on "Java Class".
    • You will be asked to name your Java class. Name it and click "Finish". In this example, we named it "HISPEEDJava".
    • "HISPEEDJava.java" will be created and placed in the <default package> and its content will be shown by the editor on the right.
    • The HISPEEDJava class does not any data (fields) or methods. In order to be executable, a Java class needs the method called "main". The main method has a very specific signature, i.e., "public static void main (String[] args)". Please add the print statement as shown below to test our first Java program.
    • Make the left and right braces match and the print statement, " System.out.println("Hello World"); " is placed within the main method. Then, place the mouse cursor anywhere on the source file and right click and select "Run File". The output window will show the desired result!
    • Congratulations! You have successfully run your first Java program.

2. Importing HI-SPEED Jar file

We will continue to use the Java class created previously to illustrate the following procedures for importing HI-SPEED jar file and the classes within the Jar file.

  • First, move the cursor to the "Libraries" folder under the Projects window, right click and select "Add Jar/Folder".
    • A dialog box will pop up and ask you to find the jar file.
    • Once you have found the hispeed.jar click "Open". Now, you will see hispeed.jar under the "Libraries" folder.
    • To use any of the functionalities of HI-SPEED in your Java classes, you need to import the HI-SPEED classes to your class, which we will discuss next.

3. Importing HI-SPEED classes

For example, we showed here a simple example to call the modified Bessel function of the first kind of zeroth order.

    • First, we place the "import" statement on the very top of the class file outside of the Java class itself, see the picture below. Here, we imported the SpecialFunction class from HI-SPEED software packets.
    • Second, we will use the print method "System.out.println();" to print out the result of the value of the modified Bessel function of the first kind of zeroth order,i.e. N=0, evaluated at 1.01, i.e., x=1.01 .
    • The specific statement is this: System.out.println(SpecialFunction.besselI(N, x));
    • As you can see, the result shown in the output window is 1.2717525859257404. For these specific values, Mathematica produced the value of 1.2717525859257406.

In the meantime, you should be able to use most of the classes in HI-SPEED by going through the Java documentation and please feel free to drop me a line if you run into problems. I will add specfic and non-trivial examples in the future.

How-To Example 001: Using Nelder-Mead Simplex Method ( cgk.FastGeneralSimplex class ) to solve a simple multivariable optimization problem.

Mathematica

Please refer to SampleTest.nb and the User Guide in the archived package.

Matlab

Please refer to SampleTest.m and the User Guide in the archived package.