1+1

(*komentar*)

(Sqrt[10])

(Sqrt[10.])

N[(Sqrt[10])]

n[(Sqrt[10])]

n=5

n

N[(Sqrt[10]),15]

Sin[5.0]

Sin@5

Sin@5.

5.//Sin

(2^3)

(1/2)

π

Pi

E

E

N[π,10]

c=5

c=10

E=4

EE=4

E*E

krivka je vul

5 2

krivka=10
je=5
vul=2

krivka je vul

krivka*je*vul

ClearAll[krivka,je,vul]

ClearAll[Pi]

N[5/7]

LaplaceTransform[(E^(-2*t)),t,p]

Solve[a*x^2+b*x+c==0,x]

Solve[{x+y==10,x-2*y==5},{x,y}]

ClearAll[y]

res=DSolve[{y''[x]+x*y'[x]+(1-x^2)*y[x]==0,y[0]==0,y'[0]==1},y[x],x][[1]]//N

?y

FindSequenceFunction[{1,2,4,8,16},6]

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

(*zde zacina druhe cviko*)

res=Solve[{a*(x^2)+(a^2)*x*y+(a^3)*(y^2)==0,x+y==5-a},{x,y}][[1]]

dosaz=(((x+y))^2)/.res

Plot[dosaz,{a,-1,1}]

res=Solve[{x+y==2*t,(x^2)-y+x*y+(y^2)-5*t==2*t*y},{x,y}][[1]]
dosaz=Abs[x+y]/.res

Plot[dosaz,{t,1,4}]

(*ucime se s grafikou*)

x=3
Plot[{Sin[x],Cos[2x]},{x,-2Pi,2Pi},AxesLabel->{"x","cos 2x, sin x"}, PlotStyle->{{Red,Dashed,Thickness[0.02]},{Thick, Green}},PlotLabel->"muj prvni graf",GridLines->Automatic]

a=3;
ClearAll[a]
Manipulate[ Plot[(x^a),{x,0,2}, PlotRange-> {Automatic,{0,40}}, AxesLabel->{"x","(x^a)"}, PlotStyle ->{Brown,Thick, Dashed}, GridLines-> Automatic],{a,-3,10}]

Manipulate[Plot[Sin[x],{x,0,4Pi}, PlotStyle->{Blue, Dashed, Thickness[a]}],{a,0.01,0.1,0.005}]

ClearAll[x]
Normal[Series[Cos[x],{x,0,5}]]

(*zde zacina 3. cviko*)

(*Z domácího úkolu*)
Manipulate[TayloruvPolynom=Normal[Series[Cos[x],{x,0,n}]];
Plot[{Cos[x],TayloruvPolynom},{x,0,4Pi},
PlotStyle->{{Thickness[0.01],Red},{Thick, Blue}},
PlotRange->{Automatic,{-1.5,1.5}},GridLines->{{{Pi,Dashed},{2Pi,Dashed},{3Pi,Dashed},{4Pi,Dashed}},{{-1,Green},-.5,.5,{1,Green}}},PlotLabel-> "Cos x",AxesLabel->{" Osa x","Osa y"}]
,{n,0,100,1}]

graf=Plot[{2 Sin[2 x],4 Cos[x],},{x,-0.5 Pi,0.5 Pi},PlotStyle->{{Red,Thick},{Green,Thick,Dashed}}, AxesLabel->{"x","y"},GridLines->Automatic, PlotLabel->"graf"];

SetDirectory[NotebookDirectory[]]

graf>>"graf3"

pl=<<"graf3";

pl

Export["grafik.png",graf,ImageResolution->300]

ClearAll[f]
f[a_,b_]:=(a^2)+(b^2)

f[1,2]

FindRoot[Cos[x]==0,{x,1}]

ClearAll[f]
f[a_]:=x/.FindRoot[Cos[a x]==0,{x,1}]

f[2]

Plot[f[a],{a,1,2}]

ClearAll[f]
f[a_]:=x/.FindMinimum[a (x^2)+2 x+1,{x,0}][[2]]
Plot[f[a],{a,1,10}, GridLines->Automatic, PlotStyle->{Orange,Thick,Dashed}, PlotLabel->"nase funkce",AxesLabel->{"a","x"}]

ClearAll[f]
f[a_]:=x/.FindMinimum[a (x^2)+2 x+1,{x,0}][[2]]

f[2]

ClearAll[c,R]
c=5*(10^(-6));
R=2000;
uz=10 Tanh [100 Sin[314 t]];
plvstup=Plot[uz,{t,0,0.08},AxesLabel->{"t(s)","uz(V)"},PlotStyle->{Thick}];

