(* 1. cviceni 11 - 12:30 *)

1+1*9

13-5

(Sqrt[20.])

N[(Sqrt[20])](* komentar *)

N[(Sqrt[20]),100]

N[1/15]

(Sqrt[(Sqrt[(Sqrt[(Sqrt[(Sqrt[(Sqrt[(Sqrt[10])])])])])])])

(2^(2^2))

a=555

a

(a^2)

b=10;

(a/b)

(A/b)

C=10*(10^(-6))

Pi=111

N[π,20]

21a

21a=10

R10=100;

((1+1)+10)*3+(1+(21+(1+2)+2)+1)

TreeForm[{{1,1,1},{1,a,b}}]

List1={1,1,1};
List2={1,a,b};
ListListu={List1,List2}

Integrate[(x^10)*Sin[x],x];

f=Solve[{z==0,15x+z+5==0},{x,z}]

graf1=Sin[2*x];

Plot[{graf1,Cos[2*x],Sin[x],Cos[x]},{x,-2*π,2*π},PlotLegends->"Expressions"]

(* 2. cviceni - 27.2.2017 *)

N[π];

π//N;

N@π;

%

reseni=Solve[{a*(x^2)+3*x+4==0,x+y-4==0},{x,y}]

Plot[((-3-(Sqrt[9-16 a]))/(2 a)),{a,-5,5}](* spatny postup *)

mnozina={1,2,{pes,kocka},vul};

mnozina[[-2]]
mnozina[[5]]
mnozina[[1]]
mnozina[[3,1]]

mnozina[[3,1]]
mnozina[[-2,-2]]

mnozina//TreeForm

z=3

x+z/.{x->10,z->5}

?/.

x/.{x->3,x->15,x->22}[[3]]

x/.reseni[[1,1]]

x/.reseni[[1]]

x/.reseni[[2]]

reseni

Y=10000;

x1=x/.reseni[[1]];
x2=x/.reseni[[2]];
y1=y/.reseni[[1]];
y2=y/.reseni[[2]];

MujGraf=Plot[{x1,x2,y1,y2},{a,-10,10},PlotStyle->{{Blue,Thick},{Thick,Dashed,Red},{RGBColor[0.2,0.1,0.4],Thick},{Magenta,DotDashed,Thick}},AxesLabel->{"osa X","osa Y"},PlotLabel->" Graf 1 ",GridLines->Automatic,PlotRange->{{-5,0},Automatic}]

anim=Manipulate[Plot[a*(x^2)+b*x+c,{x,-5,5},PlotRange->{{-5,5},{-10,10}}],{a,-1,1,0.1},{b,-2,2,0.1},{c,-5,5,1}]

SetDirectory[NotebookDirectory[]]

(* Exporty:

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

*)

(* Exporty:

Export["vid1.avi",anim]

*)

res2=DSolve[{y''[t]+2*y'[t]+3*y[t]==Sin[2*t],y'[0]==0,y[0]==1},y[t],t]

ProPlot=y[t]/.res2[[1]]

Plot[ProPlot,{t,0,20},PlotStyle->{Red,Dashed,Thick},AxesLabel->{" t "," y[t] "},PlotLabel->" Graf 2 "]

(* cviko treti tyden - 6.3.2017 *)

ResDif=DSolve[{y''[t]+2*y'[t]+3*y[t]==Sin[2*t],y'[0]==0,y[0]==1},y[t],t];

?/.

ProPlot=y[t]/.ResDif[[1]];

Plot[ProPlot,{t,0,20},PlotLabel->Text[Style["Divnej plot",Pink,Italic,24]],AxesLabel->{Text[Style["y",Blue,"Times",20]],Text[Style["f(y)",Red,"Times",20]]}]

ClearAll[funkce]
funkce[a_]:=(a^2)

funkce[5]

funkce[d]

funkce[a_,b_]:=a+b

funkce[2,3]

funkce[{a_,b_}]:=a*b

funkce[{2,3}]

funkce[2,3]

Head[5]

Head[5.]

Head["5."]

reseni=Solve[a*(x^3)+b*(x^2)+c*x+d==0,x];

x1=x/.reseni[[1]];
x2=x/.reseni[[2]];
x3=x/.reseni[[3]];

dosad={b->1.,c->3.,d->4.};
x1Plot=x1/.dosad;
x2Plot=x2/.dosad;
x3Plot=x3/.dosad;
Plot[{Abs[x1Plot],Abs[x2Plot],Abs[x3Plot]},{a,2,8},AxesLabel->{"x","x1,x2,x3"},PlotStyle->{{Thick,Blue},{Thick,Red},{Thick,Green}}]

ClearAll[ResKubRovnici]
ResKubRovnici[b_,c_,d_]:=
Module[
{reseni,x,x1,x2,x3,a},

reseni=Solve[a*(x^3)+b*(x^2)+c*x+d==0,x];

x1=x/.reseni[[1]];
x2=x/.reseni[[2]];
x3=x/.reseni[[3]];

Plot[{Abs[x1],Abs[x2],Abs[x3]},{a,2,8},AxesLabel->{"x","x1,x2,x3"},PlotStyle->{{Thick,Blue},{Thick,Red},{Thick,Green}}]

]

ResKubRovnici[1,3,4]

ResKubRovnici[5,10,8]

SeedRandom[1]
data=Table[{x,(x^2)+10Random[]},{x,1,10,0.1}];
body=ListPlot[data,PlotStyle->{Red,PointSize[0.012]},AxesLabel->{"X","Y"}];

proklad=Fit[data,{1,x,(x^2),Log[x],Sin[x]},x];
prokladGraf=Plot[proklad,{x,0,10}];

Show[body,prokladGraf]

(* cviceni 4. tyden 13.3.2017 *)
FindRoot[Sin[x]==0,{x,6}]

ClearAll[funkce]
funkce[a_]:=x/.FindRoot[Sin[x]==0,{x,a}]

funkce[15];

dat11=Table[{(a^2),funkce[a]},{a,0,20,0.5}];

ListPlot[dat11,PlotStyle->{Red,PointSize[0.03]},AxesLabel->{"(a^2)","f(a)"}]

R1=100;
R2=1000;
R3=300;
R4=400;
Uz1=50;
f=50;
ω=2*π*f;
Uz2=(Sqrt[2.])*230*Sin[ω*t];
Iz=5;
Uzly={IR4[t]==IR1[t]+IUz1[t],IR1[t]==IR2[t]+IUz2[t],IUz2[t]==IR3[t],Iz+IR3[t]==IR4[t]};

Length[Uzly];

Soucastky={Uz1==U1[t],U1[t]-U2[t]==R1*IR1[t],U2[t]==R2*IR2[t],U2[t]-U3[t]==Uz2,U3[t]-U4[t]==R3*IR3[t],U4[t]-U1[t]==R4*IR4[t]};

rovnice=Union[Soucastky,Uzly];

nezname=Cases[rovnice,_Symbol[t],{1,Infinity}];

rovnice//TreeForm;

reseni=NSolve[rovnice,nezname];

ProPlot={IR1[t],IR2[t],IR4[t],0.01*U4[t]}/.reseni[[1]];

Plot[ProPlot,{t,0,0.06},PlotStyle->{Red,Orange,Brown,Black}]

Manipulate[Plot[Tanh[k*x],{x,-10,10}],{k,1,50}];

Manipulate[Plot[Tanh[k*Sin[ω*t]],{t,0,0.06}],{k,1,100}];