I think your method of building facalg (before including derivatives) is off. For the equation in the Maple paper, you wind up with 19 elements in `facalg`, I think you just want `x*log(x)*sin(f(x))`, `cos(f(x))`, and `x*cos(f(x))**2`. Basically, do an `.as_numer_denom()`, expand the numerator and denominator, then take each term.