Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
14305: Doctest: Immediate simplifications of symbolic powers
Browse files Browse the repository at this point in the history
  • Loading branch information
rwst committed Sep 6, 2017
1 parent f34394d commit 6125bd6
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/sage/symbolic/expression.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3787,6 +3787,21 @@ cdef class Expression(CommutativeRingElement):
sage: x^sin(x)^cos(y)
x^(sin(x)^cos(y))
Immediate simplifications are applied::
sage: x = SR.symbol('x', domain='real')
sage: (x^3)^(1/3)
(x^3)^(1/3)
sage: (x^4)^(1/4)
abs(x)
sage: (x^8)^(1/4)
x^2
sage: (x^-4)^(1/4)
1/abs(x)
sage: (x^-8)^(1/4)
x^(-2)
sage: forget()
TESTS::
sage: (Mod(2,7)*x^2 + Mod(2,7))^7
Expand Down Expand Up @@ -7698,6 +7713,33 @@ cdef class Expression(CommutativeRingElement):
sage: (x^2).sqrt()
sqrt(x^2)
Immediate simplification are applied::
sage: sqrt(x^2)
sqrt(x^2)
sage: x = SR.symbol('x', domain='real')
sage: sqrt(x^2)
abs(x)
sage: forget()
sage: assume(x<0)
sage: sqrt(x^2)
-x
sage: sqrt(x^4)
x^2
sage: forget()
sage: x = SR.symbol('x', domain='real')
sage: sqrt(x^4)
x^2
sage: sqrt(sin(x)^2)
abs(sin(x))
sage: sqrt((x+1)^2)
abs(x + 1)
sage: forget()
sage: assume(x<0)
sage: sqrt((x-1)^2)
-x + 1
sage: forget()
Using the ``hold`` parameter it is possible to prevent automatic
evaluation::
Expand Down

0 comments on commit 6125bd6

Please sign in to comment.