factorization problem



The problem came from this:

I'd like to have one unique routine that simplifies both of the following expressions to zero.

sqrt((1+sqrt(2))^2)-(1+sqrt(2));
sqrt((1+sqrt(2))^2)-sqrt(1+2*sqrt(2)+2);

I tried
sqrt((1+sqrt(2))^2)-(1+sqrt(2));  --> output: 0
but
sqrt((1+sqrt(2))^2)-sqrt(1+2*sqrt(2)+2); --> output -sqrt(2^(3/2)+3)+sqrt(2)+1

Compared with this:
sqrt(expand((1+sqrt(2))^2))-(1+sqrt(2)); --> output: sqrt(2^(3/2)+3)-sqrt(2)-1
and
sqrt(expand((1+sqrt(2))^2))-sqrt(1+2*sqrt(2)+2); --> output: 0

Thanks for your help!


Am 23.11.2012 um 22:33 schrieb Stavros Macrakis <macrakis at alum.mit.edu>:

> I believe that the only factorization that Maxima does over quadratic integers is over Z[sqrt(-1)], the Gaussian integers, using the function gcfactor.  In general (as you probably know), quadratic integers don't have unique factorizations.
> 
> If you're interested in this topic, you might want to look at: http://www.math.uconn.edu/~kconrad/blurbs/gradnumthy/quadraticgrad.pdf .  It would be great if you could implement the relevant algorithms for Maxima!
> 
>             -s
> 
> On Fri, Nov 23, 2012 at 3:39 PM, Ren? K?lin <renekaelin at gmx.ch> wrote:
> Hello
> 
> Is it possible to factor 1+2*sqrt(2)+2? I'd like to get (1+sqrt(2))^2.
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> 
>