Skip to content

wjur/sym-diff-prolog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 

Repository files navigation

sym-diff-prolog

Symbolic Differentiation Implementation in Prolog
Wojtek Jurczyk, Warsaw University of Technology

About

Sym-diff-prolog is an implementation of symbolic differentiation using Prolog. It is a bit optimized (it has arithmetic operations optimised; see the source code) but the implementation is still very simple. I hope you will find it useful for learning Prolog. Enjoy!

Functionality

It is capable of calculating derivatives of:

  • basic functions
  • sum of functions
  • subtraction of functions
  • multiplication of functions
  • division of functions
  • powers (thus, square root)
  • logarithmic and exponential functions
  • some trigonometric functions

Any other functions can be easily added to the code :)

Examples

Let's ask about some derivative:

| ?- diff(x^(x*log(cos(x))), x, N).

The answer we get is:

N = x^(xlog(cos(x))-1)(xlog(cos(x))+(log(cos(x))+x(-sin(x)/cos(x)))xlog(x)) ?

The answer is correct and you can check it here by calculating, using WolframAlpha, derivative - N (it should be 0, and in fact it is).

About

Symbolic Differentiation Implementation in Prolog

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages