You are a guest. Restricted access. Read more.
Command disabled: backlink

Using Matlab syntax

You can use AWork to perform the following calculations:

  • Symbolic calculations (simplification, differentials, integration)
  • Numeric calculations evaluations of mathematical functions designed to be used in evaluating complex expressions
  • Evaluations of mathematical functions, special functions
  • Linear algebra with vectors and matrices
  • Plotting data and functions, saving data (vectors and matrices) in files
  • Random numbers
  • Basic statistics
  • Solving linear and non-linear equations and systems of equations

You can write programs in Octave (Matlab) language and run them using the “run” button. If your code does not contain “import” statement (as for BeanShell), the program will be recognized as symbolic calculations and will execute it. Look at the output using the “Output” button.

AWork uses the the computational core from the jMathLab desktop/server application. So you may try jMathLab first on your computer (use the JavaWeb start without installation)

Tutorials

Symbolic calculations are based on jMathLab package and use Matlab/Octave language. jMathLab is a derivative of the Jasymca program, but contains additional packages to bring it closer to Matlab and Octave programs.

You can learn about it using the jLearn tutorial. Note: Java is required to run interactive examples. You can find a reference manual for all implemented functions and methods of jMathLab using this link.

Getting started

Type the following code example:

To output text, use disp method (as in Octave)

disp("Text");

And press “run”. Look at the output pressing “Output”.

You can also print any variable as:

x=log(200);
printf('Answer=%f',x)

You should save your code with the extension ”.m”, since the syntax matches to Octave/Matlab. Read more details in Octave-mode section.

Let us give another example: symbolic integration. The code is shown here.

syms x;
y=(x^3+2*x^2-x+1)/((x+i)*(x-i)*(x+3))
ans=integrate(y,x)
printf('ans=%f',ans)

It prints the answer in the “Output window”.

One can also plot data in the usual way using the “plot” command. It should be noted that not-all plotting feature are not available yet, but most of them are already available.

Here is a small example:

x=0.01:0.01:50; y=1./(1+0.5*x.*x);
plot(x,y);

Pres “run” and then “graph”. You will see the output:

Similarly, one can plot functions:

x=-10:0.1:10;
plot(x,cos(x));
plot(x,sin(x));

this code plots cos(x) function with the step 0.1, and then overlays the function sin(x).

Further links to read

Sergei Chekanov 2012/07/16 14:50

Navigation

Print/export