(* 1. cviko 11:00 až 12:30
Straka, Pražák
 *)

10+9/3+11

(Sqrt[2])
(Sqrt[2.])
N[(Sqrt[2]),2000]

N[1/7]

x=9;
y=4;

x

N=5
Sin=15;

(((3+1)/3)*15)

(* ctrl+2 (Sqrt[\[Placeholder]]), ctrl+6 (x^\[Placeholder]), ctrl+/ (\[Placeholder]/\[Placeholder])*)

(Sqrt[\[Placeholder]])

(x^(((((\[Placeholder]^(\[Placeholder]^\[Placeholder]))^((\[Placeholder]^\[Placeholder])\[Placeholder]))^\[Placeholder])^\[Placeholder])^\[Placeholder]))

(Sqrt[(Sqrt[(Sqrt[(Sqrt[(Sqrt[(Sqrt[(Sqrt[81])])])])])])])

(1/4)

list={ja,ty,{on,ona,ono}}

list[[1]]
list[[3,2]]

Sin[list]/.{ja->Pi,ty->2.,ono->π}

ja

ClearAll[x]

funkce={Log[x],Cos[2*x],Sin[6x]};

Plot[funkce,{x,0,2*π},PlotLegends->"Expressions"]

(* komentář *)

Jan Votava je vul

2 5 8 9

vyraz=(a+b)*(a-b)

Expand[vyraz]

FullForm[vyraz]

FullForm[list]

TreeForm[vyraz]

TreeForm[list]

Sin[5.]
Sin@5.
5.//Sin

(Sqrt[y])//N

Plot[{Log[t+4],(t^3)*Sin[5*t+0.4]},{t,0,10},PlotStyle->{{Thick,Black},{Red,Dashed,Thick}},PlotRange->{Automatic,{-100,100}}]

(* 2. cviko 26.2. 11:00 *)

1000!//N

RES=Solve[2*(x^2)+6*x+3==0,x]

RES//TreeForm;

x1=x/.RES[[1]]
x2=x/.RES[[2]]

?/.

Reseni=Solve[{3*x+a*y+8==0,x+y-9==0},{x,y}]

x=Pi

XX=x/.Reseni[[1]];
YY=y/.Reseni[[1]];

Plot[{XX,YY},{a,-5,10},PlotStyle->{{Red,Thick},{Blue,Thick}},AxesLabel->{"x","f(x)"},PlotRange->Automatic,GridLines->Automatic]

Options[Plot];

ClearAll[MojeFunkce]
MojeFunkce[cokoliv_]:=1+(cokoliv^2)

MojeFunkce[50]

res2=Solve[{(x^2)+(y^2)==k,y-3(x^2)+(5/2)==k},{x,y}];
xka=x/.res2;

Plot[xka,{k,0,5},GridLines->Automatic,PlotStyle->{{Red,Thick},{Blue,Thick},{Black,Thick},{Magenta,Thick}},AxesLabel->{"osa X","osa Y"}]

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

ClearAll[fce]
fce[parametr_]:=x/.FindRoot[Cos[parametr*x]==x,{x,0}]

fce[9]

Plot[fce[t],{t,0,3},PlotStyle->{{Red,Dashed}},AxesLabel->{"osa X","osa Y"}]

(* 3. cv. - 5.3.2018 *)

ClearAll[fce]
fce[a_,b_]:=x/.FindRoot[Exp[a]==b*x,{x,1}]

fce[1,3];

Plot[fce[a,3],{a,0,4},AxesLabel->{"osa X","osa Y"},PlotStyle->{Red,Thick}];

Manipulate[

Plot[fce[k*a,b],{a,0,4},AxesLabel->{"osa X","osa Y"},PlotStyle->{Red,Thick},PlotRange->{Automatic,{0,500}}]

,{b,1,5},{k,0,4}]

c=3;
x1=x/.Solve[a*(x^2)+b*x+c==0,x][[1]]
x2=x/.Solve[a*(x^2)+b*x+c==0,x][[2]]

