Closed powei-lin closed 1 year ago
Thank you for the feedback! The problem here is that in your first example x[0] and y[0] have different data types (a float and a dual number). In that case the returned array can't be converted in the Python/Rust interface which produces that error message.
The most pragmatic fix is exactly what you are doing in the third example because it ensures that all data types are the same. The error message could me more precise, though!
This should work, but it shows,
TypeError: argument 'f' must return a list. For scalar functions use 'first_derivative' or 'gradient' instead.
Change to
gradient
. GotTypeError: argument 'f' must return a scalar. For vector functions use 'jacobian' instead.
But after adding a zero y to the first return then it works.