How to solve this in SMath