liveBook · Manning

Computer algebra system

As explained in Geometry for Programmers

A computer algebra system is software that performs exact or symbolic mathematical manipulation and computation.

A computer algebra system performs exact or symbolic mathematical manipulation and computation. Instead of rearranging equations by hand, you define symbols, provide equations, and ask the system to solve them. SymPy supplies this workflow as a Python module and aims to become a full-featured computer algebra system. section 1.6

A practical symbolic workflow is:

  • Import SymPy and define symbolic quantities such as speeds, distances, and time. section 1.6
  • Translate the situation into equations, preserving relationships such as total distance and relative speed. section 1.6
  • Pass the equations and unknowns to solve, then inspect the numeric or symbolic result. section 1.6

Solving a two-train problem

Let Va be the Amsterdam train’s speed and Vp the Paris train’s speed. A 450-kilometre separation and a one-hour meeting time produce Va + Vp = 450; the faster train’s speed produces Vp = 2Va. SymPy returns Va = 150 and Vp = 300. Replacing the fixed values with symbols such as D, t, and Vpx yields reusable formulas rather than one numeric answer. section 1.6

Listing 1.1 Numeric solution in SymPy
from sympy import *
 
Va, Vp = symbols('Va Vp')    #1
 
solution = solve([
    Vp - Va * 2,
    Va * 1 + Vp * 1 - 450
], (Va, Vp))
 
print(solution)

Run the compact SymPy listing to see symbolic variables, equation solving, and printed results in one executable example. section 1.6

How Geometry for Programmers covers it

How deep it goes
Explains symbolic setup, equation solving, numeric results, generalized formulas, and code export, but not system internals.
Examples
Uses a two-train speed problem, numeric and symbolic equation systems, and executable SymPy listings.
What it assumes
Assumes elementary equations, coordinate planes, functions, and readable Python snippets, while deferring higher mathematics and library familiarity.
What you can do after
Apply it via SymPy to encode equations and obtain numeric or reusable symbolic solutions.
How it connects
Connects symbolic mathematics with Python, SymPy, Matplotlib, and NumPy.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Geometry for Programmers. The section links point to the parts of the book it draws on.