Ask Your Question

Revision history [back]

It may also be useful to note that you can make assumptions about the domain using the assume function since a given function f(x) may not have an inverse on its entire domain, or it may have different inverse functions on different subdomains:

sage: f(x) = x^2
sage: assume(x<0)
sage: solve( x == f(y), y)[0].rhs()
-sqrt(x)
sage: forget()
sage: assume(x>0)
sage: solve( x == f(y), y)[0].rhs()
sqrt(x)

It may also be useful to note that you can make assumptions about the domain using the assume function since a given function f(x) may not have an inverse on its entire domain, or it may have different inverse functions on different subdomains:

sage: f(x) = x^2
sage: assume(x<0)
assume(y<0)
sage: solve( x == f(y), y)[0].rhs()
-sqrt(x)
sage: forget()
sage: assume(x>0)
assume(y>0)
sage: solve( x == f(y), y)[0].rhs()
sqrt(x)