7

Not really. I have a bad history of asking math questions on stack overflow. And I've been down-voted many times for asking math questions. For example, I asked: How does using log10 correctly calculate the length of a integer? because I wanted to figure out how to create a program that involved finding the length of a number. This question ended up being closed, which I am kind of disappointed about. But I think it would have been otherwise if I added some programming vocabulary to make it "appear" like a programming question.

I am trying to be a better programmer through actually understanding the code - and understanding the code requires understanding the mathematics of the code. I feel like I should be awarded (versus blamed) for my efforts in setting forth mathematical questions that will help future programmers in doing things like calculating the length of an integer.

So to prevent myself from being even more bad - I would like to ask: What is the separator between math and programming?

It seems like they are more alike than they are different!

[ADDED]

I think people are not understanding the point of my question, so let me rephrase:

  • StackOverflow is a Q&A site for programmers
  • MathSE is a Q&A site for mathematicians
  • Asking a question on StackOverflow will have answers from a programmer's point of view
  • Asking a question on MathSE will have answers from a mathematician's point of view
  • Answers from MathSE will use language that is optimized for mathematicians
  • Answers from StackOverflow will use language that is optimized for programmers
  • I am a programmer

Given the above statements, do you think it is in my best interest to go to a math-centered Q&A website? I don't want the mathematician's response (because I am not a mathematician) - I want the programmer's response. Mathematicians will introduce terminology that a programmer will not understand (and vice versa). Hence, Stijn - you are correct in saying that it is a question for MathSE (it obviously is), but the MathSE answer will not be the StackOverflow answer (at least for my purposes, because I am not a mathematician).

Programmers should have a separate haven for themselves when it comes to mathematics because they have their own language, style, and practice. It maximizes the greatest possible good to have an answer that is: (1) correct; (2) appropriate. The answer to my math questions on MathSE will be correct, but will not be appropriate. The answer to my math questions on StackOverflow will be BOTH correct and appropriate.

[added again]

@Servy - You're using a lot of reductio ad absurdums that aren't fair. Let me illustrate using a real-life experience: I happen to be a college student that majors both in computer science and philosophy. For both majors, you are required to take a logic class. So I had to take TWO different classes on the same subject of logic - and the course content was EXACTLY the same. However, the delivery of the class was COMPLETELY different. If you are a computer science major at my school (and only a computer science major), you don't take the philosophy logic class (and vice versa). And the reason is obvious: you're not a part of that crowd and the class will not be optimized for you because it will be delivered from a philosophical standpoint (a nightmare to most CS majors). So, yes you are right: I would not ask a question about cooking eggs on StackOverflow just to receive a programmer's response, but I would try to ask a purely mathematical question in the context of programming and try to probe answers that are in the context of programming. To bring myself back to my point - don't tell me to learn the terminology when the terminology does not apply to me. The next time you have a question about logic, maybe you should go ask both a philosophy professor and a CS professor for the answer - trust me, if you are a programmer, you will appreciate the CS answer a lot better, even though they will both give the same answer. The same here applies: if I have a question about mathematics, I will appreciate the programmer's answer more than the mathematician's answer (even though the answer will be the same).

There exist: (1) questions about pure mathematics; (2) questions about programming; (3) questions within the blurry distinction between math and programming; (4) questions about everything else. My math question was in the third category: "How does using log10 correctly calculate the length of a integer" - it is within the blurry distinction because the question was closed and opened again and half the people thought it was a legitimate question and half the people did not. Asking about cooking eggs is in the fourth category - so I don't think your reductio works well here.

