Here is an example of what happens when one makes a mistake.
There is a good implementation of a function, and there is one where a sign went wrong. This is a rather common occurrence.
Check carefully if you can spot the difference. You can hardly tell the two plots apart ;) You can only tell which one is right if you have some expectations of what the end product is supposed to look like.