# Euler Version 21.1

For 21.1, I improved the interface to the Tiny C compiler. It is now possible to write functions, which are automatically compiled. These functions consist of some macros and much C code.

For an example, the code for the Hofstadter-Conway sequence in this notebook now is

function tinyc hofstadter (n) ...
## Computes n elements of the Hofstadter-Conway sequence.
ARG_INT(n);
CHECK(n>2,"Need an integer larger than 2.");
RES_DOUBLE_MATRIX(m,1,n);
m[0]=m[1]=1.0;
int i;
for (i=2; i<n; i++)
{
int k=(int)m[i-1];
m[i]=m[k-1]+m[i-k];
}
endfunction

The Euler version is much clearer, but about 100 times slower. I had some fun generating a so-called Brownian tree with a bit of C code.

Along the way, I noticed an error in the Mandelbrot notebook. Now the magnificent image on this page looks much better.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.