|
From: Eduardo O. <edu...@gm...> - 2025-07-20 18:19:22
|
Hi Robert!
I have lots of students who don't know how to start from this
eq : (x-2)^2+(y+3)^2=4;
and "solve(eq,y)" it _by hand_ to obtain these two solutions
[y = -sqrt(4*x-x^2)-3, y = sqrt(4*x-x^2)-3]
in a series of steps that are easy to understand and to debug...
I have a nice way to do the steps in the blackboard/whiteboard,
including the bifurcation, and I wanted to be sure that all the kinds
of steps that I use - we only see a handful of examples - would be
easy to translate to Maxima. And apparently this is good enough:
display2d : false$
matchdeclare(x, all)$
defmatch(isx2__, x^2)$
isx2_ (o) := block([x], isx2__(o))$
isx2 (o) := not atom(isx2_(o))$
isx2_body(o) := if isx2(o) then part(isx2_(o),1,2)$
sqrtp_ (o) := if isx2(o) then isx2_body(o) else sqrt(o)$
sqrtn_ (o) := if isx2(o) then -isx2_body(o) else sqrt(o)$
sqrtp (o) := map('sqrtp_,o)$
sqrtn (o) := map('sqrtn_,o)$
(x-2)^2+(y+3)^2=4;
% - (x-2)^2; /* (y+3)^2 = 4-(x-2)^2 */
sqrtp(%); /* y+3 = sqrt(4-(x-2)^2) */
% - 3; /* y = sqrt(4-(x-2)^2)-3 */
(x-2)^2+(y+3)^2=4;
% - (x-2)^2; /* (y+3)^2 = 4-(x-2)^2 */
sqrtn(%); /* -y-3 = sqrt(4-(x-2)^2) */
- %; /* y+3 = -sqrt(4-(x-2)^2) */
% - 3; /* y = -sqrt(4-(x-2)^2)-3 */
So: it's a precalculus thing...
Cheers,
Eduardo
On Sun, 20 Jul 2025 at 14:27, Robert Dodier <rob...@gm...> wrote:
> Hi Eduardo, couple of comments about the question you posted.
>
> The conventional way to avoid name collisions with match variables is
> to give the match variables names which are unlikely to occur
> otherwise. E.g. aa, bb, cc, xx, yy, zz.
>
> It's not clear what is the larger goal towards which you are working.
> If you are trying to denest radicals, take a look at sqrtdenest. If
> you are trying to solve equations containing radicals, take a look at
> to_poly_solve. If it's something else, maybe you can say more about
> what you want to do.
>
> best
>
> Robert
>
|