ClearAll[fce2]
fce2[a_,b_]:=Module[
{c,x1,x2},

c=3;
x1=x/.Solve[a*(x^2)+b*x+c==0,x][[1]];
x2=x/.Solve[a*(x^2)+b*x+c==0,x][[2]];

{x1,x2}
]

fce2[a,b]

Table["orangutan",{20}];

Table[i,{i,1,100,7}]

ClearAll[list]
list=Table[(E^((-t)/τ)),{τ,1,10}];

Plot[list,{t,0,10}];

Barvy=Table[{Thick,Hue[k],Dashing[(k/10)]},{k,0,0.9,0.1}];

Graf1=Plot[list,{t,0,10},PlotStyle->Barvy,AxesLabel->{"osa X","osa Y"}]

SetDirectory[NotebookDirectory[]];

Export["MujGraf.png",Graf1,ImageResolution->300]

tisk=Table[Plot[Sin[k*x],{x,0,0.05},PlotStyle->Hue[((k-50)/50)]],{k,50,100,2}];

Show[tisk];

matice=Table[(E^u)+(Pi^v),{u,1,4},{v,1,4}]

MatrixForm[matice];

Det[matice]

rovnice=x'[t]+5*x[t]==Sin[t];
pocPodm=x[0]==0;

reseni=x[t]/.DSolve[{rovnice,pocPodm},x[t],t][[1]];

Plot[reseni,{t,-1,10}]

(* 4. cviko, 12.3.2018 11:00 *)

R1=150;
R2=200;
C1=4*(10^(-6));
L1=2*(10^(-3));
uZ=(Sqrt[2])*Sin[2*Pi*100*t];
iZ=0.01;
rceUzlu={
iZ==iUz[t]+iC[t]+iR1[t],
iR1[t]+iR2[t]==iZ,
0==iR2[t]+iL[t]
};
rceSouc={
u1[t]==uZ,
u1[t]-u2[t]==R1*iR1[t],
u3[t]-u2[t]==R2*iR2[t],
uL[t]==L1*D[iL[t],t],
u3[t]==uL[t],
iC[t]==C1*D[uC[t],t],
uC[t]==u1[t]
};

rceVse=Union[rceUzlu,rceSouc];

nezname=Cases[rceVse,_Symbol[t],{0,∞}]//Union;

rceVse//TreeForm;

