Question: Intersections in the plane

intersections := proc(P, Q, T)
local R, W, w, t, a, b, sol, buff, v;
sol := []; if T = Y then W := X; else W := Y; end if;
R := resultant(P, Q, T);
print(`Résultant :`);
print(R);
w := fsolve(R, W); t := [];
for v in [w] do t := [op(t), fsolve(subs(W = v, P), T)]; end do;
for a in [w] do for b in [t] do if T = Y then buff := abs(subs(X = a, Y = b, P)) + abs(subs(X = a, Y = b, Q));
printf(`X=%a,   Y=%a   --->  %a\\n`, a, b, buff); if buff < 1/100000000 then sol := [op(sol), [a, b]]; end if;
else buff := abs(subs(X = b, Y = a, P)) + abs(subs(X = b, Y = a, Q));
printf(`X=%a,   Y=%a   --->  %a\\n`, b, a, buff); if buff < 1/100000000 then sol := [op(sol), [b, a]];
end if; end if; end do; end do;
printf(`Nombre de solutions :  %a\\n`, nops(sol)); print(sol); end proc;
Try with :
intersections(X^2 + Y^2 - 1, X - Y, X); Would you like to develop this procedure which does not give the number of solutions ?Thank you.

Please Wait...