Hi all,<br><br>I'm trying to go through the paper Beautiful Differentiation by Conal Elliott and got a bit stuck. So I decided to download the VectorSpace package, which as far as I know implements the paper, and just try and play around with it. Unfortunately when I tried the simple examples at the beginning of the paper I got an error:<br>
<br>Prelude Data.VectorSpace> :m Data.Derivative<br>Prelude Data.Derivative> let f1 z = sqrt(3*sin z)<br>Prelude Data.Derivative> f1 (D 2 1)<br><br>Top level:<br> Couldn't match expected type `Data.VectorSpace.Scalar a'<br>
against inferred type `Data.VectorSpace.Scalar<br> (Data.VectorSpace.Scalar a)'<br> NB: `Data.VectorSpace.Scalar' is a type function, and may not be injective<br>
<br><interactive>:1:0:<br> No instances for (Data.MemoTrie.HasTrie (Data.Basis.Basis a),<br> Floating (Data.VectorSpace.Scalar a),<br> Data.VectorSpace.VectorSpace (Data.VectorSpace.Scalar a))<br>
arising from a use of `f1' at <interactive>:1:0-9<br> Possible fix:<br> add an instance declaration for<br> (Data.MemoTrie.HasTrie (Data.Basis.Basis a),<br> Floating (Data.VectorSpace.Scalar a),<br>
Data.VectorSpace.VectorSpace (Data.VectorSpace.Scalar a))<br> In the expression: f1 (D 2 1)<br> In the definition of `it': it = f1 (D 2 1)<br><br><interactive>:1:8:<br> No instance for (Num<br> (a Data.LinearMap.:-* (a :> Data.VectorSpace.Scalar a)))<br>
arising from the literal `1' at <interactive>:1:8<br> Possible fix:<br> add an instance declaration for<br> (Num (a Data.LinearMap.:-* (a :> Data.VectorSpace.Scalar a)))<br> In the second argument of `D', namely `1'<br>
In the first argument of `f1', namely `(D 2 1)'<br> In the expression: f1 (D 2 1)<br><br>Which was completely incomprehensible to me. I tried looking at the documentation but I couldn't find anything about actually using the library. Does anyone have any experience using this library and maybe have some examples of it's use?<br>
<br>Thanks<br><br>Chris Witte<br>