Robert Latest <
bobl...@yahoo.com> wrote:
> Hi all,
>
> while helping my daughter with her school algebra problems I thought I might
> get some benefit for myself and dabble in some CAS. (Back when I studied
> math in the 90s I didn't even know such a thing as CAS existed, and I
> always found algebra terribly tedious).
>
> Topic of the day, circle equations. So why not try and figure out the
> intersection points (if any) of two circles.
>
> (%i1) e1: x^2 + y^2 + a*x + b*y + c = 0;
> 2 2
> (%o1) y + b y + x + a x + c = 0
> (%i2) e2: x^2 + y^2 + d*x + e*y + f = 0;
> 2 2
> (%o2) y + e y + x + d x + f = 0
>
> X and y in the two equations are the same because we're searching the point(s)
> both have in common. So here goes:
>
> (%i3) solve([e1, e2], [x, y]);
> (%o3) []
>
Using FriCAS:
(37) -> eq1 := x^2 + y^2 + a*x + b*y + c
2 2
(37) y + b y + x + a x + c
Type: Polynomial(Integer)
(38) -> eq2 := x^2 + y^2 + d*x + e*y + f
2 2
(38) y + e y + x + d x + f
Type: Polynomial(Integer)
(39) -> res := solve([eq1, eq2], [x, y])
(39)
[
(- e + b)y - f + c
[x = ------------------,
d - a
2 2 2 2 2
(e - 2 b e + d - 2 a d + b + a )y
+
2 2 2
((2 e - 2 b)f + (- a d - 2 c + a )e + b d - a b d + 2 b c)y + f
+
2 2 2
(- a d - 2 c + a )f + c d - a c d + c
=
0
]
]
Type: List(List(Equation(Fraction(Polynomial(Integer)))))
This is not an explicit solution, but arguably is more useful: intead of
two equations of order 2 in two variables you get so called triangular
system, where last equation contains only single variable and other
equations reduce to equation in single variable when you plug in
solutions of later equation. In fact, here first equation gives
you x in terms of y.
If you want it more explicit we can solve quadratic equation:
(40) -> radicalSolve(res(1)(2), y)
(40)
[
y
=
(- d + a)
*
ROOT
2 2 2 2 2
- 4 f + (4 b e + 4 a d + 8 c - 4 b - 4 a )f + (- 4 c + a )e
+
2 2 2
(- 2 a b d + 4 b c)e + (- 4 c + b )d + 4 a c d - 4 c
+
2 2
(- 2 e + 2 b)f + (a d + 2 c - a )e - b d + a b d - 2 b c
/
2 2 2 2
2 e - 4 b e + 2 d - 4 a d + 2 b + 2 a
,
y
=
(d - a)
*
ROOT
2 2 2 2 2
- 4 f + (4 b e + 4 a d + 8 c - 4 b - 4 a )f + (- 4 c + a )e
+
2 2 2
(- 2 a b d + 4 b c)e + (- 4 c + b )d + 4 a c d - 4 c
+
2 2
(- 2 e + 2 b)f + (a d + 2 c - a )e - b d + a b d - 2 b c
/
2 2 2 2
2 e - 4 b e + 2 d - 4 a d + 2 b + 2 a
]
Type: List(Equation(Expression(Integer)))
This is solved using usual quadratic formula, but since coefficients
of the quadratic are complicated the result is large. One could
plug in this y into formula for x, but result would be equally large.
Note: when you look at "general solution" there are subtleties.
You can see this already from the first solution: there is
division by d - a. And indeed, depending on the other parameters
beside normal case of two solutions there may be one solution,
no solutions or infinitely many solutions. Similarely, quadratic
formula gives "generic solution" and ignores special cases.
Normally a CAS will give you "generic solution", that is solution
which is valid as long as there are no divisions and which may
miss some special cases. Some teachers insist of analysiong
all cases, that quickly gets tedious both for people and at
somewhat larger scale for computers. If you have numbers in
the problem, than it is possible to see during computation
if there are special cases and handle such cases apropriately,
this avoids purely theoretical difficulties. OTOH if you
really need general solution, then there is some extra work
to check usual CAS solution and write proper conditions.
--
Waldek Hebisch