(* 𝔏𝔦𝔟𝔬𝔯 𝔖𝔱𝔯𝔞𝔨𝔞 & ℨ𝔡𝔢𝔫𝔢𝔨 𝔑𝔬𝔳𝔞𝔨 *)

1+1*30

1/7
(1/7)

(((((2/3)/4)/2)/1)/5)

(2^(2^(2^2)))

(Sqrt[(Sqrt[6.])])
N[(Sqrt[(Sqrt[6])])]

cos=5;
cos(1+(10)+3+(2-1))
a=2;
aa=3;

Cos=5
N[Cos[10]]
Cos[10.]

Solve[5*(x^2)-15*x+3==0,x]

ClearAll[x]
Solve[x==10-3,x]

Solve[{2(x^2)+2y==4,6y+a*x==5},{x,y}]

2s
s2

C
I

Solve[Sin[x]==0,x]

FindRoot[Sin[x]==0,{x,3}]

DSolve[{y''[t]+4y'[t]==((Cos[t])^4),y[0]==0,y'[0]==1},y[t],t]

ClearAll[y]
y[0]==5

?*Laplace*

InverseLaplaceTransform[((p+1)/((p^3)+p+1)),p,t]//N

LaplaceTransform[(t^3)((Sin[2t])^2),t,s]

1+100!//N

Sin[5.]

5.//Sin

Sin@5.

N[Pi,50]

Pi//N[#,50]&

Integrate[Sin[(1/x)]*(x^15),x]
∫Sin[(1/x)]*(x^15)\[DifferentialD]x

(∑_(i=1)^Infinity)(1/(i^2))

∞(* esc + inf + esc *)

(* ==================== druhe cviceni ==================*)

DSolve[{x''[t]+2*x'[t]+2*x[t]==(E^(-t))+5*Sin[3*t],x[0]==3,x'[0]==-1},x[t],t]

Plot[(1/34) (E^(-t)) (80 Cos[t]+34 ((Cos[t])^2)-17 (E^t) Cos[t] Cos[2 t]+5 (E^t) Cos[t] Cos[4 t]+122 Sin[t]-34 (E^t) Cos[2 t] Sin[t]-20 (E^t) Cos[4 t] Sin[t]+34 ((Sin[t])^2)+34 (E^t) Cos[t] ((Sin[t])^2)-34 (E^t) Cos[t] Sin[2 t]+20 (E^t) Cos[t] Sin[4 t]+5 (E^t) Sin[t] Sin[4 t]),{t,0,3Pi}](*takhle NE!!!!!!!!!*)

{a,b,x,y}/.{a->3,b->2}(* komentar *)

{a,b,x,y}/.{a->3,a->11,a->15,b->2,c->10}

{a,b,x,y}/.{a->b,b->x,x->14}

x/.{{x->3},{x->1}}

ClearAll[t]

{{x->3},{x->1},{x->5}}[[1]]
{{x->3},{x->1},{x->5}}[[2]]
{{x->3},{x->1},{x->5}}[[0]]
{{x->3},{x->1},{x->5}}//TreeForm

x/.{{x->3},{x->1},{x->5}}

ClearAll[res1]

res1=x[t]/.DSolve[{x''[t]+2*x'[t]+2*x[t]==(E^(-t))+5*Sin[3*t],x[0]==3,x'[0]==-1},x[t],t][[1]];

x=debil;

?*Plot*

Plot[{res1,2*Cos[t]},{t,0,3Pi},AxesLabel->{"t [s]"," I [A]"},PlotLegends->{"řešení","2*cos(t)"},PlotLabel->"Nazev Grafu",PlotStyle->{{Green,Thick,DotDashed},{Blue,Thickness[0.05],Dashed}}]

Green
Thick
Dashed

Hue

Solve[{b*(y^2)+u==10*y,u==3y+u},{y,u}]

ClearAll[x,t]

x1=x[t]/.DSolve[{x''[t]+6*x'[t]+9*x[t]==(36*t-24)*(E^(-3*t))+18*t+18*Sin[3*t],x'[0]==64,x[0]==18},x[t],t][[1]];
x2=D[x1,t];

Plot[{x1,x2},{t,0,3π},PlotStyle->{{Red,Thick},{Orange,Thick,Dashed}},AxesLabel->{"t","x[t], x'[t]"},PlotLabel->"Graf"]

(*Zde začíná třetí cvičení*)

res=FindRoot[{Tan[x]==2*Sin[y],Log[y]==2*Tan[x]},{{x,1.5},{y,10}}];

Plot[{Log[y*t]/.res,Cos[x*t]/.res},{t,0,10},PlotStyle->{{Blue,Thick},{Magenta,Thick}},AxesLabel->{"x","Ln, Cos"},PlotLabel->"Graf funkcí Ln a Cos"]

