Matrix_Test

Author: Copyright 2011, MetaQuotes Software Corp.
0 Views
0 Downloads
0 Favorites
Matrix_Test
//+------------------------------------------------------------------+
//|                                                  Matrix_Test.mq5 |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#include <Matrix.mqh> 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   CMatrix          *F1;
   CMatrix          *F2;
   CMatrix          *F3;

   F1=new CMatrix(3,3);
   F2=new CMatrix(3,3);
   F3=new CMatrix(3,3);

   El(F1,0,0)=1;  El(F1,0,1)=4;  El(F1,0,2)=-2;
   El(F1,1,0)=-3; El(F1,1,1)=2;  El(F1,1,2)=2;
   El(F1,2,0)=1;  El(F1,2,1)=0;  El(F1,2,2)=-2;

   El(F2,0,0)=2;  El(F2,0,1)=2;  El(F2,0,2)=-3;
   El(F2,1,0)=-1; El(F2,1,1)=1;  El(F2,1,2)=7;
   El(F2,2,0)=3;  El(F2,2,1)=2;  El(F2,2,2)=10;

//--- F3=((F1+F2)*F2)/10-F2
   F3.Add(F1,F2); // F3=F1+F2
   F3.Mul(F2);    // F3=F3*F2
   F3.Mul(1./10); // F3=F3/10
   F3.Sub(F2);    // F3=F3-F2

   double det=F3.Inv();  // invert F3
   printf("det=%5.3f   F3[2,2]=%5.3f",det,El(F3,2,2));
   delete F1;
   delete F2;
   delete F3;
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---