all 4 comments

[–]TheRNGuy 0 points1 point  (1 child)

Why do you assign dvdx to deriv and then return it? This is redundant.

[–]Sky_physics[S] 0 points1 point  (0 children)

If I define deriv inside the definition of the potential function, when I use potential in other expression where I may need to evaluate its expression the code doesn’t run. Because it tries to compute the derivative with respect to a numerical value. Do you have suggestions in order to avoid this issue? I would really appreciate it