LISP · FREE BILINGUAL BOOK

Design and Structure of a CAS

Symbolic Programming in LISP. From the first lists to a system that differentiates and simplifies algebraic expressions.

20 chapters · 5 appendicesCAS.LSPES / EN
Symbolic algebra and expression trees
THE MANUAL

Opening up symbolic algebra

This free manual brings together two learning paths: programming in LISP and understanding how a computer algebra system works. The goal is to build a small, readable CAS in which each operation can be traced from the mathematical expression to the lists and functions that implement it.

The first nine chapters develop the language tools: symbolic expressions, lists, exact arithmetic, control flow, recursion and lexical closures. Example programs show how to compose solutions from functions before moving on to algebra.

The second part represents expressions as trees and builds substitution, numeric evaluation and symbolic differentiation. Smart constructors, like-term collection and product simplification then turn results into more manageable expressions. Canonical ordering and infix printing complete the journey.

The manual also explains architectural decisions and the system’s limits: it does not aim to replace a general-purpose CAS. Five appendices collect language references, architecture, errors, CAS functions and the complete CAS.LSP source. It is free to read in Spanish or English, with the code available on GitHub.

THE JOURNEY

Learn the language. Build the system.

PART I / CHAPTERS 1–9

Learning LISP through MyLISP

  1. What Is MyLISP?

    The language and its philosophy.

  2. First Steps

    Setup, the REPL and first expressions.

  3. The LISP Data Model

    Atoms, pairs, lists and evaluation.

  4. Numbers and Exact Arithmetic

    Integers, rationals and numeric limits.

  5. Working with Lists

    Traversal, transformations and trees.

  6. Control Flow

    Conditions and selective evaluation.

  7. Functions and Lexical Closures

    LAMBDA, recursion and environments.

  8. Strings, PRINT and LOAD

    Text, output and loading programs.

  9. Program Gallery

    Algorithms and functional composition.

PART II / CHAPTERS 10–20

Building a CAS

  1. Representation and Data Abstraction

    Algebraic expressions as trees.

  2. Substitution and Numeric Evaluation

    Replace symbols and compute values.

  3. Symbolic Differentiation

    Translate differentiation rules into LISP.

  4. Smart Constructors

    Simplify as each expression is built.

  5. Canonical Order and Like Terms

    Group terms and their coefficients.

  6. Full-Tree Simplification

    Apply SIMP from the leaves to the root.

  7. Product Simplification

    Combine constants, bases and exponents.

  8. DERIVA and DERIVAEN

    Compose differentiation, simplification and evaluation.

  9. Stable Canonical Order

    Order expressions with EXPLESS?.

  10. Infix Printing

    Display readable mathematics with PRINTMAT.

  11. The CAS and Its Limits

    A usage guide and the boundaries of the system.

FROM LISTS TO MATHEMATICS

The same expression, two ways to see it

To a CAS, a formula is also a data structure. The expression 3x² can be written as a LISP list. The program walks that tree, applies differentiation rules and simplifies the result.

LISP
(DERIVA '(* 3 (POT X 2)) 'X)
; → (* 6 X)

(SIMP '(+ X X))
; → (* 2 X)
MATHEMATICAL RESULT

d/dx (3x²) = 6x

x + x = 2x

Examples of differentiation and simplification using the functions developed in the manual.

ES / EN · CAS.LSP

Read, run and explore

The complete manual, free to read

Open the Spanish or English edition on GitHub, with all twenty chapters and five appendices. The repository also includes the CAS.LSP implementation and PCAS.LSP tests.