1+1

a=2

(*strednik potlacuje vystup*)
b=3;

(*prostup k helpu ci informacim o promennych*)
?b

(*math. vraci co nejjednosdussi ekvivalentn9 vysledek a tady to jinak nejde*)
Sin[5]

Sin[5.]

(*vycisleni presnych vysledku*)
N[Sin[5]]

(*funkce casto pretizene*)
N[Pi]
N[Pi,100]

?N

(*mezera znamena nasobeni*)
kyncl je vul
kyncl*je*vul

(*jmena promennych temer libovolna
NEPOUZIVAT podtrzitko!!!
jmeno promenne nesmi zacinat cislici
*)
opice12
12opice
12*opice

(*sikovne jsou "escape sequence"
zkuste si
esc pi esc*)
π

(*nebojte se, zapisy nekdy vapadaji silene, ale vsechno pochopime*)
Sin[π]
π//Sin
Sin@π

?Solve

Solve[x^13==5.6,x];

(*ctrl ^striska*)
(x^13)

(*ctrl a / da zlomek*)
(6/2)

(*ctrl a 2 da druhou odmocninu*)
(Sqrt[27])

(*obcas potrebujeme smazat nejakou promennou*)
Solve[x=3]
Solve[x==3,x]
ClearAll[x];
Solve[x==3]

(*smaze definice vsech nami zavedenych promennych*)
ClearAll["Global`*"];
Integrate[(x^17)*Sin[(x^2)],x]

