JMathLabTutorial:1 Introduction

From jWork.ORG
Jump to: navigation, search
Limitted access. Reguest membership or login to this link first if you are already a member

jMathLab Tutorial


jMathLab is a clone of Matlab and Octave written in Java. Unlike Matlab, it's free. Unlike Octave, it is available on all platforms where Java is installed. You can also run it using the Web browser. The web page of jMathLab is [http:/ here]. From this web page you can access the reference manual for all functions included with this program (limited access for non-members).

The program is also a part of the DMelt data analysis program. Every script that is posted on this tutorial can be ran inside DMelt in the GUI or a batch mode.

How to use this tutorial

Left window is a code editor which can be used to type commands in the Matlab/Octave syntax. Press the [Run] button on the right to run these commands and to see the output. The output will be shown on the right window. You can change the divider location using the mouse. Let's get familiar with the interactive prompt. Type:


and press [Run]. You will see "message". Try to change the divider position with the mouse. This means that you can talk to the interactive shell. In fact, now you have learned how to print a string (“ok”). For example, let's print ok on different lines using "\n" as a separator:

disp('message\n message') %   comment

where "%" indicates your comment for this code. Again, press [Run]. You will see a pop-up window with the 3 lines of "ok". The reason why you got a pop-up window instead inline output, is because the text did not fit to the on-line window. You can type several commands on one line, but separated them with ";"

disp('ok'); disp('ok'); disp('ok'); % comment

You can also print numbers using formatted outputs.

printf('%f',100)  %  you can edit this command and run it

In some cases you can edit an example and run the modified code. In such cases, you will see a green border around the code. In the example below, please try to change '100' to other number and press "Run"

printf('%f',100) % you can edit this command and run it

Just to show the power of the symbolic calculations, let take definite integral of <m>x^2+x-3</m>:

syms x

If you are not a registered member, you cannot run the code and cannot see the outputs.

Version information

To determine the version of information, type "version" ([ENTER]). You will see a pop-up window which shows the version number and the build date Check this out by running this code:


Running scripts

To run a MatLab like script (with the extension "m"), use loadfile functions:


Using a standalone application

jMathLab is a part of the DataMelt project. But you can download the standalone application to work with jMathLab which is only 2MB in size. This application runs on any computer (Windows, Linux, Mac). However, you should be [a full member] of DataMelt.


The jMathLab is a derivative of two Java programs: JMathLib and Jasymca. Both are GNU-licensed thus jMathLab is also distributed under the GNU public license. Thus we fully acknowledge contributions to this project by H. Dersch (HFU Furtwangen), S.Müller and other who contributed to this project by licensing their code by GNU