I wonder what is the most useful way to answer this kind of questions.

I suspect the user copied the code from somewhere else and tried to modify it for his purposes.

Based on the question he asked in a comment under my answer, I also suspect that he isn't understanding the code he had posted, and that the answer I gave isn't really useful since it solves the problem, but the OP won't understand his "own" code anyway.

How can this kind of questions be answered in a nice and useful (for the OP at least) way?

  • I suspect there is no general answer to this, because the main difficulty seems to be that the user doesn't make clear what they are having difficulties with. That it is something unexpected is incidental; the problem is that the question is not clear. In that sense I think the only thing we can do is to try to get the user to clarify the question and focus on things they think should work, but don't, rather than things they have no idea about. Or, just give a correct answer and have faith that the user will learn from it on their own. Possibly they may need to ask more questions to do this. Mar 6, 2015 at 12:52
  • @OleksandrR. Thanks for sharing your thoughts. I don't think the question I linked is unclear. Instead I believe that answering it in a direct way is not really helping the OP. Mar 6, 2015 at 13:25
  • 1
    Well, I meant that it's unclear in the sense that the OP does not tell us what is actually giving them difficulties. Even if the question is unambiguously answerable, as in this case, the OP has still failed to convey the substance of their query. So, I think we have three options in general: (1) answer directly; (2) attempt to guess what the OP really wants and answer accordingly; (3) get OP to be more specific. You suggest (1) is not optimal, and I think it's too hard to infer any general principle from (2)--we could try, but we might not be successful. Hence I think (3) is the best option. Mar 6, 2015 at 13:51
  • 2
    How I see this working for the given example is: direct answer; close as simple mistake/TL (rather than editing the question, which risks completely changing its meaning and invalidating the answer); OP thinks about the response they got and is encouraged to ask further, more specific questions separately if they are still having difficulties. As SE isn't a good venue for tutorials, I think we cannot hope to offer what the OP really needs at this stage of their learning. We could certainly point out documentation pages/books, to give them the tools needed to do this part by themselves. Mar 6, 2015 at 14:09
  • @OleksandrR. Now you could wrap up all that in an answer :) Mar 6, 2015 at 16:24

3 Answers 3


It is likely in this case and in many similar cases of cut-and-paste programming that the OP has little or no interest in niceties of Mathematica programming. Rather he/she is interested in getting useful results in any way they can. Their real interest is in the knowledge domain they are modeling and/or satisfying an instructor or job supervisor.

In such cases, I believe getting a fix for their code is all they want. That the OP of the referenced question almost immediately accept belisarius' answer supports this assessment. Therefore, I think there is little we can do in these situations except show the OP how to make the corrections that will fix the posted code. Doing so, in my opinion, does answer the question, from the OP's point-of-view, in "a nice and useful" way.

  • 1
    +2 That's a real pragmatic answer. Perhaps that kind of pragmatism was lacking in my question. Thanks Mar 7, 2015 at 20:13

Although it's hard to make answers into tutorials, I think sometimes it can be helpful for future readers to add some text to help the OP parse the code they posted. Mathematica code can be quite hard to read, and I do think that if you already decided to answer because the fix seems easy to you, then it can't hurt to add some verbal comments.

In fact, the system sometimes flags answers containing only code and no explanations as "low-quality posts." That's not the case in your linked answer since you also included a screen shot (and engaged in the comment discussion).

So basically there is some initial decision when you look at posts like this: is it worth an answer? If no, then close it. If yes, then try to make it useful to others who are looking to learn, by taking your best guess as to what the central point is that should be explained, and frame the answer that way.

In these cases it's also common that the OP comes back with multiple follow-up questions, but at least one can reign in the discussion a little if the answer already contains some guidance. If I suspect that the OP doesn't know what they want at all, then I usually don't answer in the first place.

  • 1
    I totally agree with this. This seems to be the only way to keep the quality of the answers on the site up to our standards. We should not create more noise on the site, and such questions answered only literally are noise (and so are the literal answers), because they are very unlikely to help anyone except the asker. OTOH, they will show up in searches, and they will make it harder for future visitors to find what they need. So, the best way would indeed be either to generalize the answer to answer a whole class of such questions, or make a comment with an answer and close the question. Mar 18, 2015 at 14:05

I believe it would be good to try to enforce the requirement of a "minimial working example" for questions on this site. This is done on TeX.SE. Basically the idea is that the user making the question has the responsibility to find a clean small example (if possible) that reproduces his issue/problem. I think this is a good idea for questions where the OP has trouble with some code which produces unexpected results.

I know this doesn't directly address your question, but as a general policy, it could help to prevent questions like the one you mention.

  • The problem is we're talking about users who didn't write and don't understand the code they are stuck with. In many cases they simply won't be able to reduce it to a minimal example. Arguably the best action in cases like the one mentioned is for a more experienced user to edit the question and reduce it to a minimal example themselves. Mar 13, 2015 at 22:11

You must log in to answer this question.

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