Python package simplifies algebraic equations

Programming Snapshot – SymPy

© Lead Image © Andrea Danti,

© Lead Image © Andrea Danti,

Article from Issue 248/2021

Whether he's filling the bathtub with water or routing electricity through resistors – Mike Schilli juggles mathematical formulas with the assistance of the Python SymPy package.

I still remember a traumatic event as an elementary school student: A weekend newspaper had set a logic puzzle for kids, the solution of which it promised to publish in the next issue a week later. It involved a bathtub with two taps: one of which filled the tub in 10 minutes, the other in 15. The question was how long would it take to fill the tub if both taps were turned on all the way.

As a little boy, I was absolutely sure that 10 plus 15 equals 25, which is 25 minutes. My father laughed and suggested that couldn't be true, because two taps would fill the bathtub faster than one alone. The next weekend, I was initially triumphant, because there it was – printed in black and white in the following issue – the confirmation that 25 minutes was the correct solution.

But disillusionment followed one week later: After receiving angry reader comments, the newspaper had to admit that it had made a mistake, because it does not take 25 minutes, but only 6 minutes, to fill the tub with both taps. I nearly fell off my chair and decided at that point to become a famous columnist peddling logic puzzles.


Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Hard Disk Dashboard

    To keep an eye on the remaining disk space during storage-intensive operations, you can check out this speedometer/odometer written in Go.

  • Chip Shot

    We all know that the Fyne framework for Go can be used to create GUIs for the desktop, but you can also write games with it. Mike Schilli takes on a classic from the soccer field.

  • Maxima

    This free algebra tool helps you keep ahead of the calculations.

  • Gnumeric

    OpenOffice Calc is fine for most spreadsheet applications, but if you’re looking for better performance and a smaller footprint, try Calc’s lean competitor, Gnumeric.

  • Unmasking Fake Flash Memory

    When it comes to cheap flash memory, buyers should beware. Fake flash memory often offers only a fraction of the advertised storage capacity. With no visible calibration mark, it isn't easy to discover a counterfeit. Here's a test to weed out fake disks.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95