pocPod=Cases[rceVse,a_'[t]:>a[0]==0,{0,∞}]

proSolve=Union[rceVse,pocPod];

{Length[nezname],Length[rceVse]}

sol=NDSolve[proSolve,nezname,{t,0,0.02},StartingStepSize->(10^(-12)),Method->{"IndexReduction"->Automatic} ];

Plot[uL[t]/.sol,{t,0,0.005}]

(* 5.cv., 19.3.2018 11:00 *)

U=230*Sin[2*50*Pi*t];
Plot[U,{t,0,0.02}];

Manipulate[Plot[1+Tanh[k*t],{t,-10,10}],{k,1,20}];

Manipulate[Plot[230*Tanh[k*Sin[2*50*Pi*t]],{t,0,0.02}],{k,1,100}];

ClearAll[Evaluate[Context[]<>"*"]]

souc={R1->100,R2->200,R3->300,R4->400,R5->500,iZ->0.01,uZ->10};
rceUzly={iR1==iUz+iR2,iZ==iR1,0==iZ+iR3+iR5,iR2+iR3==iR4};
rceSouc={uZ==-uA,uB-uA==iR1*R1,uA-uD==iR2*R2,uC-uD==iR3*R3,uD==iR4*R4,uC==iR5*R5};
rceDohr=Union[rceUzly,rceSouc]/.souc;
Solve[rceDohr];

(* Pro Thevenina *)

ClearAll[Evaluate[Context[]<>"*"]]

souc={R1->100,R2->200,R3->300,R4->400,R5->500,iZ->0.01,uZ->10};
rceUzly={iR1==iUz+iR2,iZ==iR1,0==iZ+iR3+iR5+iOut,iR2+iR3==iR4};
rceSouc={uZ==-uA,uB-uA==iR1*R1,uA-uD==iR2*R2,uC-uD==iR3*R3,uD==iR4*R4,uC==iR5*R5};
rceDohr=Union[rceUzly,rceSouc]/.souc;
NeznameVsechny=Cases[rceDohr,_Symbol,{0,Infinity}];
Nezname=DeleteCases[NeznameVsechny,iOut];
uC/.Solve[rceDohr,Nezname][[1]]

ClearAll[Evaluate[Context[]<>"*"]]
souc={R1->300,R2->50,R3->30,iZ->0.05,uZ1->30,uZ2->12};
rceUzly={
iUz==iR3+iOut,
iR1==iUz1+iR2,
iR3+iR2+iOut==iZ
};
rceSouc={
uA==-uZ2,
uB==-iR1*R1,
uB==-uZ1,
uB-uC==iR2*R2,
uA-uC==iR3*R3
};

rceDohr=Union[rceUzly,rceSouc]/.souc;
NeznameVsechny=Cases[rceDohr,_Symbol,{0,Infinity}];
Nezname=DeleteCases[NeznameVsechny,iOut];
sol=Solve[rceDohr,Nezname][[1]];
Vodpor=(uA-uC)/.sol;

Print["Napeti na odporu jest: ",Vodpor]

(* 6. cviko 26.3.2018 11:00 *)

ClearAll[Evaluate[Context[]<>"*"]]

par[listR_]:=(((((listR^(-1)))/.List->Plus))^(-1));
ser[listR_]:=listR/.List->Plus;

ser11[list_]:=Plus@@list
par11[list_]:=(((Plus@@(1/list)))^(-1))

prvky={a,b,c};

Sin@prvky
Sin@@prvky

par11[{a,b,c}];

ZR1=600;
ZR2=ZR3=250;
ZR4=150;
ZC1=(1/(I*ω*50*(10^(-6))));
ZC2=(1/(I*ω*10*(10^(-6))));
ZC3=(1/(I*ω*3*(10^(-6))));
ZL1=I*ω*20*(10^(-3));
ZL2=I*ω*100*(10^(-6));
ZL3=I*ω*5*(10^(-3));

Za=par[{ZR2,ZC1}];
Z1=ser[{ZR1,Za,ZL1}];

Zb=ser[{ZR4,ZC2}];
Zc=ser[{ZR3,ZL2}];
Zd=par[{Zb,Zc,ZC3}];
Z2=ser[{Zd,ZL3}];

Prenos=(Z2/(Z2+Z1));

LogLogPlot[Abs[Prenos],{ω,(10^(-5)),(10^8)},PlotRange->All,GridLines->Automatic,PlotStyle->{Red,Thick},AxesLabel->{"ω ((s^(-1)))","Abs(P) (-)"}]

Print["Abs. hodnota přenosu pro ω = 314 (s^(-1)) jest: ",Abs[Prenos]/.ω->314.]

ClearAll[Evaluate[Context[]<>"*"]]

rceUzly={
iZ1==iC1+iL1,
iC1==iZ2+iR2,
iR1+iR2==iL2,
iL1==iR1
};
j=(Sqrt[-1]);
rceSouc={
u4-u3==iR1*R1,
u2-u3==iR2*R2,
u1-u4==j*ω*L1*iL1,
u2-u3==j*ω*L2*iL2,
u1-u2==(1/(j*ω*C1))*iC1,
u1==uZ1,
u2==uZ2
};

rce=Union[rceUzly,rceSouc]/.{R1->100,R2->200,L1->0.001,L2->0.0001,C1->(10^(-5)),uZ1->50,uZ2->25};

sol=Solve[rce];

{iR1/.sol,iR2/.sol};

LogLogPlot[{Abs[iR1/.sol],Abs[iR2/.sol]},{ω,1,(10^9)},PlotStyle->{Red,Blue},AxesLabel->{"ω ((s^(-1)))","iR1 iR2 (A)"},GridLines->Automatic]