On Sat, Mar 28, 2015 at 5:10 AM, Animesh Saxena <animeshsaxena@icloud.com> wrote:
I was implementing automatic differentiation in haskell and was able to code the calculation part, but I wanted to extend it to show the symbols instead of just the final value.

Anyway now I was hoping to print the actual symbols, so I was googling around for extending “Show” typeclass for floating and Num, kinda similar pattern. Is this the right approach? Or I need to rethink the problem?
Basically my aim is to do something like mathematica where if I specify D[f[x],x] then I get the answer in symbols.


The idea would be to write a new type that transport an human readable representation as well as the actual value, then make it a Num, Floating and so on instance so that you could just use ADif with this type to get a representation of your action. You can look at simple-reflect for a simple implementation of this idea you can directly use with your ADif. If instead of a String, you transport an operation tree, you may even simplify your result and get back almost a symbolic differentiation from your automatic differentiation !

--
Jedaï