# Request for Mathematica code review: generating test cases

**URL:** <https://discourse.mc-stan.org/t/request-for-mathematica-code-review-generating-test-cases/12696>\
**Category:** Developers\
**Tags:** math\
**Created:** [January 18, 2020, 9:16pm UTC](https://discourse.mc-stan.org/t/request-for-mathematica-code-review-generating-test-cases/12696 "2020-01-18T21:16:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [January 18, 2020, 9:38pm UTC](https://discourse.mc-stan.org/t/request-for-mathematica-code-review-generating-test-cases/12696/2 "2020-01-18T21:38:05Z")

</div>

> [@martinmodrak](#):
>
> I want gold standard for both function values and derivatives w.r.t all arguments, which I hope Mathematica’s arbitrary precision math can give me.

I know a little bit of Mathematica but no more than you do. I would just reiterate a couple of things that I have said before that few people agree with:

1. I think we should be testing that known identities hold. For example, since \ln \Gamma\left(x\right) = \ln \Gamma\left(x + 1\right) - \ln x for all positive x, plug in an x to that equation and verify that the equation holds and that all derivatives of interest are the same on both sides.
2. Even better are identities that hold for integrals involving the function in question over a range of values of x, such as [http://functions.wolfram.com/GammaBetaErf/LogGamma/21/02/01/0001/MainEq1.gif](http://functions.wolfram.com/GammaBetaErf/LogGamma/21/02/01/0001/MainEq1.gif) .
3. If we want arbitrary precision tests to compare to, then the gold standard is [Arb](http://arblib.org/index.html) rather than Mathematica, because the ball arithmetic has bounds that are correct. And Arb is already in C.

---

_[View the full topic](https://discourse.mc-stan.org/t/request-for-mathematica-code-review-generating-test-cases/12696)._
