Ask Your Question

tarix29's profile - activity

2021-03-18 16:03:48 +0200 marked best answer Function composition not working

I'm experiencing some strange behavior when composing two basic functions. My OS is Windows 10. Here is an example:

sage: r=var('r')
sage: s=var('s')
sage: f(r)=r**2
sage: g(r)=r**(1/2)
sage: f(g(r))
sqrt(r)
sage: f(g(s))
s

Whenever I evaluate the functions at the variable they were defined with (or even if just the outer function was defined with it), Sage returns the inner function as the result. This seems to happen only when the two functions are inverses of each other, since it behaves as expected with $f(r)=r^2$ and $g(r)=r^{1/3}$, returning $r^{2/3}$.

Is this a known issue? Is this somehow expected behavior? Thanks for any help.

2021-03-18 16:03:48 +0200 received badge  Scholar (source)
2021-03-18 16:00:01 +0200 received badge  Supporter (source)
2021-03-18 12:48:48 +0200 received badge  Nice Question (source)
2021-03-18 11:52:31 +0200 received badge  Student (source)
2021-03-18 11:01:35 +0200 asked a question Function composition not working

Function composition not working I'm experiencing some strange behavior when composing two basic functions. My OS is Win