1 | initial version |
In addition to @slelievre 's answer, a possibility is to consider f and g as functions on the Euclidean plane:
sage: E.<x,y> = EuclideanSpace()
sage: f = E.diff_map(E, [(x^2+15*x-2) / (x+15), (x^2*y+x*y+y) / (x^2+30*x-1)])
sage: f.display()
E^2 --> E^2
(x, y) |--> ((x^2 + 15*x - 2)/(x + 15), (x^2*y + x*y + y)/(x^2 + 30*x - 1))
sage: g = E.diff_map(E, [(x^2+20*x-18) / (x+20), (x^2*y+x*y+32*y) / (x^2-31*x+14)])
sage: g.display()
E^2 --> E^2
(x, y) |--> ((x^2 + 20*x - 18)/(x + 20), (x^2*y + x*y + 32*y)/(x^2 - 31*x + 14))
Then you may compose f and g via the *
operator:
sage: h = f * g
sage: h.display()
E^2 --> E^2
(x, y) |--> ((x^4 + 55*x^3 + 962*x^2 + 4930*x - 5876)/(x^3 + 55*x^2 + 982*x + 5640), (x^6 + 42*x^5 + 478*x^4 + 1419*x^3 + 13026*x^2 - 9172*x + 11648)*y/(x^6 + 39*x^5 - 593*x^4 - 36773*x^3 - 320694*x^2 + 486956*x - 152264))
Note that the result is automatically simplified. You may access to the symbolic expressions composing the result via the method expr()
:
sage: h.expr()
((x^4 + 55*x^3 + 962*x^2 + 4930*x - 5876)/(x^3 + 55*x^2 + 982*x + 5640),
(x^6 + 42*x^5 + 478*x^4 + 1419*x^3 + 13026*x^2 - 9172*x + 11648)*y/(x^6 + 39*x^5 - 593*x^4 - 36773*x^3 - 320694*x^2 + 486956*x - 152264))
sage: h.expr()[0]
(x^4 + 55*x^3 + 962*x^2 + 4930*x - 5876)/(x^3 + 55*x^2 + 982*x + 5640)
sage: h.expr()[1]
(x^6 + 42*x^5 + 478*x^4 + 1419*x^3 + 13026*x^2 - 9172*x + 11648)*y/(x^6 + 39*x^5 - 593*x^4 - 36773*x^3 - 320694*x^2 + 486956*x - 152264)