(* Integraly *)

Integrate[x^n,x]

D[%,x]

∫x^n\[DifferentialD]x

(*Esc int Esc - znak integralu, Esc dd Esc - znak d*)

∫x^n\[DifferentialD]x

∫1/(x^3+1)\[DifferentialD]x

D[%,x]

Simplify[%]

Ctrl + _ - dolna hranica
Ctrl + % - horna hranica

(∫_0^1)1/(x^3+1)\[DifferentialD]x

%//N

Integrate[1/(x^3+1),{x,0,1}]

NIntegrate[1/(x^3+1),{x,0,1}]

Integrate[Sin[Sin[x]],{x,0,1}]

NIntegrate[Sin[Sin[x]],{x,0,1}]

Plot[Sin[Sin[x]],{x,0,1}]

(* Integral ako plocha *)

f[x_]:=x/2+1
Plot[f[x],{x,1,4},Filling->Axis,AxesOrigin->{0,0}]

a=1;c=4;
p=f[(a+c)/2](c-a)

a=f[1];
c=f[4];
v=4-1;
p=(a+c)v/2

Integrate[f[x],{x,1,4}]

Plot[f[x],{x,-4,4},Filling->Axis,ImageSize->{100,100}]

a=f[4];v1=6;b=Abs[f[-4]];v2=2;
S1=((a v1)/2)
S2=((b v2)/2)
S=S1+S2

Integrate[f[x],{x,-4,4}]

Integrate[f[x],{x,-4,-2}]

Integrate[f[x],{x,-2,4}]

-Integrate[f[x],{x,-4,-2}]+Integrate[f[x],{x,-2,4}]

Plot[Sin[x],{x,0,π},Filling->Axis,ImageSize->{100,100}]

Integrate[Sin[x],{x,0,Pi}]

Plot[Sin[2x],{x,0,π},Filling->Axis,ImageSize->{100,100}]

Integrate[Sin[2x],{x,0,Pi}]
Integrate[Sin[2x],{x,0,Pi/2}]+(-Integrate[Sin[2x],{x,Pi/2,Pi}])

Plot[Sin[3 x],{x,0,π},Filling->Axis,ImageSize->{100,100}]

Integrate[Sin[3 x],{x,0,π}]

n=3;
Sum[(-1)^i Integrate[Sin[n x],{x,i*Pi/n,(i+1)  Pi/n}],{i,0,n-1}]

n=7;
Plot[Sin[n x],{x,0,π},Filling->Axis,ImageSize->{150,150}]
Sum[(-1)^i Integrate[Sin[n x],{x,i*Pi/n,(i+1)  Pi/n}],{i,0,n-1}]

Plot[{Sin[x],(x^2)-2 x},{x,0,π},Filling->{1->{2}},ImageSize->{100,100}]

a=0
c=π
koren=FindRoot[Sin[x]==(x^2)-2 x,{x,2}]
b=x/.koren

c1=(∫_a^b)(Sin[x]-((x^2)-2 x))\[DifferentialD]x
c2=(∫_b^c)(((x^2)-2 x)-Sin[x])\[DifferentialD]x 
c1+c2

c1=Integrate[Sin[x]-(x^2-2x),{x,a,b}]
c2=Integrate[(x^2-2x)-Sin[x],{x,b,c}]
c1+c2

Plot[{(x^3)-(x^2)+1,2 x+3},{x,-4,4},PlotRange->All,Filling->{1->{2}},ImageSize->{100,100}]

koren=FindRoot[(x^3)-(x^2)+1==2 x+3,{x,3}]
b=x/.koren

c1=Integrate[2 x+3-((x^3)-(x^2)+1),{x,-4,b}]
c2=Integrate[(x^3)-(x^2)+1-(2 x+3),{x,b,4}]
c1+c2

f[x_]:=5ArcTan[x]
g[x_]:=x^3+x^2
a=-Pi
c=Pi

Plot[{f[x],g[x]},{x,a,c},PlotRange->All,Filling->{1->{2}},ImageSize->{100,100}]

koren1=FindRoot[f[x]==g[x],{x,-3}];
b1=x/.koren1
koren2=FindRoot[f[x]==g[x],{x,0}];
b2=x/.koren2
koren3=FindRoot[f[x]==g[x],{x,1}];
b3=x/.koren3

c1=Integrate[f[x]-g[x],{x,a,b1}];
c2=Integrate[g[x]-f[x],{x,b1,b2}];
c3=Integrate[f[x]-g[x],{x,b2,b3}];
c4=Integrate[g[x]-f[x],{x,b3,c}];
c1+c2+c3+c4

c5=Integrate[f1[x]-f2[x],{x,-Pi,Pi}]//N

a=1;b=3;f[x_]:=0.7+2.1x+Sin[5.3 x]
fplot=Plot[f[x],{x,a,b},AxesOrigin->{1,0},PlotRange->All,Filling->Axis,ImageSize->{200,200}]
Integrate[f[x],{x,a,b}]

n=2;
dx=(b-a)/n;
pribl_int=Sum[f[x]dx,{x,a,b-dx,dx}]

n=2;
dx=(b-a)/n;
podm=Table[a+i dx<x<a+(i+1)dx,{i,0,n-1}]

IntegrSucet1=Table[{f[a+(i-1) dx],podm[[i]]},{i,1,n}]

iplot=Plot[Piecewise[IntegrSucet1],{x,a,b},Filling->Axis,FillingStyle->Orange,AxesOrigin->{1,0},ImageSize->{100,100}]

Show[iplot,fplot,PlotRange->All,ImageSize->{200,200}]

n=4
dx=(b-a)/n
pribl_int=Sum[f[x]dx,{x,a,b-dx,dx}]
podm=Table[a+i dx<x<a+(i+1)dx,{i,0,n-1}];
IntegrSucet1=Table[{f[a+(i-1) dx],podm[[i]]},{i,1,n}];
iplot=Plot[Piecewise[IntegrSucet1],{x,a,b},Filling->Axis,FillingStyle->Orange,AxesOrigin->{1,0},ImageSize->{200,200}];
Show[iplot,fplot,PlotRange->All,ImageSize->{200,200}]

n=10
dx=(b-a)/n
pribl_int=Sum[f[x]dx,{x,a,b-dx,dx}]
podm=Table[a+i dx<x<a+(i+1)dx,{i,0,n-1}];
IntegrSucet1=Table[{f[a+(i-1) dx],podm[[i]]},{i,1,n}];
iplot=Plot[Piecewise[IntegrSucet1],{x,a,b},Filling->Axis,FillingStyle->Orange,AxesOrigin->{1,0},ImageSize->{200,200}];
Show[iplot,fplot,PlotRange->All,ImageSize->{200,200}]