19
  • 7
    Its got nothing to do with code though. It's a list of mathematical operations and asking us to explain the result. Of course all parts of maths have been used in programs, but it's still maths. If your question had been "how do I find the length of an integer?" that would have been programming related, but you'd probably have been given a bunch of different answers. Instead you've asked "Here's a formula for calculating the length of an integer, can you explain the maths?"
    – OGHaza
    Jul 22, 2014 at 9:12
  • yes - but I honestly think there's a difference between asking "why does 2*(2^2) return 8" and asking "How does using log10 correctly calculate the length of a integer?". My question seems to have more significance to a programmer. Programing the length of an integer is a very common occurrence in programming in general. But how do you even create such a program if you don't even have the mathematical understanding behind doing so? Jul 22, 2014 at 9:20
  • Yes! That is what I asked! And that is exactly what I wanted to ask! One of the first steps in programming is to first understand what you are trying to code! I did not include pretentious programming vocabulary or ask to give an answer using a programming language because I was not at that step in understanding. I wanted to first have a mathematical basis before going to the next level of implementing it using a programming language. I feel like I should be able to to ask a question at every stage of the programming process - whether it's the before-programming part or after-programming part. Jul 22, 2014 at 9:25
  • 1
    Evidently 5 people agree with you :P
    – OGHaza
    Jul 22, 2014 at 10:02
  • 5
    "think there's a difference [...]" you do understand that log10 is a mathematical definition that is used in many sciences? It wasn't "invented" for programming.
    – user247702
    Jul 22, 2014 at 10:24
  • @Stijn - the person above me edited his response, he was saying that the question "why does 2*(2^2) return 8", while it uses programming notation, it is not related to programming and that the question is simply pure maths. (This also brings up another problem with stackoverflow, people can edit their comments, and this edit can sometimes cause a non-sequitur). Jul 22, 2014 at 13:53
  • @OGHaza - before 5 people agreed with me, my post said "Post Closed as "off-topic" by Yu Hao, templatetypedef, Tieson T., Benjamin Bannier, High Performance Mark" - there were 6 other people that disagreed with me before the 5 people agreed with me. (Which brings up another problem with stackoverflow, there are too many moderators and and only few people are needed to close a question - it causes instability). Jul 22, 2014 at 14:04
  • @Stijn again - I know it wasn't "invented" for programming, but I am trying to argue that log10 is - at the minimum - somewhat significant to a programmer. Jul 22, 2014 at 14:07
  • 3
    @user2926999 Eating is significant to programmers, without being able to eat we'd die. Breathing is significant to programmers too. That doesn't mean asking how to breathe is a programming question, or an appropriate question for SO. Programming questions that involve math are on topic. Math questions that don't involve programming are not, even if some program might use said math.
    – Servy
    Jul 22, 2014 at 14:57
  • @Servy - read my edited question Jul 22, 2014 at 17:22
  • 2
    @user2926999 You're asking a math question. It's going to have a math answer. Programming has nothing to do with the question, not does programming termanology. If you don't understand the terms used in an answer to your math question then you need to either learn those terms, or respond to the answers indicating that you don't understand them, as you would with any answer you didn't understand on any site. You can't ask "how do I cook eggs?" on SO just because "you want answers to use programming terminology." It's not a programming question, so it doesn't belong on SO. Period.
    – Servy
    Jul 22, 2014 at 17:26
  • 2
    "I feel like I should be awarded [...]" for asking an entry level math question that anybody who learned about logarithms in school should be able to solve by himself in 10 minutes? Surely not. That you think the question is about programming does not make it so. Just because the math is used by programmers to achieve certain tasks does not make it on topic - maybe if you have problems writing a log function, but not if you simply don't understand it. And that you assume you won't be able to understand an answer from math.SE doesn't mean you should ask on SO instead either.
    – l4mpi
    Jul 22, 2014 at 19:48
  • 1
    You didn't ask a math question in the context of programming though. You asked a math question in the context of mathematics. You want a mathematical answer, not a programming answer. Nothing about the question that you have is in any way, shape, or form programming related. None of the terminology is programming terminology, it's all mathematical terminology. If you have questions or concerns implementing your mathematical problem in a program then it could be on topic. That's not your question though.
    – Servy
    Jul 22, 2014 at 20:17
  • 1
    You took my example and pretty much just ignored it. You freely admit that you can't just take any old topic and ask for a "programmer's perspective" on that otherwise non-programming related question. This is no different. It's a non-programming related topic and you want a programmers opinion on that non-programming related topic. That's not what SE is about. You need to ask the question somewhere in which it's on topic.
    – Servy
    Jul 22, 2014 at 20:18
  • 1
    "... hinders the aim of StackOverflow, which is to help programmers" - Where did you get that impression? The goal of SO is not to help individual users, it is to create a high-quality repository of answers to common programming problems. A (not always appropriate) analogy for the SO model would be "programming wikipedia in Q/A format". And while your question is certainly far from the worst questions on SO nowadays, it still does not really fit this goal and the focus of the site.
    – l4mpi
    Jul 23, 2014 at 15:14

3 Answers 3

6

I believe the key issue is one of language. If I were trying to ask or answer the number-of-digits question in Math.SE I would do so very differently from if I were trying to ask or answer it in SO. (My first degree was in mathematics, but I'm also a practical programmer with master's and doctorate in computer science).

Questions in Math.SE are expressed in mathematical terms, with expressions in a Latex-like syntax, and answers often using mathematical notation and terminology. Questions and answers in SO are expressed in a combination of English and programming jargon, with as little use of mathematical notation and terminology as possible.

Questions about why an algorithm works are in the overlap between the two sites, but I think the choice of site should be based on the choice of language and viewpoint. If the question is expressed in mathematical notation, and the person asking it wants an answer in mathematical terms, it should go on Math.SE. If the question is in programmer terminology, and the asker wants an answer in similar form, it fits better in SO than Math.SE.

