9. ZADATAK

g=9.81;

h=1.8;

v0=180*(1000/(60*60));

l=23.77;

H=91.4/100;

Računamo ugao da loptica padne na kraj terena: 
-> L(l,0)

x=l;
y=0;

Solve[y==-(g/(2*(v0^2)*(((Cos[ϕ0]))^2)))*(x^2)+((Sin[ϕ0])/(Cos[ϕ0]))*x+h, ϕ0]

-0.029041441543885348`/Degree

ϕ0 = -0.029041441543885348` rad = -1.66395 °

Računamo ugao da loptica udari u mrežicu: 
-> L'=((l/2),H)

x1=(l/2);

y1=H;

Solve[y1==-(g/(2*(v0^2)*((Cos[ϕ0])^2)))*(x1^2)+((Sin[ϕ0])/(Cos[ϕ0]))*x1+h, ϕ0]

ϕ0 = -0.05112374091583397` rad = -2.92917 °

-> Za -2.92917 °< ϕ0 ≤ -1.66395 °  loptica će završiti u polju protivnika

10. ZADATAK

g=9.81;

h=10;

l=15;

ϕ0=0;

Kola će pasti u tačku  L (15, 0) -> x = 15, y = 0

Clear[v0]

Solve[0==-(g/(2*(v0^2)*((Cos[ϕ0])^2)))*(15^2)+((Sin[ϕ0])/(Cos[ϕ0]))*15+h, v0]

10.505355776935877`/(1000/3600)

-> v0=10.5054 (m/s)=37.8193 (km/h)

11. ZADATAK

bezijerovaKriva[pts_]:=Module[{n},
n=Length[pts]-1;
Expand[Sum[Binomial[n,i]*(t^i)*(((1-t))^(n-i))*pts[[i+1]],{i,0,n}]]];

bezijerovaKriva[{{1,1},{2,2},{4,-1}}]

Show[Graphics[{
BezierCurve[{{1,1},{2,2},{4,-1}}],
{Red,Point[{{1,1},{2,2},{4,-1}}]},
{Green,Line[{{1,1},{2,2},{4,-1}}]}
}],PlotRange->{{-5,5},{-5,5}},Axes->True]

->α(t)=(1+2 t+(t^2),1+2 t-4 (t^2))

12. ZADATAK

bezijerovaKriva[{{1,-1},{2,0},{4,-1},{0,0}}]

Show[Graphics[{
BezierCurve[{{1,-1},{2,0},{4,-1},{0,0}}],
{Red,Point[{{1,-1},{2,0},{4,-1},{0,0}}]},
{Green,Line[{{1,-1},{2,0},{4,-1},{0,0}}]}
}],PlotRange->{{-5,5},{-5,5}},Axes->True]

->α(t)=(1+3 t+3 (t^2)-7 (t^3),-1+3 t-6 (t^2)+4 (t^3))

13. ZADATAK

p0={2,3};

p1={-1,4};

p2={3,0};

p3={1,-2};

tacke={p0,p1,p2,p3};

a)

α=bezijerovaKriva[tacke]

Show[Graphics[{
BezierCurve[tacke],
{Red,PointSize[Medium],Point[tacke]},
{Green,Line[tacke]}
}],PlotRange->{{-5,5},{-5,5}},Axes->True]

->α(t)=(2-9 t+21 (t^2)-13 (t^3),3+3 t-15 (t^2)+7 (t^3))

b)

α1=D[α,t]

(*tangentni vektor u p0*)

α1/.{t->0}

p0p1=p1-p0

(-9, 3)~(-3, 1)

(*tangentni vektor u p3*)

α1/.{t->1}

p2p3=p3-p2

(-6, -6)~(-2, -2)

c)

Proveravamo da li su vektor pravca tangente u tački α(1/2) i vektor p0p3 proporcionalni .
Tangenta u tački α(1/2) ima vektor pravca α’(1/2).

α1/.{t->(1/2)}

p0p3=p3-p0

((9/4),-(27/4)) i (-1,-5) nisu proporcionalni -> tangenta u tacki  α(1/2) i prava p0p3 nisu paralelne

d)

v={-7,-11};

p2novo=p2+v;

αnovo=bezijerovaKriva[{p0,p1,p2novo,p3}]

αnovo1=D[αnovo,t]

αnovo1/.{t->(1/2)}

αnovo1(1/2)={-3,-15}, p0p3={-1,-5} 
{-3,-15}~{-1,-5}  -> tangenta u tacki  αnovo(1/2) i prava P0P3 jesu paralelne

15. ZADATAK

tacke={{7,-8},{-11,10},{7,46},{34,37},{16,1}};

t=2/3;

DeKasteljau[t_,tacke_]:=Module[{pts,n},
n=Length[tacke]-1;
pts=tacke;
For[k=1,k≤n,k++,{
For[i=1,i≤ n-k+1,i++,{
pts[[i]]=(1-t)*pts[[i]]+t*pts[[i+1]]
}]
}];
pts[[1]]
]

DeKasteljau[t,tacke]

16. ZADATAK

tacke={{2,-3},{0,3},{2,9},{8,7}};

a)

α1={{2,-3}};

α2={{8,7}};

n=3;

t=(1/2);

For[k=1,k≤n,k++,{
For[i=1,i≤ n-k+1,i++,{
tacke[[i]]=(1-t)*tacke[[i]]+t*tacke[[i+1]];
If[i==1,α1=Insert[α1,tacke[[i]],k+1]];
If[i==n-k+1,α2=Insert[α2,tacke[[i]],k+1]];
}]
}]

α1

α2

b)

α1novo={};

α1novo=Insert[α1novo,α1[[1]],1]

n=Length[α1]-1;

For[i=1,i≤n,i++,{
tacka=(i/(n+1))α1[[i]]+(1-i/(n+1))α1[[i+1]];
α1novo=Insert[α1novo,tacka,i+1]
}]

α1novo=Insert[α1novo,α1[[n+1]],n+2]

Crtanja Bezijerove krive sa kontrolnim tačkama pt1,pt2,...
1.način
	 -> BezierCurve[{pt1,pt2,...}]
2.način 
	-> ParametricPlot[BezierFunction[{pt1,pt2,...}][t],{t,0,1}]

Show[Graphics[{
{Red,PointSize[Large],Point[α1]},
{Green,Line[α1]},
{Orange,PointSize[Large],Point[α1novo]},
{Green,Dashed,Line[α1novo]}
}],ParametricPlot[BezierFunction[α1][t],{t,0,1}],PlotRange->{{-5,5},{-5,7}}, Axes->True
]