Quiet@Remove["Global`*"];
$HistoryLength=2;
SetDirectory[NotebookDirectory[]];(*koment*)

Příliš žluťoučký kůň úpěl ďábelské ódy.

Quiet@Remove["Global`*"];
FileNames["*.xls"];
data1=Import["koeficientyReal.xls"][[1]];
info=data1[[1]];
data2=Drop[data1,1];
A=Transpose[Drop[pom=Transpose[data2],-1]];
b=pom[[-1]];
LinearSolve[A,b]

(*Drop[pom=data2\[Transpose],-1]\[Transpose]*)

{c,d,u}=={k,d,h}
Thread[{c,d,u}=={k,dd,h}]

nezname=(Subscript[x, #])&/@Range[Length[b]];
rovnice=Thread[A.nezname==b];
Solve[rovnice]

Quiet@Remove["Global`*"];
FileNames["*.xls"];
data1=Import["koeficientyReal.xls"][[1]];
data2=Drop[data1,1];
A=Drop[#,-1]&/@data2;
b=(Take[#,-1]&/@data2)//Flatten;
b=(Take[#,-1]&/@data2)/.{v_Real}:>v;
LinearSolve[A,b]

Quiet@Remove["Global`*"];
FileNames["*.xls"];
data1=Import["koeficientyReal.xls"][[1]];

A=data1[[2;;-1,1;;-2]];
A//MatrixForm;
b=data1[[2;;-1,-1]];
LinearSolve[A,b]

Quiet@Remove["Global`*"];
FileNames["*.xls"];
data1=Import["koeficientyKomplex.xls"][[1]];
data2=Drop[data1,{1,2}];
data3=Drop[#,{-2,-1}]&/@data2;
A=(Partition[#,2]&/@data3)/.{re_Real,im_}:>re+I*im;
b=(Take[#,{-2,-1}]&/@data2)/.{re_Real,im_}:>re+I*im;
LinearSolve[A,b]>>"vys1";

pom=Range[20]
Partition[pom,2]

Quiet@Remove["Global`*"];
FileNames["*.xls"];
data1=Import["koeficientyKomplex.xls"][[1]];
Are=data1[[3;;-1,1;;-3;;2]];
Aim=data1[[3;;-1,2;;-3;;2]];
A=Are+I*Aim;
Bre=data1[[3;;-1,-2]];
Bim=data1[[3;;-1,-1]];
b=Bre+I*Bim;
LinearSolve[A,b]-(<<"vys1");

Dimensions[Are]
Dimensions[Aim]

?y

ClearAll[y]
rce={5,11,2}.{y''[t],y'[t],y[t]}==((Sin[t])/(t+1));
tmax=50;
sol=NDSolve[{rce,y[0]==1,y'[0]==5},y,{t,0,tmax}][[1]]

Quiet@Remove["Global`*"];
rce={5,11,2}.{y''[t],y'[t],y[t]}==((Sin[t])/(t+1));
tmax=50;
sol=NDSolve[{rce,y[0]==1,y'[0]==5},y,{t,0,tmax}][[1]]
(*{tmin,tmax}=sol[[1,2,1,1]];*)
Plot[y[t]/.sol,{t,0,tmax},PlotRange->All]

Quiet@Remove["Global`*"];
rce={5,11,2}.{y''[t],y'[t],y[t]}==((Sin[t])/(t+1));
tmax=50;
sol=NDSolve[{rce,y[0]==1,y[1]==5},y,{t,0,tmax}][[1]]
(*{tmin,tmax}=sol[[1,2,1,1]];*)
Plot[y[t]/.sol,{t,0,tmax},PlotRange->All]

Quiet@Remove["Global`*"];
mat=MatrixPower[(({{1, 2}, {7, 13}})),(1/5)]//N
mat.mat.mat.mat.mat//Chop

(x^3)//TreeForm

Attributes[Sin]

Sin[{a,b,c,d}]

Sin/@{a,b,c,d}

matM=(((({{1, 2}, {7, 13}})))^(1/5))

matM*matM*matM*matM*matM

NMinimize[{x+2y,(x^2)+(y^2)==1},{x,y},Method->"DifferentialEvolution"]
pom=NMaximize[{x+2y,(x^2)+(y^2)==1},{x,y}]

y/.pom[[2]]

?/.

pom={#,NMaximize[{x+2y,(x^2)+(y^2)==#},{x,y}]}&/@Range[10]

Cases[pom,{4,_}]

Quiet@Remove["Global`*"];
$HistoryLength=2;
SetDirectory[NotebookDirectory[]];
λ[T_]:=0.4+0.1T;
rce=D[λ[T[x]]*T'[x],x]==0;
d=0.5;
sol[der0_?NumericQ]:=T[d]/.NDSolve[{rce,T[0]==20,T'[0]==der0},T,{x,0,d}][[1]];
solder=FindRoot[sol[der]==100,{der,200}];
vys=NDSolve[{rce,T[0]==20,T'[0]==der/.solder},T,{x,0,d}][[1]];
Plot[T[x]/.vys,{x,0,d},PlotStyle->{Red,Thickness[0.006]},AxesLabel->{"x[m]","T[°C]"},GridLines->Full];

Quiet@Remove["Global`*"];
f[x_]:=Sin[Pi*x]+Cos[E*x];
Δx=0.1;
der1[x_]:=((f[x+Δx]-f[x])/(Δx));
der2[x_]:=((f[x+Δx]-f[x-Δx])/(2*Δx));
Plot[{der1[x]-f'[x],der2[x]-f'[x]},{x,0,3},PlotStyle->{Red,Blue}];
a=((der1[x+Δx]-der1[x])/(Δx));
b=((der2[x+Δx]-der2[x-Δx])/(2*Δx));
c=((der2[x+Δx]-der2[x])/(Δx));
d=((der1[x+Δx]-der1[x-Δx])/(2*Δx));
e=((f[x+Δx]+f[x-Δx]-2*f[x])/((Δx)^2));
k=60;
Plot[#-f''[x],{x,0,3},PlotRange->{Automatic,{-k*Δx,k*Δx}}]&/@{a,b,c,d,e}

Quiet@Remove["Global`*"];
f=50.123;
T=(1/f);
ω=2*Pi*f;
u[t_]:=10*Sin[ω*t+0.456]+3.4;
data=Table[{t,u[t]},{t,0,5T,(T/100)}];
pom1=Partition[data,2,1];
test[{{t1_,u1_},{t2_,u2_}}]:=u1*u2<0;
pom2=Select[pom1,test];
fity=Fit[#,{1,x},x]&/@pom2;
casy=x/.Solve[#==0,x][[1]]&/@fity;
Partition[casy,3,1];
Mean[%/.{a_,b_,c_}:>c-a]

Quiet@Remove["Global`*"];
f0=50.123;
ω=2*Pi*f0;
T=(1/f0);
f[t_]:=10*Sin[ω*t+0.456]+3.4;
data=Table[{t,f[t]},{t,0,5T,0.01T}];
ListPlot[data];
pom1=Partition[data,3,1];
test[{{t1_,u1_},{t2_,u2_},{t3_,u3_}}]:=u1<u2>u3;
pom2=Select[pom1,test]
fity=Fit[#,{1,x,(x^2)},x]&/@pom2;
maxima=x/.Solve[D[#,x]==0,x][[1]]&/@fity
{-1,1}.#&/@Partition[maxima,2,1]
((Mean[%]-T)/T)*1000

fit[T_]:=Fit[data,{Sin[((2.*Pi*t)/T)],Cos[((2.*Pi*t)/T)],1},t];
err[T_]:=Module[{fitt,chyba},
fitt=fit[T];
chyba[{tt_,u_}]:=(((u-fitt/.t->tt))^2);
Total[chyba/@data]
];
pom3=Table[{T,err[T]},{T,0.9*(1/50),1.2*(1/50),(10^(-4))}];
ListPlot[pom3]
int=Interpolation[pom3];
FindMinimum[{int[Tvys],Tvys>0.9*(1/50),Tvys<1.2*(1/50)},{Tvys,(1/50)}]