[Haskell-beginners] Automatic Differentiation

Chaddaï Fouché chaddai.fouche at gmail.com
Sat Mar 28 07:19:06 UTC 2015


On Sat, Mar 28, 2015 at 5:10 AM, Animesh Saxena <animeshsaxena at 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
<https://hackage.haskell.org/package/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ï
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150328/ace00590/attachment.html>


More information about the Beginners mailing list