Re: [sage-support] Re: Simplify square root of square

2015-02-27 Thread Paul Royik
Thank you! On Friday, February 27, 2015 at 5:41:07 PM UTC+2, vdelecroix wrote: > > Here is one way... not sure it is the best > > sage: eq1 = sqrt(cos(4*x)+1) > sage: eq2 = eq1.simplify_trig() > sage: eq2 > sqrt(8*cos(x)^4 - 8*cos(x)^2 + 2) > > The next step consists in factoring what is insi

Re: [sage-support] Re: Simplify square root of square

2015-02-27 Thread Vincent Delecroix
Here is one way... not sure it is the best sage: eq1 = sqrt(cos(4*x)+1) sage: eq2 = eq1.simplify_trig() sage: eq2 sqrt(8*cos(x)^4 - 8*cos(x)^2 + 2) The next step consists in factoring what is inside the sqrt: sage: o = eq2.operands()[0] sage: of = o.factor() sage: o 8*cos(x)^4 - 8*cos(x)^2 + 2 s

[sage-support] Re: Simplify square root of square

2015-02-27 Thread Paul Royik
OK. Let x is real. How to rewrite sqrt(cos(4x)+1) into sqrt(2)abs(cos(2x))? On Friday, February 27, 2015 at 3:36:59 PM UTC+2, Simon King wrote: > > Hi Paul, > > On 2015-02-27, Paul Royik > wrote: > > What is the way to consistently simplify square roots of squares? > > > > Examples: > > > >

Re: [sage-support] Re: Simplify square root of square

2015-02-27 Thread Vincent Delecroix
But... sage: eq = sqrt((pi-5)^2) sage: eq.canonicalize_radical() pi - 5 And as you can read from the documentation """ Choose a canonical branch of the given expression. The square root, cube root, natural log, etc. functions are multi-valued. The "canonicalize_radical()" method will cho

[sage-support] Re: Simplify square root of square

2015-02-27 Thread Simon King
Hi Paul, On 2015-02-27, Paul Royik wrote: > What is the way to consistently simplify square roots of squares? > > Examples: > > sqrt((x+1)^2) - > x+1 > sqrt(cos(4*x)+1) -> sqrt(2)cos(2x) Simplification must not change the value of the expression. sqrt(x^2) is certainly not equal to x. Even under