iconEuler Home

Current Version 2015-11-29

Fixed a glitch in the adaptive evaluation for plot2d(). For small intervals, the result took too many points.



Version 2015-09-23

There were some changes in shrinkwindow() and fullwindow(). The windows are now actually square always, and the full window is a bit larger. The plot3d() functions now makes a bit larger and more centered plots.

This is only a tiny correction. With proper individual settings, plots can now fill more of the image.

>plot3d("x^2+y^3",>spectral,>levels,angle=-40°, ...


The plot window should now be exactly square. The plot coordinates will be square only with the >square parameter, however.



Version 2015-07-09

There was a bug in xgrid() and ygrid() which needed to be fixed.



If you like to format the grids labels yourself use xgrid(), ygrid(). The factor f can be used to avoid large numbers.

>plot2d("x^2",0.01,0.02,<ticks,grid=4); ...
 xgrid(0.01:0.001:0.02,f=0.001); ...


Version 2015-07-06

I added a new function adaptive() which adaptively evaluates a function. It works for real and complex scalars and column vectors. The similar functions adaptiveeval() and adaptiveevalone() for plotting are not changed by this new function.

>{x,y}=adaptive("sin(1/(x^2-1))",0,1-epsilon); ...


As you see when looking at the differences the step sizes vary considerably.



Here is another example, where f is vector valued.

>function f(t,a,b) := [sum(sin(t*a)*b);sum(cos(t*a)*b)]; ...
 {t,X}=adaptive({{"f",[1,3,7],[1,0.3,0.3]}},0,2pi);  ...


New Functions

There is now a function colsum(), which sums the columns of matrices.

>A=random(3,3); A_colsum(A)
     0.879396      0.982004      0.853918 
     0.872938      0.854229      0.868746 
      0.37659      0.738551       0.41701 
      2.12892       2.57478       2.13967 

Of course, this is the same as the following.

     0.879396      0.982004      0.853918 
     0.872938      0.854229      0.868746 
      0.37659      0.738551       0.41701 
      2.12892       2.57478       2.13967 

Version 2015-06-23

The xgrid() and xtick() functions have been fixed to allow labels.

>plot2d("x^3-x",-1.2,1.2,<ticks); xgrid([-1,0,1],xt=["a","b","c"]):


Using xtick(), this allows Latex formulas.

>plot2d("x^3-x",-1.2,1.2,<ticks);  ...


Version 2015-06-18

Vectors and matrices can now be declared "zerobased". This makes the indices start with 0 instead of 1.

>v=1:5; zerobase v; v[0]=v[4]
[5,  2,  3,  4,  5]

Note that linspace(a,b,n) returns n+1 values. Often, you might want to refer to these values as x[0] to x[n]. This is now possible.

>n=10; x=linspace(0,1,n); zerobase x;

The following is an upper Riemann sum for the integral of x^2 in [0,1]. The first value of x, x[0], is not used.


Note setting x to a new vector makes it restart with base 1.

>x=1:10; x[1]

Moreover, the property cannot be set inside a function to an array passed as an argument to the function. The new base 1 will only be used inside this function.

>function test (x) ...
 zerobase x; x[0]=77;

The original x is changed properly. But it will use base 1 still.

>test(x), x[1]

Assigning a zero based vector to another vector copies the flag.

>w=v; w[0]

Thus it is possible to write functions, which return zero based vectors or matrices.

>function linspace0 (a,b,n) ...
 v=linspace(a,b,n); zerobase v;
 return v;
>v=linspace(0,1,10); v[1]
>v=linspace0(0,1,10); v[0]


The function gauss() did not work with call collections. This has been fixed.

>function f(x,a) := x^a; ...

Likewise, the function adaptiveint() did have problems with call collections.



EMT now searches in the current directory first when a file is opened, an Euler file is loaded or help is searched from an Euler file. In previous versions, the existence of a file with the same name in the start directory of EMT would have prevented the user file from being used.

This of course means that the user can manipulate his installation by putting Euler files in the directory of the loaded notebook. To prevent the worst, the file "euler.cfg" now switches to the start directory of EMT to load its files.

Version 2015-06-03

The Gauss method now vectorizes the function or expression by default.

>function f(x:scalar) ...
 if x<0 then return x^2; else return x^3; endif;

Note the type check "scalar" which makes sure that f() is not abused!

The following did not work in previous versions since f() does not work for vector input. Note that integrate() uses the adaptive Gauss algorithm, which in turn uses the Gauss algorithm.

>fraction integrate("f",-1,1)

For another example, let us compute


>function map f(p:scalar; T:vector) := sum(T^p)^(1/p);

Since the function f() already vectorizes to p (but not to T because of the semicolon) we do not need to map in the Gauss method. So we turn off the vectorization.


Version 2015-04-20

I added a parameter for Latex formulas in label boxes.

>plot2d(["x^2/2","x^3"],color=[2,3]); ...
 labelbox(["\frac{x^2}{2}","x^3"],colors=[2,3], ...


There is now an option to split a line without adding "...". The keyboard shortcut for this is Shift+Control+Return.

Version 2015-04-10

This version dumps the snippets menu in favor of a menu "Tasks" which links to section of the help file explaining taks you might want to do in EMT.

The User Menu is still there and can be filled with snippets as needed. It does also contain a submenu with loaded Euler files. Calling the menu items in this submenu opens the help window with a list of definitions in the Euler file.

Version 2015-03-17

I have started a tutorial for R users on EMT. Along the way, I learn a lot about R. The tutorial is based on the "Introduction to R" which is installed with the R project on Windows as a PDF.

23 - Introduction for Users of the R Project

The command line switch "-pipe script.e" now exits EMT on any errors. It will no longer open the notebook window. Here is an example of a script in R, which dumps the command output to some file, and saves the current graphics to a PNG.

  "Integral from 0 to pi = "+integrate(expr,0,1),
  "Exact = "+(sin(1)*E),

The output is

                           x           x
                          E  sin(x) + E  cos(x)
  Integral from 0 to pi = 2.28735528718
  Exact = 2.28735528718

Version 2015-03-02

A lot more functions now accept "call collections". This term stand for a function or expression plus additional parameters in a collection. Call collections are also documented in a better way now including links in the functions that can use them.

>expr &= factor(diff(exp(-s*x^2)/(x^2+1),x))
                               2           - s x
                       2 x (s x  + s + 1) E
                     - --------------------------
                                 2     2
                               (x  + 1)




The function fmin() can now search from a single point or in an interval.


Version 2015-02-23

The new method for passing arguments with a function did not work for adaptive integration. This has been fixed.


Protected variables became unprotected if they were changed as global variables inside a function. This has been fixed. Now plot2d() works after plot2d() and a subsequent "clearall". (plot2d() changes global variables like verticallabels).

>plot2d("x^2"); clearall; plot2d("x^2");

Units in expressions can no longer be abused as simple variables. They need a number in front of them.


Version 2015-02-16

EMT now is installed with the recent version 5.35.1 of Maxima. The drawback is that LAPACK is no longer working with this version. This should not be a major problem. You can use the routines provided by the numerical part of EMT. Some missing routines from LAPACK will be added in the future.

The new version of Maxima is quite different internally. So the program is now started via the command "sbcl.exe". To make this possible, some internal things had to be changed in the code of EMT. Moreover, the Maxima version is now installed in a subdirectory "maxima", including Gnuplot.

A new tutorial with more details on Maxima has been added to the tutorials.

22 - Maxima - More Details

Version 2015-01-27

"listvars" is now possible instead of "listvar".

>x=pi; listvars
k                   4
x                   3.14159265358979
One                 global list
Two                 global list

"listvars" will also list global lists. But there is "listlists" too.

>glist("One"); glist("Two"); listlists
One                 global list
Two                 global list

Like with "listvars" it is possible to add a string.

>listlists ne
One                 global list

The function glistput(list,pos,value) now adds a value at the list position even if there was a value before. If the list is empty or the position is behind the end of the list, it appends the element to the list.

>glistput("One",1,"First"); glistadd("One","Second"); glistput("One",1,"Alt");

The function glistvar(list,pos) has been replaced by glistget(list,pos).

>for k=1 to glistlength("One"); glistget("One",k), end;


The evaluation of a string now can use units.


This is used by readTable() to read a table with units. Moreover, the expressions in the values of a table can now contain global variables.

Version 2015-01-23

EMT has now a collection type, It is in primary beta for the moment, and probably will receive more features along the way.

A collection is declared with {{...}} and can contain any objects.


Elements can be accessed like vector elements.

>loop 1 to length(L); L[#], end;

Collections are good to keep return values of functions in one place. Instead of returning multiple return values a function can return a collection.

>function f(x) := {{x,x^2}};

However, it is also possible to put the multiple results of an existing function into a collection. In the example, sort() returns the sorted vector and the indices of the sorted elements. The collection L contains both vectors.

[0.200995,  0.281887,  0.314127,  0.525,  0.655416,  0.893622]
[2,  4,  6,  5,  1,  3]

Another feature is the execution of a collection, where the first element is the name of a function or an expression.

>function f(x,a) := sin(a*x)
>L={{"f",5}}; L(pi/5)

This trick is applied in many plot functions and numerical functions now. It avoid the previous semicolon parameters.



The same works with expression. But the variables in the collection must be named in this case.



This works in many numerical functions too.



The : for insimg() has been fixed. It did not work properly after a loop and inserted the image many times.

>plot2d("sin(x)",0,2pi); ...
 for k=2 to 5; plot2d("sin(k*x)",>add,color=getspectral(k/6)); end:


Version 2014-12-20

The PDF introduction is now in a better state. There are still some things to add.

EMT allows assigned arguments only to override parameters with default values unless the argument is assigned with :=. For functions, which are designed to use a lot of assigned arguments, this can now be released with the modifier "allowassigned".

>function allowassigned f(x) := x*a

However, it is possible to declare variables with :=.

>function g(x) := x*a

Version 2014-12-10

With >best, the iterate() function now continues to itereate until the error does no longer improve.

>longest iterate("cos(x)",1,>best), longest iterate("cos(x)",1)

The problem is that iterating will take very long if the limit is 0 and >best is turned on.

>{x,count}=iterate("x/2",1,>best); longest x, count,

By the way, iterate() also works for vectors. We solve


by iteration.

>function f([x,y]) := [cos(x+y)/2,cos(y)+x^2];
>v=iterate("f",[1,1],>best); longest v, longest f(v)
     0.2558264481813221       0.777862408428445 
     0.2558264481813384      0.7778624084282351 


The code Ctrl-Back now joins the line to the previous no matter where the cursor is in that line. Of course, Ctrl-Return splits the line at the cursor.

The parameter grid=0 was not working for implicit plots.

Moreover, the style "#" did still use a black contour line for filled contour plots. This is now disabled. Use "O#" for a contour.

>fullwindow(); plot2d("(x^2+y^2-1)^3-x^2*y^3",r=1.4,level=[-2;0], ...


PDF Documentation

I updated the introduction in PDF for the recent version. The work is almost completely done. Three chapters are still missing. This will be continued.

Version 2014-11-28

The marker size is no longer global. Previously, the following code worked only for the graphics screen, but failed for the PNG export.

>function test () ...
   {v,i}=sort(-X[3]); X=X[,i];
   hold on;
   loop 1 to cols(X)
     c=1-X[3,#]/2; color(rgb(c,0,c));
   hold off;


Help for Euler Files

The help for Euler Files has been improved. Now it prints simple comment lines (//...) and comment functions via "maximafunction". Moreover, this help will open if a command line containing "load filename" is double clicked.

Second Window for EMT

With Ctrl-Shift-O a second process for EMT can be started. The second version of EMT will have no graphics window and display the graphics in its notebook window. Moreover, it will not save any settings.

This helps to look up things in a tutorial file or in any previous notebook.

Version 2014-11-05

Latex formulas now work with a changed background color now. The bar style "0" now shows the rectangle in the selected color. The SVG export of a graphics with another background color also works now.

>setcolor(0,0.9,0.9,0.9); window(100,100,950,900); ...
 plot2d("x^3-x",color=blue);  ...
 textbox(latex("y=x^3-x",color=blue,factor=1.5), ...


The function reset() now colors resetcolors(), which now correctly resets the default values of the colors.


The parameter >frame now draws a frame even if <grid is set.

>plot2d("x^3-x",<grid,>frame); xgrid(-2:2); ygrid(-6:2:6):


Version 2014-10-06

I improved the ibisect() method for guaranteed interval solutions. It did not work optimally, if the zero was accidentally met. Now I made it a trisection method, which works much better.


It does also work for functions with interval parameters.

>function f(x,a) := a^x-x^a;

The following calls the function by name with "a" given as a semicolon argument.


As usual, expressions are also possible, if the argument is constant or a global variable.



The behavior of the operator "^" had to be fixed once more. Previously EMT evaluated 2^-3^4 as 2^((-3)^4). Now, it follows the convention of Maxima to evaluate this as follows.

>2^-3^2, 2^(-(3^2))

Maxima has the same rule.

>& 2^-3^2, %()


Version 2014-08-18

There have been some fixes in the graphics routines. E.g., the function ylabel() did only work for the default centered position.

>plot2d("exp(-x)",-1,1,0,2,<ticks,title="y = exp(-x)");   ...
 x0=0.5; y0=exp(-0.5); plot2d(x0,y0,>points,>add);  ...
 plot2d([-1,x0,x0],[y0,y0,0],>add,style="--"); ...
 ylabel("y = "+print(y0,5,0),y0); xlabel("x = "+x0,x0):


Moreover, the documentation of "plot.e" has been improved.

Version 2014-08-09

I switched back to the previous behavior of the order of the evaluation of powers.

>2^2^3, 2^(2^3), (2^2)^3

This is the way Maxima handles powers.


It seems most algebra programs evaluate from right to left. But Matlab evaluates from left to right. See the following online resources.

Wolfram Alpha

There is a new function diffc() for numerical differentiation, which works for analytic functions. The function must evaluate for complex values.

>longest diff("exp(x)",1), longest diffc("exp(x)",1), longest E,


The expression "1e" no longer is interpreted as "1e0". In fact, EMT will issue an error message on exponential numbers which are not well-formed.

Note, that 'E' and 'e' can be used for the exponential format to be able to read external files from other systems. This is sometimes confusing, since E is the Euler number in EMT.

>5E-4, 5*E-4

Version 2014-08-04

A problem with global variables in recursive subroutines has been fixed. It appeared only when the global variable changed its size.

The alias feature for functions was not documented.

>function f(x) := x^4;
>alias falias f; falias(4)

Removing f will also remove g.

>forget f; falias(5)
Function falias not found.
Try list ... to find functions!
Error in:
forget f; falias(5) ...

Version 2014-07-29

It is now possible to search through the help topics in the help window. Enter "?string" to find the string in the help topics. You can double click on the topic to open it.

You can now debug errors with

  >trace errors

If an error occurs in a function you can inspect local variables or expressions containing these variables. Restarting EMT resets all tracing to off.

Version 2014-07-18

Now the packages are listed as included packages and provided packages. The latter need to be loaded. I inserted some of the Euler files in the examples into the provided packages.

Version 2014-07-08

The settings for the size of the windows and dialogs now depend on the screen size.

Version 2014-06-26

The plot function plot2d() got a new flag >addpoints. This allows the same simple overlay as in statplot() without >add. It works only for data plots.



The function cimean() computes an interval estimator for the true mean of a normal random variable when a vector of data of these data is given.

>data=randnormal(1,7,1000,50), cimean(data,alpha=1%)
[976.196,  1062.52,  979.435,  1132.64,  978.904,  971.215,  1058.44]
[934.97,  1110.56]

The function cinormal() computes a confidence interval for normal distributed variables with known mean and standard deviation.

[974.242,  1025.76]

Version 2014-06-12

The file menu got entries for saving and loading in the "Euler Files" directory of the user home folder. Moreover, the shortcuts are now the more logical Alt-S and Alt-O.

It is now documented that the default method for integrate() must get a vectorized function. The error message has been improved.

The statistical functions bindis() and invbindis() are now documented in the tutorials. binsum() is no longer used.


In plot2d(), yl= now works for figures.

>figure(2,2); ...
 for k=1:4; figure(k); plot2d("x^k",yl="y=x^"+k,xl="x",title=""+k); end; ...


The non-vertical labels now align correctly on the left edge.



Version 2014-05-28

The Clopper-Pearson confidence interval is an interval such that for probabilities p outside this interval, the observed result is rare. The default level is alpha=0.05.

[0.478526,  0.541415]

But you can use a smaller alpha and get a wider interval.

[0.468812,  0.551091]


Some commands now require a semicolon or a line end. This should prevent errors like the following.

>function f(x) ...
 useglobal a;
 return a*x;
>a=5; f(6)
Command "useglobal" needs a semicolon!
Try "trace errors" to inspect local variables after errors.
    useglobal a;


The Alt-U now works differently. It inserts all deleted lines and clears the delete buffer. Previously, the buffer was cleared, if the lines were not deleted in successive order. Alt-Del will delete the undo buffer.

Multi-line commands will now be deleted together as one block.

Version 2014-05-14

To avoid confusion between expressions and functions, EMT now follows the following rules.

 - Expressions take precedence over functions with the same name.
 - Expressions should be named fx, fxy etc.
 - A function kills a global symbolic expression with the same name.
>fx &= "x^x"; fx(3)

Do not define functions with such names! The following is for demonstration only. The variable fx will be killed.

>function fx(x) := x^2; ...

Inside of a function, expressions are used instead of functions with the same name. This is what the user expects.

>function h(fx,x) := fx(x);

This does not call the function fx() defined above.


Stack Overflow

I improved the behavior for stack overflows. Now, EMT prevents stack overflows in a better way. This is not fool proof but should work in most cases.

>function f(x) := f(f(x));
>if errorlevel("f(2)") then "Some error occured!", endif;
Some error occured!

If a stack overflow still happens, EMT will crash as before. But the new crash dialog contains an error code now.

Euler Home