51

While doing research in statistics, sometimes I came across complex integration that I can't or don't want to solve analytically.

Is it okay to use Mathematica to solve the integration and use the result in my research? Do I need to report this in the academic article? My qualm is that perhaps I am supposed to be able to solve these things by hand.

(Some context: I'm from the social sciences and thus unfamiliar with what's permitted regarding these tools.)

8
  • 21
    I am not sure I understand the question. Is there any rule in social science that says you are not supposed to use any tools to solve math problem? (I am not in social science)
    – Nobody
    Jun 19, 2016 at 10:09
  • 2
    I'm 100% ignorant about what's kosher since this situation has never come up. Whenever I take quantitative class, the implicit assumption is that I have to do the math by hand, hence my hesitation. Perhaps the answer is indeed "duh, why don't you use it?"
    – Heisenberg
    Jun 19, 2016 at 10:11
  • 14
    It is as much OK as the use of R, Excel, MATLAB or your pocket calculator to do computations with numbers - so, yes, but some knowledge of what can go wrong and how you can validate or sanity check results is helpful.
    – Dirk
    Jun 19, 2016 at 12:00
  • 6
    My point is that, for the correctness of a mathematical proof, it is irrelevant how you found the antiderivative, you just need to prove that it is an antiderivative, which is usually a lot easier.
    – user38662
    Jun 19, 2016 at 12:36
  • 2
    Besides what @Stefan said, numerical integration is usually not a big issue if the integrand is reasonably smooth, since we would usually be interested in an approximate value anyway, and there is such a wide variety of software for numerical integration that one could even get away with saying "numerically evaluated".
    – user21820
    Jun 19, 2016 at 13:43

3 Answers 3

78

Is it okay to use Mathematica to solve the integration and use the result in my research?

Of course it is.

It might be useful, though, to make the Mathematica code employed for the calculations available to others, either through a public repository or by a note in the paper suggesting to contact the author(s). This will allow reviewers or other readers to check your calculations, or, possibly, reuse or extend them.

In a paper where I made extensive use of Mathematica, I wrote the following note at the end:

To those interested, the authors can provide the Mathematica notebooks of the full calculations developed in this work.

13
  • 65
    For the last quote: As a reader I would probably prefer to read "The Mathematica notebooks of the full calculations can be found at..." (probably even as additional documents for the article). Would save me an inquiry and an attachment to the article would be more stable than a website or the author's email address.
    – Dirk
    Jun 19, 2016 at 12:03
  • 23
    The problem with this approach is that referees will be unable to access the notebooks without breaking anonymity (unless you proactively submit them with the manuscript as supplementary material). For what it's worth, my experience is that collaborations are more likely if you remove the additional hurdle of having to contact someone and wait for a reply (allow them to "try before they buy", if you will). Jun 19, 2016 at 13:34
  • 4
    @ChristianClason In that case, the reviewers could have required the notebooks through the editor, without breaking anonymity: notice that a general repository might not necessarily guarantee anonymity. For what concerns collaborations, in my field it works the opposite: since it's a small field, we are all quite willing to contact each other. Jun 19, 2016 at 13:43
  • 3
    @MassimoOrtolano Sure; explicitly offering to share is already more than most people do (+1). I just wanted to offer my experience (in a different field). I still stand by my recommendation to (also) to submit the documents as supplementary material to make everyone's lives easier. Jun 19, 2016 at 13:57
  • 7
    @MassimoOrtolano ya that's why I took time to rewrite my text to include "in some cases untenable". But here's another thought experiment: 50 years later you can't email someone who is dead. But if the code is attached somehow then at least you have a copy of the old code (happens in old engineering papers often where the paper that has old code is more valuable because although the code is old... it's still code that can be understood and ported).
    – syn1kk
    Jun 21, 2016 at 14:42
52

I take this question as not specific to Mathematica, but equally relevant to any other computer algebra system.

You have an integral or an equation that you cannot solve. You have a piece of software that will give you a result. But you don't know how it arrived to the result. Is it okay to use it?

What matters is whether the result is correct, not how you arrived to it. You should understand the problem you are solving, and you should verify the solution.

Personally, I would be very uncomfortable using such a result blindly, especially knowing how easily certain automated symbolic calculations, such as definite integration, can go wrong. But luckily, most of these types of results are much easier to verify than to compute. You have an indefinite integral? Differentiate it! An equation? Substitute back the solution! A definite integral? Do it numerically and compare to the symbolic solution!

Writing in your paper that "this is the result of the integral because Mathematica said so" is not okay, if you didn't verify it. Just stating the result without saying how you arrived to it is fine for as long as you have verified it and it is also obvious enough for any reader how to verify it. If it is not obvious, then prove the result in the paper, i.e. show how you verified it.


Given that you mention integration, I should point out that doing definite integrals automatically is notoriously difficult, and all computer algebra systems will occasionally return wrong results. That's a very good reason to always verify.

6
  • 20
    This is the right answer. There are certainly bugs in Mathematica. I have hit on them a few times. The source code is not open, and the bug-tracker is not public. Do not trust Mathematica's answers blindly!
    – Boris Bukh
    Jun 19, 2016 at 14:58
  • 15
    @BorisBukh Except that it is irrelevant that the code is not open ... I hear this as an argument against using Mathematica many times, but in this case I don't consider it valid. Open source systems also have bugs, and also give wrong results. I will only trust a result when it was verified in some way, but I don't particularly care if the software that produced it is open source or not.
    – Szabolcs
    Jun 19, 2016 at 15:09
  • 3
    @BorisBukh There are of course some situations when open code is important (but I don't think this is one of them). One particular example that affected me personally is Mathematica's FindGraphCommunities function. I am fairly sure about what methods it uses, but these methods are 1) not properly documented, with references and 2) the code is not open. Thus I cannot use this function and say that "the result was produced by method X described in paper Y" ... (Note that FindGraphCommunities produces a type of result which really cannot be verified without recomputation...)
    – Szabolcs
    Jun 19, 2016 at 15:11
  • 8
    Some computation (such as those of symbol antiderivative) are hard to perform, but easy to verify. For those, the implementation is relatively unimportant. For other computations, the only way to verify computation is by replicating it, or by convincing oneself that the code that produced it is bug-free. The latter is impossible if the source is closed. (Numerical integration falls into the latter category.)
    – Boris Bukh
    Jun 19, 2016 at 17:45
  • 8
    Similarly, a closed bug-tracker prevents users from quickly discovering if they experience a well-known issue. Some might even not realize that the result they get are wrong.
    – Boris Bukh
    Jun 19, 2016 at 17:45
6

As Szabolcs writes, verification is important and that's also the case if you were to do computations by hands using methods you think are reliable. There are cases of erroneous results in the peer reviewed literature that were not noticed for quite some time where researches have actually used the wrong formula taken from the published article for many years.

An example is the article by L. Chatterjee, G. Das, R. Goswami: Z. Phys. D 32, 73 (1994), a mistake was made in the computation of the cross section for the radiative capture of a charged particle in the ground state. It was an elementary math mistake due to using inconsistent branch cuts, as pointed out here. That mistake was not noted by the authors precisely because it led to a strange effect of an apparent discontinuity in the cross section, this effect was interpreted as an interesting feature of the capture cross section.

You must log in to answer this question.

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