DSolve[y'[x]+(Sqrt[y[x]])==1,y[x],x]

(*informace napriklad o specialnich funkcich na www.mathworld.com*)

Plot[x*Sin[(x^(-1))],{x,-2Pi,2Pi},PlotRange->All]

(*zde zacina druhe cviko*)

Table[i,{12}]

Table[i,{i,12.5}]

Table[i,{i,2.5,12.6}]

(*Table[co,{iterator,dolni mez, horni neprektocitelna mez,krok}]*)
i=5;
Table[{i,(i^2)},{i,0.4,2.7,0.2}]

nFci=10;
amin=0.123;
amax=0.89;
krok=((amax-amin)/(nFci-1));
Print["krok= ",krok];
sudeFce=Table[((((x^2)))^a),{a,amin,amax,krok}];
kolikJichJe=Length[sudeFce];
Print["fci je ",kolikJichJe,"  a ma jich byt ",nFci]

(*vyplotime si je pro -1<x<1*)
Plot[sudeFce,{x,-1,1},AxesLabel->{"x","y[x]"}];

(*"x" a "y[x]", jsou Stringy *)

{Head["x"],Head[x]}

x=6;
y[x_]=Sin[x];
(*takhle ne, popisy os radeji Stringy*)
Plot[sudeFce,{x,-1,1},AxesLabel->{x,y[x]}];

(*barvy popsane Hue[parametr]*)
(*Hue je funkce realne promenne a ma periodu rovnou jedne*)
Hue[0.4]

Graphics[{Hue[0.4],Disk[{0,0},{3,4}]}];

Manipulate[Graphics[{Hue[hue],Disk[{0,0},{3,4}]}]
,{hue,0,1}
];

Manipulate[
y=Sin[hue];
Graphics[{Hue[y],Disk[{0,0},{3,4}]}]
,{hue,0,1}
];

sudeFce

ClearAll[x];
nFci=10;
amin=0.123;
amax=0.89;
krok=((amax-amin)/(nFci-1));
Print["krok= ",krok];
sudeFce=Table[((((x^2)))^a),{a,amin,amax,krok}];
kolikJichJe=Length[sudeFce];
Print["fci je ",kolikJichJe,"  a ma jich byt ",nFci]

hueMin=0;
hueMax=0.8;
krokHue=((hueMax-hueMin)/(nFci-1));
barvicky=Table[Hue[hue],{hue,hueMin,hueMax,krokHue}]

Plot[sudeFce,{x,-1,1},AxesLabel->{"x","y[x]"},PlotStyle->barvicky]

Quiet@Remove["Global`*"];
$HistoryLength=2;
xmin=0.;
xmax=2Pi;
nBodu=30;
Δx=((xmax-xmin)/(nBodu-1));
body=Table[{x,Sin[x]},{x,xmin,xmax,Δx}];
pl1=ListPlot[body,AxesLabel->{"x","Sin[x]"},PlotStyle->{Yellow,PointSize[0.02]}];
pl2=Plot[Sin[x],{x,xmin,xmax},PlotStyle->Black,AxesLabel->{"x","Sin[x]"}];
{Show[pl1,pl2],Show[pl2,pl1]}

Quiet@Remove["Global`*"];
$HistoryLength=2;
uhelOtoceni=(Pi/43);
maticeRotace=(({{Cos[uhelOtoceni], -Sin[uhelOtoceni]}, {Sin[uhelOtoceni], Cos[uhelOtoceni]}}));
xmin=0.;
xmax=2Pi;
nBodu=30;
Δx=((xmax-xmin)/(nBodu-1));
body=Table[{x,Sin[x]}.maticeRotace,{x,xmin,xmax,Δx}];
pl1=ListPlot[body,AxesLabel->None,PlotStyle->{Red,PointSize[0.02]},Axes->False,PlotRange->{{-2Pi*(Sqrt[2]),2Pi*(Sqrt[2])},{-2Pi*(Sqrt[2]),2Pi*(Sqrt[2])}}]

Quiet@Remove["Global`*"];
$HistoryLength=2;

Manipulate[

maticeRotace=(({{Cos[uhelOtoceni], -Sin[uhelOtoceni]}, {Sin[uhelOtoceni], Cos[uhelOtoceni]}}));
xmin=0.;
xmax=2Pi;
nBodu=30;
Δx=((xmax-xmin)/(nBodu-1));
body=Table[{x,Sin[x]}.maticeRotace,{x,xmin,xmax,Δx}];
pl1=ListPlot[body,AxesLabel->None,PlotStyle->{Red,PointSize[0.02]},Axes->False,PlotRange->{{-2Pi*(Sqrt[2]),2Pi*(Sqrt[2])},{-2Pi*(Sqrt[2]),2Pi*(Sqrt[2])}},AspectRatio->1]
,{uhelOtoceni,0.,2Pi}]

(*zde zacina treti cviko*)
Quiet@Remove["Global`*"];
$HistoryLength=2;
SetDirectory[NotebookDirectory[]];

Quiet@Remove["Global`*"];
eqn=(x^2)+2y+1+x*y==0;
sol=Solve[eqn,x];
vysledky=Simplify[(x^2)-1/.sol];
Print["vyjdou dva vysledky: ",vysledky]

(u^2)-1/.{{u->4},{u->5},{u->6}}

Solve[eqn,x]

Quiet@Remove["Global`*"];
sol=DSolve[{y'[t]+2y[t]== Sin[t],y[0]==1},y[t],t];
proPlot=(Sqrt[((y[t])^2)+1])/.sol[[1]];
Plot[proPlot,{t,0,15},PlotRange->All]

Quiet@Remove["Global`*"];
g=9.81;
{vx0,vy0}={10,20};
rce={0==x''[t],-g==y''[t],0==x[0],vx0==x'[0],y[0]==0,y'[0]==vy0};
nezname={x[t],y[t]};
reseni=DSolve[rce,nezname,t][[1]];
proParametricPlot=nezname/.reseni;
tmax=t/.FindRoot[0==y[t]/.reseni,{t,10}];
plDraha=ParametricPlot[proParametricPlot,{t,0,tmax},AxesLabel->{"x[t]","y[t]"},PlotStyle->{Thickness[0.003],Black},GridLines->Automatic];
bod[t_]=Graphics[{PointSize[Large],Red,Point[nezname/.reseni]}];
Manipulate[
Show[plDraha,bod[t]]
,{t,0,tmax}
]

(*zde zacina crvrte cviko*)

Attributes[Sin]

Attributes[Plot]

myR:=0.01Round[100#]&;

Quiet@Remove["Global`*"];
a=0.1;
rce={v'[t]==a,v[0]==0,s'[t]==v[t],s[0]==0};
sol=DSolve[rce,{v[t],s[t]},t][[1]];
s[t_]=s[t]/.sol;
v[t_]=v[t]/.sol;
tmax=t/.FindRoot[v[t]==(140/3.6),{t,100}];
Print["140km/h dosahne za ",tmax," s,  tj za ",(tmax/60)," minut"];
Plot[{(10^3)v[t],s[t]},{t,0,tmax},AxesLabel->{"t [s]","s[m]  (10^3)v[m/s]"},PlotStyle->{Red,Blue},GridLines->Full]

mm=0.001;
r=((920mm)/2);
fi[t_]:=((s[t])/r);
y[t_]:=r*Cos[fi[t]];
x[t_]:=r*Sin[fi[t]]+s[t];
polohovyVektor[t_]:={x[t],y[t]};
zrychleniCelkem[t_]:={x''[t],y''[t]};

Plot[Sin'[t],{t,0,6}];
Plot[Evaluate[D[Sin[t],t]],{t,0,6}];