There is a risk that being on-topic for two sites may result in algorithm design questions being considered marginal to off-topic on both. Math.SE has a category "There are certain subjects that, while still on-topic here, might be better addressed by one of our sister sites" with one of the entries "Algorithm implementation/design, computer simulation and modelling, etc — Stack Overflow".

5

but I honestly think there's a difference between asking "why does 2*(2^2) return 8" and asking "How does using log10 correctly calculate the length of a integer?"
[...]
I know it wasn't "invented" for programming, but I am trying to argue that log10 is - at the minimum - somewhat significant to a programmer.

It's not a secret that having knowledge of maths can be helpful for a programmer. It's still maths though. With some minor rewording of your question, someone with the necessary maths knowledge can answer it while knowing nothing about programming.

Original:

WHY does taking the log10() of a number, flooring that number, adding 1, and then casting it into an int correctly calculate the length of number?

Modified:

Why does the floor of the common logarithm of an integer, increased by 1, calculate the amount of digits of a number?

Or:

Why does floor(lg(x)) + 1 calculate the amount of digits of x?

The answers to your question support this, they contain no programming at all. Your question belongs on Math.SE, not on SO.

6
  • 1
    Being on-topic on Math.SE is no hindrance to being on-topic here. Anyway, are you sure it is on-topic there? You don't seem to be involved with that crowd at all. Jul 22, 2014 at 16:12
  • Math.SE expects mathematical expressions to be put in LaTeX-like syntax, not simple text, which could be a problem for many programmers trying to say "floor(lg(x)) + 1" there. Jul 22, 2014 at 18:23
  • @PatriciaShanahan - that is a great point. I did not even think about that, the delivery of the answer is different between the programming community and the math community. Hence, users should be able to ask math questions and not be "off-topic" because the method of delivery is different for the two different communities. Jul 22, 2014 at 18:29
  • 1
    @Deduplicator I know in theory SE sites should be considered separately, so "being on-topic on Math.SE is no hindrance to being on-topic here", but I'd be more tolerant for the opposite: if it's off-topic there, it could be tolerated here. I know this is controversial, but for questions that are clearly touching two domains, both sides rejecting an otherwise reasonably clear and fair question doesn't seem to be benefiting anyone. (I must also admit I have similar view regarding questions that are off-topic on SF.)
    – Bruno
    Jul 22, 2014 at 18:52
  • @Bruno According to Math.SE "Algorithm implementation/design, computer simulation and modelling, etc" is in the category of "on-topic here, might be better addressed by one of our sister sites" with Stack Overflow as the recommended site. The example is an algorithm design question, of the form "Why does this algorithm work?" Jul 22, 2014 at 19:06
  • @Deduplicator I cannot be sure because indeed I don't have an account there. /help/on-topic says they welcome questions about "Understanding mathematical concepts and theorems". OP basically asked how logarithms work.
    – user247702
    Jul 22, 2014 at 20:51
-5

Math is required all the time for programming, it is the ultimate programmers tool, therefore math questions in a programming context are on topic.

6
  • I so would like to hear why some consider math not important for programming. No comments though... Jul 22, 2014 at 16:17
  • 7
    @Deduplicator Who said that math wasn't important for programming? Just because math is used in programming doesn't mean all math questions are programming related. In the same way that programming is very important to mathematicians, but that doesn't make all programming questions appropriate on Math.SE. A programming question about a program that just happens to solve a math problem isn't on topic on Math.SE. A math question that happens to be used by a program isn't on topic on SO. SO is for programming questions, Math is for Math questions.
    – Servy
    Jul 22, 2014 at 17:28
  • @Servy - thank you for the discussion, I added more input (again) to my original post. Jul 22, 2014 at 18:21
  • I think you might need to emphasize a different part of your answer. Math questions are only on-topic on Stack Overflow if they're in a programming context, in my opinion.
    – user456814
    Jul 22, 2014 at 18:34
  • 1
    @Cupcake, edited, but I doubt it will help those purists who think programming is only about syntax. Nothing amazes me more than all the questions on programming tools with close votes. Jul 22, 2014 at 18:36
  • 1
    @LanceRoberts I agree generally with what you're saying here, but the question referred to in this Meta.SO question didn't seem particularly programming oriented. I'd probably tolerate it on SO, but I wouldn't say it's the right place. In contrast, I'd consider other mathematical questions about numerical precision or about speed of convergence of some algorithm implementation to be on-topic. Although SE sites should be evaluated on their own rules, I'd be more flexible here if Math.SE deemed such question there off-topic (if "too applied" perhaps).
    – Bruno
    Jul 22, 2014 at 18:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .