Funk - symbolic differentiation

Following is a Funk program, a symbolic differentiation program.

It was written on a trial and error basis, without much computer algerbra

theory. The point is to show off Funk, not how little I know about computer

algebra.

Funk is an extremely simple and elegant language / formal system. It can be

completely defined in a few paragraphs, just like URMs or Turing machines.

But it is nevertheless a high level symbolic computation language, like Lisp

and Prolog, except that arithmetic is not built in and it is far simpler.

Funk is a pure symbol processing language. It backtracks to find multiple

solutions like Prolog. It can be viewed as a very natural an extension of a

finite state machine viewed as a digraph of states.

Please visit my web site. I have an ulterior motive: I need a collaborator

in the further development of Funk. Funk sits on the borderline between

computing and mathematics. So I need someone so inclined. But comments

are also welcome.

-Dave Davis

www.davestuff.org or www.spc.edu/~davis_d

Look under Computing, then under Funk.

============================================================================

: start

=> D tan u .

x .

: x : y : z

Const .

Func .

- - x => x .

- x .

sin + x y => + * sin x cos y * sin y cos x .

sin x .

cos + x y => + * cos x cos y - * sin x sin y .

cos x .

tan x => / sin x cos x .

exp + x y => * exp x exp y .

exp x .

ln * x y => + ln x ln y .

ln x .

D Const => 0 .

D sin x => * cos x D x .

D cos x => - * sin x D x .

D exp x => * exp x D x .

D + x y => + D x D y .

D * x y => + * D x y * x D y .

D / x y => / + * y D x - * x D y * y y .

D x .

^ x + y z => * ^ x y ^ x z .

^ x y .

* + x y z => + * x z * y z .

* - x y => - * x y .

* 0 x => 0 .

* 1 x => 1 .

* x 0 => 0 .

* x 1 => x .

* x x => x ^ 2 .

* x + y z => + * x y * x z .

* x * y z => * * x y z .

* x - y => * - x y .

* x y .

/ / x => x .

/ x 1 => x .

/ x x => 1 .

/ x 0 => DIV_ZERO .

/ x y .

+ * cos x ^ 2 y * sin x ^ 2 y => y .

+ 0 x => x .

+ x 0 => x .

+ x + y z => + + x y z .

+ x y .

: Const

0 . 1 . a . b .

: Func

u . v .