Hacker News new | past | comments | ask | show | jobs | submit login

Symbolic Computing means the computation of formulas which not only contain numbers and its operators, but also names which stand for something (a variable in some calculus, a function in some calculus, a plan operator, a note, ...). Thus McCarthy developed a language for computing with symbolic expressions: Lisp. One of the things he/they found out was that Lisp itself can be described as symbolic computation, shown by the eval procedure and by representing Lisp programs as Lisp data. But generally he had all kinds of applications in mind. One of the first applications were logic formalisms and algebra. In this case one can not only evaluate algebraic expressions, but also do computation with them...

This is from an early Computer Algebra program (Macsyma), which was written in Lisp and whose development has roots back into the 60s. Though Macsyma is written in Lisp and provides a Read-Eval-Print-Loop, it does not use s-expression-based syntax. Instead it uses a syntax, which should be familiar to most people doing algebraic calculations.

expr1 is a variable and we set it to a formula.

    (%i5) expr1:x^28 + 1;
                                         28
    (%o5)                               x   + 1
we can sum two expressions:

    (%i6) expr1 + expr1;
                                          28
    (%o6)                              2 x   + 2
exponent:

    (%i7) expr1^expr1;
                                             28
                                     28     x   + 1
    (%o7)                          (x   + 1)
Let's factor an expression:

    (%i8) factor(expr1*3);
                       4        24    20    16    12    8    4
    (%o8)          3 (x  + 1) (x   - x   + x   - x   + x  - x  + 1)
Subtract 1 and y from the expression:

    (%i9) % - 1 - y;
                        4        24    20    16    12    8    4
    (%o9)     - y + 3 (x  + 1) (x   - x   + x   - x   + x  - x  + 1) - 1
Factor the expression:

    (%i10) factor(expr1);
                      4        24    20    16    12    8    4
    (%o10)          (x  + 1) (x   - x   + x   - x   + x  - x  + 1)
Subtract 1:

    (%i11) % - 1;
                    4        24    20    16    12    8    4
    (%o11)        (x  + 1) (x   - x   + x   - x   + x  - x  + 1) - 1
Simplify it:

    (%i12) ratsimp(%);
                                           28
    (%o12)                                x
Same idea: interactive computing with symbolic expressions, this time expressions from the domain of Algebra. The language also allows us to write programs:

    (%i14) myfact(n) := if n = 0 then 1 else n * myfact(n - 1)$

    (%i15) myfact(10);
    (%o15)                              3628800
It allows us to write functions for symbolic expressions, for example to implement integration, etc.



If you like that, it lives on in the open-source "maxima" (just an apt-get install away).


I think it's a bit of a disservice to always focus symbolic computation on just mathematical equations. The strength of Lisp is that you can easily apply all of that to program statements, as source code is just a data structure.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: