Symbolic differentiation

Visual Prolog is well suited for symbolic mathematics because it is easy and elegant to handle expressions as Prolog structures.

A typical dialog with the system could be

write an expression: 10*x^4

Differentiated expression:

0*x^4+10*4*x^3*1

Reduced expression:

40*x^3

 

The Diff program consist of the following parts:

  1. Scanning and parsing a string into the EXPression structure.
  2. The actual differentation
  3. reducing an expression
  4. converting an expression back to a string.

Of these parts, the reducing of an expression is the most complicated. From the Goal-section, the main parts of the program, can be examined.

tokl(STR,TOKL) : converts the string to a list of tokens.

s_exp(TOKL,OL,EXP) : used by the parser.

d(EXP,"x",EXP1) : differentiate the expression.

reduce(EXP1,EXP2) : the expression is reduced.

Diff.prj