(*zadanie matie A*)
a11=-0.1;a12=1.0;a21=-1.0;a22=-0.1;
A={{a11,a12},{a21,a22}}
MatrixForm[A]

(*definicia pravej strany*)

f1[x_,y1_,y2_]:=x*y1+(x^2)*y2
f2[x_,y1_,y2_]:=-y1+2*x*y2

x0=0;
x[0]=0;
y1[0]=1;
y2[0]=1;

koniec=1;
h=0.05;
n=koniec/h;

(*Eulerova metoda*)

Numries[x_,y1_,y2_,f_,h_]:=y1+h*f[x,y1,y2]
Numries1[x_,y1_,y2_,f_,h_]:=y1+h*f[x,y1,y2]
Numries2[x_,y1_,y2_,f_,h_]:=y2+h*f[x,y1,y2]

Pres1[x_]:=Exp[-0.1*x]*Cos[x]
Pres2[x_]:=-Exp[-0.1*x]*Sin[x]

Do[
{
x[i]=x0+i*h,
y1[i]=Numries1[x[i-1],y1[i-1],y2[i-1],f1,h],
y2[i]=Numries2[x[i-1],y1[i-1],y2[i-1],f2,h]
},
{i,1,n,1}
]
data=Table[{x[i],y1[i],y2[i]},{i,0,n}];
vys1=Table[{x[i],y1[i]}, {i,0,n}];
vys2=Table[{x[i],y2[i]}, {i,0,n}];
listX=Table[{x[i],y1[i],y2[i]},{i,0,n}];
data1=Table[{Abs[(y1[i]-Pres1[x[i]])],Abs[(y2[i]-Pres2[x[i]])]},{i,0,n}];
vysledky=Table[{x[i],y1[i],y2[i],Pres1[x[i]],Pres2[x[i]], Abs[(y1[i]-Pres1[x[i]])],Abs[(y2[i]-Pres2[x[i]])]},{i,0,n}];

PaddedForm[TableForm[vysledky],{7,2}]

g1=Plot[Pres1[x],{x,0,1},PlotStyle->{RGBColor[1,0,0],PlotRange->{{0,1},{0,10}},Thickness[0.005]}]

g2=Plot[Pres2[x],{x,0,1},PlotStyle->{RGBColor[1,0,0],PlotRange->{{0,1},{0,10}},Thickness[0.005]}]

graf1=ListPlot[vys1,PlotStyle->{RGBColor[0,0,1]},PlotRange->{{0,1},{1,2}}]

graf2=ListPlot[vys2,PlotStyle->{RGBColor[0,0,1]},PlotRange->{{0,1},{0,1}}]

Show[g1,graf1]

Show[g2,graf2]

graf3=ListPlot3D[listX,PlotStyle->{RGBColor[0,0,1]}]

ParametricPlot3D[{x,Pres1[x],Pres2[x]},{x,0,1}]

(*  y1'=x*y1+x^2*y2
y2'=-y1+2*x*y2
	y1(0)=1;
		y2(0)=1*)