tmax=0.08;
s=NDSolve[{((uz-uc[t])/R)==c*uc'[t],uc[0]==0},uc[t],{t,0,tmax}];
plvystup=Plot[uc[t]/.s,{t,0,tmax},PlotStyle->{Red,Thick}];
Show[plvstup,plvystup,PlotRange->All]

(*ctvrty cviko*)

ClearAll["Global`*"]

tmax=10*Pi;
rce={x''[t]+x[t]==4*Sin[t], x[0]==2,x'[0]==-1};
d1=x[t]/.DSolve[rce,x[t],t][[1]]
d2=x[t]/.NDSolve[rce,x[t],{t,0,tmax}][[1]]
Plot[d1-d2,{t,0,tmax},PlotStyle->{Blue,Thick}, AxesLabel->{"t","Δx"},GridLines->Automatic, PlotLabel->"graf"]

ClearAll["Global`*"]
IZ=Tanh[100*Sin[314*t]];
Uz=100*Sin[314*t]*t;
R1=1000;
R2=2500;
c1=10*(10^(-6));
c2=15*(10^(-6));
rceProudy={IZ==IR2[t],IR2[t]==IC1[t]+IC2[t],IC1[t]+IU[t]==IR1[t]};
rceSoucastky={U3[t]==IR1[t]*R1,U1[t]-U2[t]==R2*IR2[t],IC1[t]==c1*UC1'[t],UC1[t]==U2[t]-U3[t],IC2[t]==c2*U2'[t],Uz==U3[t]};
pocPodminky={UC1[0]==0,U2[0]==0};
rceVse=Union[rceProudy,rceSoucastky,pocPodminky];
nezname=Union[Cases[rceVse,_Symbol[t],{0,∞}]];

res=NDSolve[rceVse,nezname,{t,0,0.08},StartingStepSize->(10^(-30))]

(*zde zacina pate cviko*)

(*obvod z D.U.*)
ClearAll["Global`*"]
IZ=Tanh[100*Sin[314*t]];
Uz=100*Sin[314*t];
R1=1000;
R2=2500;
c1=10*(10^(-6));
c2=15*(10^(-6));
rceProudy={IZ==IR2[t],IR2[t]==IC1[t]+IC2[t],IC1[t]+IU[t]==IR1[t]};
rceSoucastky={U3[t]==IR1[t]*R1,U1[t]-U2[t]==R2*IR2[t],IC1[t]==c1*UC1'[t],UC1[t]==U2[t]-U3[t],IC2[t]==c2*U2'[t],D[Uz==U3[t],t]};
pocPodminky={UC1[0]==0,U2[0]==0,U3[0]==0};
rceVse=Union[rceProudy,rceSoucastky,pocPodminky];
nezname=Union[Cases[rceVse,_Symbol[t],{0,∞}]];
res=NDSolve[rceVse,nezname,{t,0,0.08},StartingStepSize->(10^(-15))];

Plot[{Uz,(U2[t]-U3[t])/.res,U2[t]/.res},{t,0,0.08},PlotStyle->{{Black,Thick},{Blue,Thick},{Red,Thick}}, AxesLabel->{"t","Uz Uc1 Uc2 (V)"},GridLines->Automatic]
Plot[{IZ,IC1[t]/.res,IC2[t]/.res},{t,0,0.08},PlotStyle->{{Black,Thick},{Blue,Thick},{Red,Thick}}, AxesLabel->{"t","Iz Ic1 Ic2 (A)"},GridLines->Automatic]

(*pate cviko*)

ClearAll["Global`*"]
ω=314;
Uz=230 (Sqrt[2]) Sin[ω t+0.1];
R=1000;
L=1;
c=100*(10^(-6));
rceUzly={IU[t]==IR[t],IR[t]==IL[t],IL[t]==IC[t]};
rceSoucastky={U1[t]-U2[t]==R IR[t],U2[t]-U3[t]==L*IL'[t],IC[t]==c*U3'[t],U1[t]==Uz};
pocPodminky={U3[0]==0,IL[0]==0};
rceCelkem=Union[rceUzly,rceSoucastky,pocPodminky];
tmax=0.08;
nezname=Cases[rceCelkem,_Symbol[t],{0,∞}]//Union;
res=NDSolve[rceCelkem,nezname,{t,0,tmax},StartingStepSize->(10^(-15))][[1]];
Plot[IR[t]/.res,{t,0,tmax},PlotStyle->{Red,Thick}, AxesLabel->{"t (s)","I (A)"},GridLines->Automatic]

f[a_,b_]:=a*b
f[3,5]

"vysledek je "<>ToString[Sin[0.5]]

Off[FindMaximum::"eit"]
f[fi_]:=Module[{ω,t,Uz,R,L,c,IU,IR,IL,IC,U1,U2,U3,tmax,rceUzly,rceCelkem,rceSoucastky,pocPodminky,res,nezname,maximum},
ω=314;
Uz=230 (Sqrt[2]) Sin[ω t+fi];
R=1000;
L=1;
c=100*(10^(-9));
rceUzly={IU[t]==IR[t],IR[t]==IL[t],IL[t]==IC[t]};
rceSoucastky={U1[t]-U2[t]==R IR[t],U2[t]-U3[t]==L*IL'[t],IC[t]==c*U3'[t],U1[t]==Uz};
pocPodminky={U3[0]==0,IL[0]==0};
rceCelkem=Union[rceUzly,rceSoucastky,pocPodminky];
tmax=0.08;
nezname=Cases[rceCelkem,_Symbol[t],{0,∞}]//Union;
res=NDSolve[rceCelkem,nezname,{t,0,tmax},StartingStepSize->(10^(-15))][[1]];
maximum=FindMaximum[{Abs[IR[t]/.res],0<t<0.005},{t,0}];
Plot[IR[t]/.res,{t,0,tmax},PlotStyle->{Red,Thick}, AxesLabel->{"t (s)","I (A)"},GridLines->Automatic,PlotLabel->"Maximum je "<>ToString[maximum[[1]]]<>" A, v čase "<>ToString[t/.maximum[[2]]]<>" s"]
]

f[0.3]