res=FindRoot[{Tan[x]==2Sin[y],Log[y]==2Tan[x]},{{x,1.5},{y,10}}];
proplotx=x/.res;
proploty=y/.res;

Plot[{Log[proploty*t],Cos[proplotx*t]},{t,0,10},PlotStyle->{{Blue,Thick},{Magenta,Thick}},AxesLabel->{"x","Ln, Cos"},PlotLabel->"Graf funkcí Ln a Cos"]

Manipulate[Plot[{Log[proploty*t],Cos[proplotx*t+φ]},{t,0,10},PlotStyle->{{Blue,Thick},{Magenta,Thick}},AxesLabel->{"x","Ln, Cos"},PlotLabel->"Graf funkcí Ln a Cos pro (φ= "<>ToString[φ]<>")",PlotRange->{Automatic,{-10,5}}],{φ,0,2Pi}]

ClearAll[funkce]
funkce[a_,b_,c_]:=Solve[a*(x^2)+b*x+c==10,x]

funkce[1,2,1]

x1=x/.Table[funkce[i,i+2,i],{i,10}];
ListPlot[x1,PlotStyle->{Red,PointSize[.05]},AxesLabel->{"x","y"},PlotLabel->"Graf řešení funkce",AxesOrigin->{-5,0}]

N[Table[funkce[i,i+2,i],{i,10}]]

