Using SymPy


SciPy / Havana

In case I get to go to SciPy / Havana, I'm boning up on SymPy, an important component within the SciPy Ecosystem.

Here's the kind of thing one might do with SymPy, a computer algebra system:


In [1]:
import sympy as sym

In [2]:
x = sym.symbols('x')
sym.init_printing()

In [3]:
sym.Integral(sym.sin(x), (x, 0, sym.pi))


Out[3]:
$$\int_{0}^{\pi} \sin{\left (x \right )}\, dx$$

In [4]:
sym.Integral(sym.sin(x), (x, 0, sym.pi)).doit()


Out[4]:
$$2$$

In addition, we have numpy, with its multi-dimensional array object. Numpy comes with a host of numeric recipes, already built in...


In [5]:
import numpy as np

What are the ethics of using CAS in a poorly developing country, such as the United States, known for high infant mortality and poverty rates?

Not everyone can easily afford a TI N-spire, and schools tend to not provide adequate computer infrastructure, even for accessing free and open source tools.

Fortunately, even without a TI, we have CAS in the form of the SciPy ecosystem. Adapting a solution from a CAS blog post, Quadratics and CAS, I was able to derive the same solution for the coefficients a, b and c.


In [6]:
np.polyfit(x=[10,5,-2],y=[210, 40, -30], deg=2)


Out[6]:
array([  2.,   4., -30.])

But don't we want algebra students to be able to derive the solution manually? Yes, we do. However, once this step becomes a means to an end, rather than an end in itself, a CAS will save time and facilitate deeper explorations.

For further reading: