I have a code that is tens of lines long, aimed at quite a specific task, and I don't know why it isn't behaving the way I expect so as to be able to narrow the problem. My question would be a more sophisticated version of "this no work ****code dump**** why no work?" What is the policy/attitude to such questions?

Normally (with a few exceptions) I try to simplify my questions to this site to make them as general as possible and focussed on the key problem I'm facing. This forum has been incredibly helpful and I've learnt a great deal. Recently I have thrown myself in the deep end in an attempt to develop something sophisticated (for me) but am frustrated at not being able to debug my current issue. I'm tempted to ask this site but am hesitant as it might be asking too much and only really help me, rather than serve as a useful question for the community.

| |
  • 8
    At the very least, I am glad that you had the courtesy to ask first instead of thoughtlessly foisting a monolith upon us. Nevertheless: are you really, truly unable to break up the code into more manageable chunks? It will do wonders for both maintainability and sanity (yours and ours). – J. M.'s discontentment Jun 27 '16 at 10:30
  • Basically I am developing a code that (one day) solves for the transmission probability of an arbitrary Hamiltonian for a potential step or potential barrier tunnelling problem. In tests it seems to work well for the potential step but not the barrier, it is unable to find solutions for certain angles of incidence. I don't really know when or where the problem occurs. I suppose if could take the output of the main block of code for a particular example and ask "why can't Solve solve this?" but maybe the problem occurs earlier. I might give that a try. – Tom Jun 27 '16 at 10:36
  • Another point: do you not have a toy problem (i.e. something with a well-known and easily verified solution) that you can use to help you see whatever is crapping out in your code? – J. M.'s discontentment Jun 27 '16 at 10:48
  • Yes, my code recreated well known results for single layer graphene, and seemed to be spitting out reasonable results for bi-layer graphene and a step potential, but Solve seems to be struggling with bi-layer graphene Hamiltonian and a barrier. I guess there's a lot of conditions it has to solve but still I don't know why it can't solve them. – Tom Jun 27 '16 at 10:52
  • Is it possible that your code is making assumptions that are reasonable for the toy problem, but are not satisfied in general? – J. M.'s discontentment Jun 27 '16 at 10:55
  • Possibly, but not that I'm aware. – Tom Jun 27 '16 at 10:57
  • When I ask about code blocks, I break them up into small sections: see here mathematica.stackexchange.com/questions/61844/… – QuantumDot Jun 29 '16 at 8:47

You must log in to answer this question.

Browse other questions tagged .