Navigation  without Java Scripts

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 consists 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.

Reducing an expression is the most complicated part. 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) : differentiates the expression.
reduce(EXP1,EXP2) : the expression is reduced.

 

Execute the program as a CGI script by pressing the "Differentiate" button on the form below


   

Show Source for the Diff-application.

Show Source for the Diff-application incl. cgi-source.