title: How to compute the joint probability density function from a joint cumulative density function in Jax?
body: <p>I have a joint cumulative density function defined in python as a function of a jax array and returning a single value.
  Something like:</p>
  <pre class="lang-py prettyprint-override"><code>def cumulative(inputs: array) -&gt; float:
      ...
  </code></pre>
  <p>To have the gradient, I know I can just do <code>grad(cumulative)</code>, but that is only giving me the first-order partial derivatives of cumulative with respect to the input variables.
  Instead, what I would like to do is to compute is this, assuming F is my function and f the joint probability density function:</p>
  <p><img src="https://latex.codecogs.com/gif.latex?f%28x_1%2C%5Cldots%2Cx_n%29%3D%20%5Cfrac%7B%5Cpartial%5En%20F%7D%7B%5Cpartial%20x_1%20%5Cldots%20%5Cpartial%20x_n%7D" alt="formula" /></p>
  <p>The order of the partial derivation doesn't matter.</p>
  <p>So, I have several questions:</p>
  <ul>
  <li>how to compute this efficiently in Jax? I assume I cannot just call grad n times</li>
  <li>once the resulting function is computed, will the resulting function have a higher call complexity than the original function (is it increased by O(n), or is it constant, or something else)?</li>
  <li>alternatively, how can I compute a single partial derivative with respect to only one of the variable of the input array, as opposed to the entire array? (And I will just repeat this n times, once per variable)</li>
  </ul>