Suppose you are working on something in a programming language (in my case, C++) that is math-related. Now, let's suppose that there was a numeric methods concept are having questions on, so you decide to "pull it off to the side" to write some code for that concept. Furthermore, let's suppose that the results of that program are unexpected (mathematically, you expect it to do something, but instead, it does the complete opposite). Should the question be posed here with a link to the code, and the math formulae you used in the code, and why you think the formulae should work, or should it instead be asked somewhere else (like StackOverflow)?
My $\$.02$: If your question is a mathematical one, and not simply a syntax or a question about the language that you're using, then it's on-topic. This assumes that the primary focus is on the mathematical model, and not the program itself. So asking about unexpected results from a numerical example is perfectly fine.
For the sake of completeness and making the question self-contained, everything pertinent to the question should be included: code you're asking about, the idea of the model, the relevant formulae, and so on.
Such a question would be on-topic here. However, another SE site Computational Science has a higher concentration of people working on cross-disciplinary problems between mathematics and programming. Consider whether your question would be a better fit there.