Fourier-based hypothesis - page 10

 

This is my C code, dated 03.1995 (what a dusty mess in the mezzanine!) If it hasn't been erased, it must be working.


int Invert (double * t)
/*---------------------------------------------------------*
 *   Вычисление обратной матрицы путем ее перевода   	   *
 *   к треугольному виду  с последующим умножением 	   *
 *      на преобразованную единичную матрицу.        	   *
 *   Обратная матрица распологается на месте исходной.	   *
 *   Требуется <buf> область размерности t[1..NM*NM] 	   *
 *---------------------------------------------------------*
 *  t[0] =  NM  - размерность матрицы.               	   *
 *  t[1..NM*NM] - исходная (обратная) матрица по столбцам. *
 *  e[1..NM*NM] - элементы единичной матрицы.       	   *
 *  ВОЗВРАТ :  0 - OK                           	   *
 *---------------------------------------------------------*/
{   int    js, jk, jj, jp, n= t[0];
    double a1, a2, * e=(double *) buf;
//  -----------  Заполнение Е матрицы  -----------
    for ( jk = 1; jk <= n; jk++) {
       jp = n*( jk-1);
       for ( js = 1; js <= n; js++) {
	  e[ js+ jp] = t[ js+ jp];  t[ js+ jp] = 0.0; }
       t[ jk+ jp] = 1.0; }
// ----------------  Проход по столбцам ----------
    for ( jk = 1; jk < n; jk++) {
//  ---------------  Обнуление столбца  ----------
       a1 = e[( jp = n*( jk-1))+ jk];  //  Диагональный элемент
       for ( js = jk+1; js <= n; js++) {
	    a2 = e[ jp+ js]/ a1;   e[ jp+ js] = 0.0;
	    for ( jj = jk+1; jj <= n; jj++)
	       e[ n*( jj-1)+ js] -= a2* e[ n*( jj-1)+ jk];
	    for ( jj = 1; jj <= n; jj++)
	       t[ n*( jj-1)+ js] -= a2* t[ n*( jj-1)+ jk]; }
    } //  END for (JK)
//  -------  Определение обратной матрицы  -------
    for ( js = n; js > 0; js--)
       for ( jk = 1; jk <= n; jk++) {
	  for ( a1 = 0.0, jj = js+1; jj <= n; jj++)
	     a1 += e[ n*( jj-1)+ js]* t[ n*( jk-1)+ jj];
	  t[ n*( jk-1)+ js] = ( t[ n*( jk-1)+ js]- a1)/ e[ n*( js-1)+ js]; }
    return 0;
}
/**********************************************************************/
 
Mathemat >> :

Of course, it's a slow method. I wonder how you got anything for a 100x100 matrix.

>> I join in. I am surprised a bit too.

(thoughtfully) shows the high efficiency of the MQL4 compiler.

 

to Mathemat, AlexEro

Colleagues, don't be picky, the first algorithm we saw was implemented. We'll speed it up, deepen it, and improve it.

 
grasn >> :

PS: A correction. If 1:1 and the input row is quoted, it's pretty weird. If the picture is steady, then it's already really weird.

Yes, 1 to 1. I found a typo. Here's the result.


Alas, it's still a long way from a reliable prediction...

 
grasn >> :

to Mathemat, AlexEro

Colleagues, don't be picky, the first algorithm we saw was implemented. We will speed it up, deepen it, and improve it.



Really, colleague?! We're not picking on you! Where did you see that? We're just pointing out the rake that we ourselves hit a long time ago. And we show you how to get around them. Would you rather not say anything?

 

to equantis

I warned you on the previous page in large letters. You may spend years and years and not find any acceptable solution, or you may figure it all out in 10 minutes. But I still recommend to leave it for the dessert :o).


to AlexEro

I'm just reminding you that up to that moment there was no library at all, except Ilnur's work :o)

 
grasn >>:А я предупреждал на прошлой странице крупными буквами. Можно годы потрать, но не найти приемлемого решения, а можно и за 10 мин во всем разобраться. Все же рекомендую оставить на десерт :о)

That's right, it's worth keeping...

In order to close the issue I would like to show a picture with typical results:

Blue - price

Red - forecast with cosine transformation with start at 0

purple - the same curve, but calculated from the starting point of the forecast (100)

Green - simple forecast based on the price curve (I used built-in predict function)

 
grasn >> :

to AlexEro

I'm just reminding, that up to this moment there was no library at all, except Ilnur's work :o)

you didn't have it....

 
AlexEro >> :

you didn't have it....

One is left to ask, and where have you been? :о))))))