Prolog - Simple Symbolic Differentiator. |
|
The symbolic differentiator gives the correct answer as the first solution (it is not in simplified form but that could be achieved). However other incorrect "solutions" are also output. These are caused by the rule diff(Y, X, 0) being too general. It only holds if not (X=Y). Negative Information.
It is a good exercise to write Prolog to simplify the result of differentiation, for example, to replace times(1, x)) with x. Just in case you were wondering, the differentiator cannot be run backwards to get an integrator, which is a pity. It is possible to write a program to perform symbolic integration in Prolog, but it is far from easy – in any programming language – if more than polynomials must be handled. |
|
↑ © L. Allison, www.allisons.org/ll/ (or as otherwise indicated). Created with "vi (Linux)", charset=iso-8859-1, fetched Saturday, 20-Apr-2024 09:55:38 UTC. Free: Linux, Ubuntu operating-sys, OpenOffice office-suite, The GIMP ~photoshop, Firefox web-browser, FlashBlock flash on/off. |