x/.Solve[#*(x^2)+(#+2)*x+#==10,x]&/@Range[10];
ListPlot[%,PlotStyle->Red,AxesLabel->{"x","y"},PlotLabel->"Graf řešení funkce"](*Kyncl styl*)

(*4. cvičení*)

R1=100;
R2=23;
L1=7*(10^(-3));
L2=80*(10^(-3));
c=100*(10^(-6));
uz=15Sin[2*Pi*50*t];
iz=3Tanh[100Sin[2Pi*50*t]];
rceUzly={iuz[t]==iR1[t],iR1[t]+iz==iL1[t],iR2[t]==iz,iC[t]==iR2[t],0==iuz[t]+iL2[t]};
rceSoucastky={u1[t]-u2[t]==R1*iR1[t],u2[t]==L1*iL1'[t],iL1[0]==0,u5[t]==L2*iL2'[t],iL2[0]==0,iC[t]==-c*u4'[t],u4[0]==2,uz==u5[t]-u1[t],u4[t]-u3[t]==R2*iR2[t]};
rceVse=Union[rceSoucastky,rceUzly];
nezname=Union[Cases[rceVse,_Symbol[t],{0,∞}]];

res=NDSolve[rceVse,nezname,{t,0,0.1},StartingStepSize->(10^(-10)),MaxSteps->(10^10),Method->{"IndexReduction"->True}];
proudcivka=iL1[t]/.res[[1]];
napetikond=u4[t]/.res[[1]];
Plot[{iz,proudcivka},{t,0,0.1},PlotStyle->{{Black,Thick},{Red,Thick}},AxesLabel->{"t [s]","I [A]"},PlotLegends->{"Iz","IL1"}]
Plot[{uz,napetikond},{t,0,0.1},PlotStyle->{{Black,Thick},{Blue,Thick}},AxesLabel->{"t [s]","I [A]"},PlotLegends->{"Uz","IC"}]

nezname//TreeForm;

Plot[3Tanh[100Sin[2Pi*50*t]],{t,0,0.1}];
Plot[3Tanh[t],{t,-3,3}];

(*Zde začíná 5. cv *)

rceUzly={IR4==IR5,Iz==IR4+IR1,IR1==IR2,0==IR3+Iz,IR5==IUz};
rceSoucastky={U2-U3==R1*IR1,U3==R2*IR2,U4==R3*IR3,U2-U1==IR4*R4,U1-U5==R5*IR5,Uz==-U5};
rceVse=Union[rceUzly,rceSoucastky]/.{R1->100,R2->100,R3->100,R4->100,R5->100,Uz->-5,Iz->0.01}

(*ToExpression["R"<>ToString[#]]->100&/@Range[5];
, jen pro ty, kterym to myslenkove vyhovuje :-)*)

Solve[rceVse,{U1,U2,U3,U4,U5,IR1,IR2,IR3,IR4,IR5,IUz}]

rceUzly={IR4==IR5,Iz==IR4+IR1,IR1==IR2+Iout,0==IR3+Iz,IR5==IUz};
rceSoucastky={U2-U3==R1*IR1,U3==R2*IR2,U4==R3*IR3,U2-U1==IR4*R4,U1-U5==R5*IR5,Uz==-U5};
rceVse=Union[rceUzly,rceSoucastky]/.{R1->100,R2->100,R3->100,R4->100,R5->100,Uz->-5,Iz->0.01};
U3/.Solve[rceVse,{U1,U2,U3,U4,U5,IR1,IR2,IR3,IR4,IR5,IUz}][[1]]

Expand[U3/.Solve[1.75-U3==Iout*75,U3][[1]]]

ClearAll[ser,par]
par[list_]:=(((Plus@@((list^(-1)))))^(-1));
ser[list_]:=Plus@@list;

ser[{R1,R2,R3}]
par[{R1,R2,R3}]

k=(10^3);
m=(10^(-3));
μ=(10^(-6));
n=(10^(-9));
dos={R1->1,R2->1k,R3->0.1,L1->1,L2->1m,c1->1n,c2->1μ,c3->1n};
za=par[{R1,(1/(I*ω*c1)),I*ω*L1}];
zb=par[{R2,(1/(I*ω*c2))}];
z1=ser[{za,zb}];
z2=par[{(1/(I*ω*c3)),ser[{I*ω*L2,R3}]}];
z1ciselne=z1/.dos;
z2ciselne=z2/.dos;

LogLogPlot[Abs[(z1/(z1+z2))]/.dos,{ω,1,(10^11)},PlotRange->All,AxesLabel->{"ω [(s^(-1))]","Abs[P] [-]"},GridLines->Automatic,PlotStyle->{Orange,Thickness[0.006]}]

z1=ser[{R1,par[{I*ω*L1,(1/(I*ω*c1))}],par[{R2,(1/(I*ω*c2))}]}];
z2=par[{R3,ser[{I*ω*L2,(1/(I*ω*c3))}]}];
z1/.dos;
z2/.dos;
LogLogPlot[Abs[(z2/(z1+z2))]/.dos,{ω,1,(10^11)},PlotRange->All,AxesLabel->{"ω [(s^(-1))]","Abs[P] [-]"},GridLines->Automatic,PlotStyle->{Green,Thickness[0.006]}]

za=par[{I*ω*L1,(1/(I*ω*c1))}];
zb=par[{R2,(1/(I*ω*c2))}];
z1=ser[{R1,za,zb}];
zc=ser[{(1/(I*ω*c3)),I*ω*L2}];
z2=par[{R3,zc}];
LogLogPlot[Abs[(z2/(z1+z2))]/.dos,{ω,1,(10^11)},PlotRange->All,AxesLabel->{"ω [(s^(-1))]","Abs[P] [-]"},GridLines->Automatic,PlotStyle->{Green,Thickness[0.006]}]

LogLinearPlot[Arg[(z2/(z1+z2))]/.dos,{ω,1,(10^11)},PlotRange->All,AxesLabel->{"ω [(s^(-1))]","Arg[P] [-]"},GridLines->Automatic,PlotStyle->{Blue,Thickness[0.006]}]

(* zde zacina 6. cviceni - 23.3.2015 *)

R1=10;
R2=250;
R3=1.5*(10^3);
L1=10*(10^(-3));
L2=100*(10^(-3));
L3=500*(10^(-3));
C1=150*(10^(-6));
C2=20*(10^(-9));

ClearAll[ser,par]
par[list_]:=(((Plus@@((list^(-1)))))^(-1));
ser[list_]:=Plus@@list;

Z1=ser[{R1,(1/(I*ω*C1)),par[{I*ω*L1,par[{R1,I*ω*L2}]}]}];
Z2=ser[{R3,par[{(1/(I*ω*C2)),I*ω*L3,ser[{I*ω*L2,R2}]}]}];
prenos=(Z2/(Z2+Z1));

LogLogPlot[Abs[prenos],{ω,1*(10^(-5)),(10^8)},PlotRange->All,AxesLabel->{"ω [(s^(-1))]","Přenos"},GridLines->Automatic,PlotStyle->{Thick,Magenta,Dashed}]

SeedRandom[1]
data=Table[{i,Sin[i]+0.33*Random[]},{i,1,20,0.1}];
pl1=ListPlot[data];
prokl=Fit[data, {1,Sin[x]},x]
pl2=Plot[prokl,{x,0,20},PlotStyle->Red];
Show[pl1,pl2]

koef=FindFit[data,a+b*Sin[x],{a,b},x]
prokl2=a+b*Sin[x]/.koef
Plot[prokl2,{x,0,20},PlotStyle->Orange]

data2=Table[{i,Sin[i]+0.33*Random[],Cos[i]+0.33*Random[]},{i,1,20,0.1}];
dataV=data2/.{t_,u_,i_}:>{t,u*i};
pl4=ListPlot[dataV];
prokl3=Fit[dataV,{Sin[x]*Cos[x],Sin[x],Cos[x],1},x]
pl5=Plot[prokl3,{x,0,20},PlotStyle->Red];
proExp=Show[pl4,pl5]

SetDirectory[NotebookDirectory[]]

Export["výkon.png",proExp,ImageResolution->300]

Export["výkon.jpeg",proExp,ImageResolution->300]

fce[a_]:=FindRoot[a*Tanh[x]==Sin[x],{x,20}]
tab=Table[{a,x/.fce[a]},{a,0,1,0.1}]
ListPlot[tab]