{
  "id": "rate",
  "version": "b046248682da",
  "status": "published",
  "name": "Rate Calculator",
  "question": "What is the rate?",
  "summary": "Works out a rate as an amount per unit of time (rate = amount ÷ time), or the amount or the time from the other two, and converts the rate between seconds, minutes, hours, days, weeks, and years.",
  "category": "math",
  "subcategory": "arithmetic",
  "url": "https://www.acalculator.org/math/rate-calculator",
  "markdown": "https://www.acalculator.org/math/rate-calculator.md",
  "kind": "formulas",
  "method": "Rate = Amount ÷ Time; Amount = Rate × Time; Time = Amount ÷ Rate, with the time counted in the rate’s time unit.",
  "assumptions": [
    "The rate is steady: the same amount in each unit of time.",
    "A day is 24 hours, a week 7 days, and a year 365 days.",
    "The amount and the rate are 0 or more, and the time is more than 0."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "amount": {
        "title": "Amount",
        "description": "How much was done, made, or travelled, in any unit: miles, pages, items, dollars.",
        "type": "number",
        "minimum": 0
      },
      "time": {
        "title": "Time",
        "description": "How long it took.",
        "type": [
          "number",
          "string"
        ],
        "x-quantity": "time",
        "exclusiveMinimum": 0
      },
      "rate": {
        "title": "Rate",
        "description": "The amount per time unit chosen below, such as 60 miles per hour.",
        "type": "number",
        "minimum": 0
      },
      "per": {
        "title": "Rate per",
        "description": "The time unit of the rate: per second, minute, hour, day, week, or year.",
        "type": "string",
        "enum": [
          "second",
          "minute",
          "hour",
          "day",
          "week",
          "year"
        ]
      }
    }
  },
  "solve": {
    "fillAny": 2,
    "variables": [
      "amount",
      "time",
      "rate"
    ],
    "inputsOnly": []
  },
  "outputs": {
    "amount": {
      "label": "Amount",
      "description": "How much was done, made, or travelled, in any unit: miles, pages, items, dollars.",
      "format": "number"
    },
    "time": {
      "label": "Time",
      "description": "How long it took.",
      "format": "quantity"
    },
    "rate": {
      "label": "Rate",
      "description": "The amount per time unit chosen below, such as 60 miles per hour.",
      "format": "number"
    },
    "perSecond": {
      "label": "Per second",
      "description": "The rate per second.",
      "format": "number"
    },
    "perMinute": {
      "label": "Per minute",
      "description": "The rate per minute.",
      "format": "number"
    },
    "perHour": {
      "label": "Per hour",
      "description": "The rate per hour.",
      "format": "number"
    },
    "perDay": {
      "label": "Per day",
      "description": "The rate per day (24 hours).",
      "format": "number"
    },
    "perWeek": {
      "label": "Per week",
      "description": "The rate per week (7 days).",
      "format": "number"
    },
    "perYear": {
      "label": "Per year",
      "description": "The rate per year (365 days).",
      "format": "number"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "per": "hour",
      "amount": 120,
      "time": "2 h"
    },
    "outputs": {
      "rate": 60,
      "perSecond": 0.016666666666666666,
      "perMinute": 1,
      "perHour": 60,
      "perDay": 1440,
      "perWeek": 10080,
      "perYear": 525600
    },
    "text": "120 in 2 h is a rate of 60 per hour."
  },
  "examples": [
    {
      "given": {
        "amount": 120,
        "time": 7200,
        "per": "hour"
      },
      "expect": {
        "rate": 60,
        "perMinute": 1,
        "perDay": 1440,
        "perSecond": 0.016666666666666666
      },
      "source": "hand calculation in content.mdx: 120 ÷ 2 hours = 60 per hour = 1 per minute = 1,440 per day; unit rates as in OpenStax Prealgebra 2e, section 5.6: https://openstax.org/books/prealgebra-2e/pages/5-6-ratios-and-rate"
    },
    {
      "given": {
        "amount": 300,
        "rate": 40,
        "per": "hour"
      },
      "expect": {
        "time": 27000
      },
      "source": "hand calculation in content.mdx: 300 ÷ 40 = 7.5 hours = 27,000 seconds"
    },
    {
      "given": {
        "rate": 15,
        "time": 5400,
        "per": "minute"
      },
      "expect": {
        "amount": 1350,
        "perHour": 900
      },
      "source": "hand calculation in content.mdx: 15 per minute × 90 minutes = 1,350"
    },
    {
      "given": {
        "amount": 52,
        "time": 31536000,
        "per": "week"
      },
      "expect": {
        "rate": 0.9972602739726026,
        "perYear": 52
      },
      "source": "hand calculation in content.mdx: a 365-day year is 365 ÷ 7 = 52.142857 weeks, so 52 a year is 0.997260 a week",
      "tolerance": 1e-12
    }
  ],
  "sources": [
    "OpenStax, Prealgebra 2e, section 5.6 Ratios and Rate (rates and unit rates): https://openstax.org/books/prealgebra-2e/pages/5-6-ratios-and-rate",
    "NIST Special Publication 811 (2008), Appendix B.8, conversion factors (minute, hour, day, and year of 365 days to seconds): https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b8"
  ],
  "related": [
    "speed",
    "ratio",
    "growth-rate",
    "percentage"
  ],
  "changelog": []
}
