Sitemap
Data Science Collective

Advice, insights, and ideas from the Medium data science community

Member-only story

Quick Success Data Science

Easy Quadratic Optimization with Python

Maximizing website ad revenue

12 min readJul 17, 2025

--

Press enter or click to view image in full size
Source: Microsoft Copilot

I studied mathematics between 1965 and 1981 (yes, I’m that old). Back then, most math teachers did a terrible job teaching math. In fact, around 1979, my college calculus teacher held up our new textbook and complained, “Math teachers don’t write textbooks for math students, they write them for other math teachers!” I didn’t fully appreciate this until around 2013, when I thumbed through my daughter’s 7th-grade math book and was blown away by how interesting and useful it was. I actually envied her studying math.

When I first learned the quadratic equation (ax² + bx + c = 0), I thought it was just a way to draw a parabola. That’s about all we did with it. But boy, was I wrong. This famous formula is a powerful optimization tool. Despite its simplicity, it can solve riddles like:

  • What ticket price will maximize movie theater revenue?
  • What rent should an apartment building charge to maximize monthly income?
  • What is the optimal amount of fertilizer to maximize crop yield?

In this Quick Success Data Science project, we’ll use the quadratic equation to determine the optimum number of ads a webpage needs to maximize its ad revenue.

--

--

Lee Vaughan
Lee Vaughan

Written by Lee Vaughan⁠

Author of “Python Tools for Scientists,” “Impractical Python Projects,” and “Real World Python.” Former Senior Principal Scientist at ExxonMobil.

Data Science Collective
Data Science Collective

Published in Data Science Collective

Advice, insights, and ideas from the Medium data science community