Using ForwardDiff in Julia gives me the following values for 2 matrices A matrix Julia

B matrix Julia

I have tried to use JAX to auto differentiate the same function in Python but I am getting the following results for A and B respectively A matrix Python

B matrix Python

Both results have the same structure but have different values. Are both results equivalent or is this incorrect?

PS. I have also tried a finite difference library (numdifftools) in the python version and its giving me the same results as JAX

  • 2
    $\begingroup$ Yes, you are right. For the past 2 days, I had missed that one of my parameter values was different in Python. Now both answers are the same. Thank you for your response. I am new to stackexchange, would you suggest that I delete this question as it was a trivial error on my part? If not, you could post this as an answer and I'll choose it $\endgroup$
    – user693129
    Apr 20 at 11:21
  • $\begingroup$ Glad I could help! I posted my comment as an answer. $\endgroup$ Apr 20 at 11:57
  • 2
    $\begingroup$ I’m voting to close this question because this is an error on the user side with no benefit for the community. $\endgroup$
    – Dan Doe
    Apr 22 at 7:51

1 Answer 1


Are you sure the implementations of the function that you wish to differentiate return the same results both in Julia and Python? That seems the first place to look for bugs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.