You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should actually be fairly easy to implement a simple version of this (if we disregard all of the real world numerical problems that can arise). The major blocker for this is the fact that we don't have function types and corresponding function objects (#159), so we cannot simply write something like diff(sqrt, 1.0)
With a hypothetical syntax for function types Fn[(X1, X2, X3, …) -> X_return], we could even implement numerical diff in Numbat itself using the new builtin unit_of function:
let eps = 1e-10fndiff<X,Y>(f:Fn[(X) -> Y],x:X) -> Y / X =
(f(x + eps · unit_of(x)) - f(x)) / (eps · unit_of(x))
Obviously, we would like to have something a little bit more sophisticated for production though.
We still can't do the generic version though, because our handling of generics in function types is not yet powerful enough. We can't even pass a generic function like sqrt to the non-generic diff function.
It should actually be fairly easy to implement a simple version of this (if we disregard all of the real world numerical problems that can arise). The major blocker for this is the fact that we don't have function types and corresponding function objects (#159), so we cannot simply write something like
diff(sqrt, 1.0)
With a hypothetical syntax for function types
Fn[(X1, X2, X3, …) -> X_return]
, we could even implement numerical diff in Numbat itself using the new builtinunit_of
function:Obviously, we would like to have something a little bit more sophisticated for production though.
For a concrete function, this already works:
The text was updated successfully, but these errors were encountered: