Recently, I was doing proof-by-induction exercises for a course I was taking. As a practice problem, I found myself with the following equation:

So…my next step was to determine whether this equation is true or false. This is easy enough: I could use use basic algebra to expand/factor both sides until they match.

The thing is, I’m lazy. I’d rather have a program tell me whether or not an equation is true.

Enter Sage—an open-source math library that has a python-based command-line interface. To install it on Ubuntu Linux, I simply ran:

sudo apt install sage

Once installed, you I was able to run `sage`

on the command line; e.g.,

~$ sage ┌─────────────────────────────────────────────────────────────┐ │ SageMath version 7.2, Release Date: 2016-05-15 │ │ Type "notebook()" for the browser-based notebook interface. │ │ Type "help()" for help. │ └─────────────────────────────────────────────────────────────┘ sage:

I entered the following, to test my equation:

k=var('k') bool( (k/2)*(3+5*k)+(5*(k+1)-1) == ((k+1)/2)*(3+5*(k+1)) )

The result was:

True

Advertisements