views:

188

answers:

3

I have to do a term project in my symbolic programming class. But I'm not really sure what a good/legitimate project would be. Can anyone give me examples of symbolic programming? Just any generic ideas because right now I'm leaning towards a turn based fight game (jrpg style basically), but I really don't want to do a game.

+1  A: 

A simple arithmetic interpreter in Scheme that takes a list of symbols as input:

(define (symbolic-arith lst)
  (case (car lst)
    ((add) (+ (cadr lst) (caddr lst)))
    ((sub) (- (cadr lst) (caddr lst)))
    ((mult) (* (cadr lst) (caddr lst)))
    ((div) (/ (cadr lst) (caddr lst)))
    (else (error "unknown operator"))))

Test run:

> (symbolic-arith '(add 2 43))
=> 45
> (symbolic-arith '(sub 10 43))
=> -33
> (symbolic-arith '(mu 50 43))
unknown operator
> (symbolic-arith '(mult 50 43))
=> 2150

That shows the basic idea behind meta-circular interpreters. Lisp in Small Pieces is the best place to learn about such interpreters.

Another simple example where lists of symbols are used to implement a key-value data store:

> (define person (list (cons 'name 'mat) (cons 'age 20)))
> person
=> ((name . mat) (age . 20))    
> (assoc 'name person)
=> (name . mat)
> (assoc 'age person)
=> (age . 20)

If you are new to Lisp, Common Lisp: A Gentle Introduction to Symbolic Computation is a good place to start.

Vijay Mathew
+2  A: 

This isn't (just) a naked attempt to steal @Ken's rep. I don't recall what McCarthy's original motivation for creating Lisp might have been. But it is certainly suitable for computer algebra, including differentiation and integration.

The reason that I am posting, though, is that automatic differentiation is used to mean something other than differentiating symbolic expressions. It's used to mean writing a function which calculate the derivative of another function. For example, given a Fortran program which calculates f(x) an automatic differentiation tool would write a Fortran function which calculates f'(x). One technique, of course, is to try to transform the program into a symbolic expression, then use symbolic differentiation, then transform the resulting expression into a program again.

The first of these is a nice exercise in symbolic computation, though it is so well trodden that it might not be a good choice for a term paper. The second is an active research front and OP would have to be careful not to bite off more than (s)he can chew . However, even a limited implementation would be interesting and challenging.

High Performance Mark
+4  A: 

The book Paradigms of Artificial Intelligence Programming, Case Studies in Common Lisp by Peter Norvig is useful in this context.

The book describes in detail symbolic AI programming with Common Lisp.

The examples are in the domain of Computer Algebra, solving mathematical tasks, game playing, compiler implementation and more.

Soon there will be another fun book: The Land of Lisp by Conrad Barski.

Generally there are a lot of possible applications of Symbolic Programming:

  • natural language question answering
  • natural language story generation
  • planning in logistics
  • computer algebra
  • fault diagnosis of technical systems
  • description of catalogs of things and matching
  • game playing
  • scene understaning
  • configuration of technical things
Rainer Joswig