# Interactive MTA/New York MetroCard Calculator to Avoid Overpaying

Below, I outline the methods used in the above chart for avoiding leftover amounts when purchasing rides on a MetroCard, as well as thresholds for purchasing unlimited rides for both 7-day and 30-day passes.

#### MTA MetroCard Information and Cost Optimization

The Metrocard bonus adds 5% to the total purchase price, which can be represented as follows:

where

*T*is the total added to the MetroCard,

*P*is the amount paid, and the 1.05 is the total plus the added 5%.

Therefore, if we want to purchase 5 rides and avoid having leftover change on the MetroCard, we need to calculate the approximate amount (in multiples of $0.05 per MTA's requirement) to add to the card to get closest to the cost of 5 rides while also incorporating the extra 5%. This can be calculated in the following manner:

### NOTE:

Remember to always round -UP- when calculating the total for the desired number of rides, otherwise you will end up with a large amount left over just shy of another ride.#### Interactive MTA/New York MetroCard Calculator Description

Using the method above and an algorithm that optimizes cost and unlimited ride options, I created the interactive chart at the top of this page that shows subway riders when to buy single purchase amounts, 7-day unlimited passes, and 30-day unlimited passes. For cases beyond 7 days in the city, I have also included an optimized mix of single pay options and 7-day options. For amounts greater than the 30-day unlimited cost, I have recommended the 30-day unlimited pass. In every case, the chart shows the rider which option is financially advantageous based on the days in the city and rides per day.

*See More in Programming and Python:*

In this tutorial, I will explore black body radiation, infrared detectors, and the relationship between temperature and emissivity - all with the intention of exploring how infrared (IR) detectors measure temperature from a distance. Arduino will be used, along with an MLX90614 IR thermometer, and a thermocouple for true-temperature approximation of each object. Planck’s discovery of energy quanta and their relationship to thermodynamics is the basis for radiation detectors and infrared temperature sensors. We will use Planck’s law to derive a usable equation that can relate the radiation measured by an infrared sensor to the temperature of a radiative object.