> | # Anylytická geometrie - příklad |
> | # Sestrojíme elipsu procházející body [3,2],[-1,2],[-1,0],[-1,2]
restart; |
> | elipsa:=(x-x0)^2/a^2+(y-y0)^2/b^2=1; |
> | # Dosadíme body a budeme počítat xo,y0,a,b - soustava 4 rovnic o 4 neznámých |
> | x:=3;y:=2; |
> | rov1:=elipsa; |
> | unassign('x','y'); |
> | x:=1;y:=4; |
> | rov2:=elipsa; |
> | unassign('x','y'); |
> | x:=-1;y:=0; |
> | rov3:=elipsa; |
> | unassign('x','y'); |
> | x:=3;y:=0; |
> | rov4:=elipsa; |
> | unassign('x','y'); |
> | reseni:=solve({rov1,rov2,rov3,rov4}); |
> | evalf(reseni); |
> | assign(evalf(reseni[1])); |
> | el:=elipsa; |
> | m:=x0;n:=y0;aa:=a;bb:=b; |
> | with(plots): |
Warning, the name changecoords has been redefined
> | implicitplot(elipsa,x=-3..6,y=-3..5); |
> | unassign('x0','y0'); |
> | tec:=(x-m)*(x0-m)/aa^2+(y-n)*(y0-n)/bb^2=1; |
> | el; |
> | x0:=5; |
> | y0:=0; |
> | tec; |
> | el; |
> | dot:=solve({tec,el}); |
> | bod1:=dot[1]; |
> | bod2:=dot[2]; |
> | assign(bod1); |
> | xx:=x;yy:=y; |
> | with(geometry):
point(A,xx,yy),point(B,5,0): line(l,[A,B]); |
> | pr:=Equation(l,[c,d]); |
> | el; |
> | unassign('x','y'); |
> | with(plots): |
> | g1:=implicitplot(pr, c=-1..10,d=-2..5): |
> | g2:=implicitplot(el,x=-3..6,y=-3..5): |
> | display({g1,g2}); |
> |