restart;
with(plots):
_EnvHorizontalName := 'x';_EnvVerticalName := 'y';
_EnvHorizontalName := x
_EnvVerticalName := y
EQ := proc (M, N) RETURN((y-M[2])/(x-M[1]) = (N[2]-M[2])/(N[1]-M[1])) end proc:
a := 5: b := 7; k := 9; A := [a, 0]; B := [0, b];
b := 7
k := 9
A := [5, 0]
B := [0, 7]
P := [t, 0]; Q := [0, k/t];
P := [t, 0]
[ 9]
Q := [0, -]
[ t]
cir := -a*x-b*y+x^2+y^2 = 0:
sol := solve(subs(y = 5, cir), x):
cen := [solve(diff(cir, x)), solve(diff(cir, y))]:
x0 := sol[1]: y0 := 5:
M := [x0, y0];
[5 1 (1/2) ]
M := [- + - 65 , 5]
[2 2 ]
R := sqrt(cen[1]^2+cen[2]^2):
beta := arctan(diff(solve(EQ(M, cen), y), x)):
eq := t^2*(y0-b)+t*(a*b-a*y0+b*x0-k)-x0*(a*b-k) = 0:
sol := solve(eq, t):
t := sol[1]: tp := sol[2]:
P1 := [t, 0]: Q1 := [0, k/t]:
PQ1 := simplify(x*(-a*b+b*t+k)+y*t*(t-a)-t*(-a*b+b*t+k)) = 0:
PQ2 := simplify(x*(-a*b+b*tp+k)+y*tp*(tp-a)-tp*(-a*b+b*tp+k)) = 0:
P2 := [tp, 0]: Q2 := [0, k/tp]:
Fig := proc (alpha)
local Dr1, DR1, Dr2, DR2, N, u0, v0, Po, t, tp, sol;
global a, b, k, cen, R;
u0 := cen[1]+R*cos(alpha); v0 := cen[2]+R*sin(alpha);
N := [u0, v0];
sol := solve(t^2*(v0-b)+t*(b*u0-a*v0+a*b-k)-u0*(a*b-k) = 0, t);
t := sol[1]; tp := sol[2];
Dr1 := simplify(x*(-a*b+b*t+k)+y*t*(t-a)-t*(-a*b+b*t+k)) = 0;
DR1 := implicitplot(Dr1, x = -4 .. 8, y = -4 .. 12, color = brown);
Dr2 := simplify(x*(-a*b+b*tp+k)+y*tp*(tp-a)-tp*(-a*b+b*tp+k)) = 0;
DR2 := implicitplot(Dr2, x = -4 .. 8, y = -4 .. 12, color = orange);
Po := pointplot([N[]], symbol = solidcircle, color = [black], symbolsize = 8);
display([Po, DR1, DR2]) end proc:
DrPQ1 := implicitplot(PQ1, x = -4 .. 22, y = -4 .. 12, color = blue):
DrPQ2 := implicitplot(PQ2, x = -4 .. 22, y = -4 .. 12, color = blue):
CIR := implicitplot(cir, x = -4 .. 8, y = -4 .. 12, color = red):
Points := pointplot([A[], B[], M[], P1[], P2[], Q1[], Q2[], cen[]], symbol = solidcircle, color = [green], symbolsize = 10):
T := plots:-textplot([[A[], "A"], [B[], "B"], [M[], "M"], [P1[], "P1"], [P2[], "P2"], [Q1[], "Q1"], [Q2[], "Q2"], [cen[], "cen"]], font = [times, 10], align = {below, left}):
n := 7:
display([seq(Fig(2*i*Pi/n), i = 0 .. n), Fig(beta), CIR, DrPQ1, DrPQ2, Points, T], scaling = constrained, size = [500, 500]):
display([Fig(beta), CIR, DrPQ1, DrPQ2, Points, T], scaling = constrained, size = [500, 500]);
I hope my program will not be transform in pap. I am trying the elements of the ellipse : focus, a, b. Thank you.

Sorry for my errors.

I tried to adapt the program to cubes

Cubes := `~`[`^`]([`$`(1 .. 10)], 3); Cubes := [1, 8, 27, 64, 125, 216, 343, 512, 729, 1000] for n from 100 to 100+13^(3) do found:=false ; for m to nops(Cubes) do for c in combinat:-choose(Cubes,m) do if add(c)=n then printf(cat("\n%d = %d^3", " + %d^3"$(m-1)),n,root~(3,c)[]); found:=true fi until found until found; if not found then printf("\n%d: no solution",n) fi od: But it doesn't work.

restart; Squares := `~`[`^`]([`$`(1 .. 12)], 2); Squares := [1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144] for n from 129 to 129+13^(2) do found=false ; for m to nops(Squares) do for c in combinat:-choose(Squares,m) do if add(x,x=c)=n then printf(cat("\\n%d = %d^2", " + %d^2"$(m-1)),n,sqrt~(c)[]); found=true fi until found until found; if not found then printf("\\n%d: no solution",n) fi od: How to avoid this message ? Error cannot determinate if this expression is true or false : found. Thank you.