RobinHankin / clifford

5 stars 0 forks source link

dual number vignette #97

Closed RobinHankin closed 3 months ago

RobinHankin commented 3 months ago

It would be good to explicitly compare the work here with the dual package, specificially the nice example in the README file which shows how the derivative is vectorized, unlike the approach used here. I don't think it's better or worse, just different. But in any case it would be good to document this clearly. For the record, Satore uses the following example:

library("dual")
x <- dual(f = 1.5, grad = c(1:0, 0))
y <- dual(f = 0.5, grad = c(0:1, 0))
z <- dual(f = 1.0, grad = c(0, 0:1))
exp(z - x) * sin(x)^y / x
#> Real: 0.403847
#> Duals: -0.658759 -0.001013 0.403847

See how the package nicely gives a (vector) gradient at $(1.5,0.1,1)$. It would be nice to reproduce this with clifford idiom, if only to show how it might be done [and also that my approach currently needs to use %/%, see issue #96].

RobinHankin commented 3 months ago

fixed in 54fe34c