Refer https://github.com/symengine/symengine/pull/797/ and wrap it to replace the code [here](https://github.com/symengine/symengine.rb/blob/master/lib/symengine.rb#L6). It will also involve writing the C wrapper for the function.