Symbolic differentiation

Skip to end of metadata
Go to start of metadata

Goal: read in this: 2x^3 + x^5 + 4x + 10x + 8x + x + 2 and differentiate it:

Assume we have this grammar:

Here is the complete morph script for this example (polydiff.morph):

Add morph.jar to CLASSPATH then translate to Poly_morph.g and generate MorphExecutor.java:

Generates this key part of Poly_morph.g:

Generate code from autogenerated grammar:

Now we need a test rig:

Make sure all files are compiled:

To run, use

Then you'll get the result

Labels: