# 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:*

Thermistor, whose name is derived from a combination of

thermal and resistor, is a temperature sensing device that registers changes in internal resistance as a function of temperature. Thermistors are often chosen over thermocouples because they are more accurate, have a shorter response time, and are generally cheaper. For most applications, thermistors are the smart and easy selection for temperature sensing below 300 degrees Celsius. In our case, we will be using a Negative Temperature Coefficient (NTC) thermistor, where the resistance decreases as the temperature increases. NTC thermistors are most common in commercial products that operate in the tens of degrees like thermostats, toasters, and even 3-D printers. An NTC 3950 100k thermistor will be used, which is designed for 100kOhm resistance at 25 degrees Celsius. This tutorial will introduce methods for relating resistance to temperature by fitting factory calibration data. The performance of the thermistor will also be evaluated using an Arduino board and a simple Newton’s law of cooling experiment.