I am trying to compose a two functions using the scypy compose()
built in function, but I keep getting wrong answers.
While using Mathematica, the built in function Composition[]
would provide an appropriate answer if I would compose a function. In Python I used compose()
function but without any luck.
Code in python
from sympy import*
x = Symbol("x")
compose(2/x,x+1)
Code in Mathematica
Composition[2/x, x + 1][x]
Python ignores the second function x+1
, and gives the result as 2/x
. If the first function would be 2*x
, then the python would result in 2*x+2
, as the composition should be.