| 1 | initial version |
To answer your second question:
sage: f(x) = x^2+5
sage: g(x) = 25*sqrt(x+1)
sage: g(f(x))
25*sqrt(x^2 + 6)
sage: f(g(x))
625*x + 630
sage: h(x) = f(g(x))
sage: h
x |--> 625*x + 630
The first one is harder, because Piecewise functions were implemented long before we even had symbolic functions, and hence are missing a lot of functionality. This is a long-standing need, but it takes a certain expertise in both the old and new code, as well as Ginac, to do this.
(To the cognoscenti - sympy seems to have piecewise functions, but I can't find much documentation, just obscure hints that they are there. How powerful are theirs?)
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.