Here are the functions I would try in cases like this:
* ratsimp
* radcan
* scanmap(factor,...)
* sqrtdenest (in the case of nested radicals)
Their behavior is somewhat different. In particular, radcan does not
introduce an abs for sqrt(x^2) (because in fact both + and - sqrts are
valid in one interpretation), so in your case, you get abs(y+x)-y-x rather
than 0.
sqrtdenest doesn't do anything in the case you mention because... there are
no nested sqrts!
scanmap(factor,...) does work in your case -- which by the way I wouldn't
characterize as "more general", just "different"!
-s
On Sat, Nov 24, 2012 at 12:09 PM, Ren? K?lin <renekaelin at gmx.ch> wrote:
> Thank you for the hint, stavros.
>
> Well, I tried a more general case:
>
> sqrt((x+y)^2)-abs(x+y); --> output: 0
> sqrt((x+y)^2)-sqrt(x^2+2*x*y+y^2); --> output: not 0
>
> Here, the sqrtdenest-function doesn't simplify both expressions to 0,
> either.
>
>
>
> Am 24.11.2012 um 17:52 schrieb Stavros Macrakis <macrakis at alum.mit.edu>:
>
> load(sqdnst)$
> sqrtdenest( sqrt((1+sqrt(2))^2)-sqrt(1+2*sqrt(2)+2) ) => 0
>
>
> This does make me wonder why radcan doesn't always use sqrtdenest in
> relevant cases. Perhaps at the time they were written (1970's), that would
> have made radcan too slow.
>
> By the way, this is a good example of why you should always tell us about
> the problem you're *really* trying to solve, not a problem you're having
> with one particular approach to solving it.
>
> -s
>
>
>
> On Sat, Nov 24, 2012 at 11:45 AM, Ren? K?lin <renekaelin at gmx.ch> wrote:
>
>> 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
>>>
>>
>>
>>
>>
>
>