Fixed bug in Triangle function + algebraic simplification.
Merge pull request #3 from kagislason/dev/kagislason/bug/1

Fixed bug in Triangle function + algebraic simplification. I simply trust you here.