{"id":25923891,"url":"https://github.com/igorwastaken/math-problems","last_synced_at":"2026-02-23T07:03:55.320Z","repository":{"id":277432944,"uuid":"932133199","full_name":"igorwastaken/math-problems","owner":"igorwastaken","description":"Solve math problems easily with this utility library.","archived":false,"fork":false,"pushed_at":"2025-03-07T00:30:13.000Z","size":186,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T16:59:27.849Z","etag":null,"topics":["algorithm","area","data","demography","geography","javascript","math","npm","package","population","school","typescript","util","utils"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/igorwastaken.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-13T12:25:50.000Z","updated_at":"2025-03-07T00:30:16.000Z","dependencies_parsed_at":"2025-06-08T05:22:16.004Z","dependency_job_id":null,"html_url":"https://github.com/igorwastaken/math-problems","commit_stats":null,"previous_names":["igorwastaken/math-utils","igorwastaken/math-problems"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/igorwastaken/math-problems","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorwastaken%2Fmath-problems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorwastaken%2Fmath-problems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorwastaken%2Fmath-problems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorwastaken%2Fmath-problems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/igorwastaken","download_url":"https://codeload.github.com/igorwastaken/math-problems/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/igorwastaken%2Fmath-problems/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29739024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T04:51:08.365Z","status":"ssl_error","status_checked_at":"2026-02-23T04:49:15.865Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","area","data","demography","geography","javascript","math","npm","package","population","school","typescript","util","utils"],"created_at":"2025-03-03T17:18:33.181Z","updated_at":"2026-02-23T07:03:55.314Z","avatar_url":"https://github.com/igorwastaken.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# math-problems\n\nSolve math problems easily with this utility library. Includes temperature conversions, geometric area calculations, number utilities, and population statistics.\n\n## Installation\n\n```bash\nnpm install math-problems\n```\n\n## Usage\n\n```javascript\nimport {\n  area,\n  toCelsius,\n  isEven,\n  populationDensity,\n  population,\n} from 'math-problems';\n\n// Calculate the area of a circle with radius 5\nconsole.log(area.circle(5)); // 78\n\n// Convert 73°F to Celsius\nconsole.log(toCelsius(73)); // 22.777... (repeating decimal)\n\n// Check if a number is even\nconsole.log(isEven(4)); // true\n\n// Calculate population density\nconsole.log(populationDensity(11452000, 1483)); // 7724\n\n// Access population data\nconsole.log(population.br.sp); // 11452000\n```\n\n## API Documentation\n\n### 📐 Area Calculations\n\nAll area functions return an object with a floored `area` value.\n\n- **Rectangle**  \n  `rect(base: number, height: number)`  \n  `area.rect(4, 5) ➔ 20`\n\n- **Triangle**  \n  `triangle(base: number, height: number)`  \n  `area.triangle(4, 5) ➔ 10`\n\n- **Rhombus**  \n  `rhombus(D: number, d: number)`  \n  `area.rhombus(8, 6) ➔ 24`\n\n- **Trapezoid**  \n  `trapezoid(B: number, b: number, height: number)`  \n  `area.trapezoid(10, 6, 5) ➔ 40`\n\n- **Circle**  \n  `circle(radius: number)`  \n  `area.circle(3) ➔ 28`\n\n### 🌡️ Temperature Conversions\n\nConvert between Celsius (°C), Fahrenheit (°F), and Kelvin (K).\n\n- **toCelsius**  \n  `toCelsius(temperature: number, unit?: 'F' | 'K')`  \n  Default unit: Fahrenheit  \n  `toCelsius(32) ➔ 0`  \n  `toCelsius(273.15, 'K') ➔ 0`\n\n- **toFahrenheit**  \n  `toFahrenheit(temperature: number, unit?: 'C' | 'K')`  \n  Default unit: Celsius  \n  `toFahrenheit(0) ➔ 32`  \n  `toFahrenheit(273.15, 'K') ➔ 32`\n\n- **toKelvin**  \n  `toKelvin(temperature: number, unit?: 'C' | 'F')`  \n  Default unit: Celsius  \n  `toKelvin(0) ➔ 273`  \n  `toKelvin(32, 'F') ➔ 273`\n\n### 🔢 Number Utilities\n\n- **isEven(number)**  \n  Returns `true` if the number is even.\n\n- **isOdd(number)**  \n  Returns `true` if the number is odd.\n\n- **difference(x, y)**  \n  Returns the floored difference between two numbers.  \n  `difference(10, 3.8) ➔ 6`\n\n- **PI**  \n  Math.PI constant (≈3.14159).\n\n### 📊 Interpoolation and regression\n\n- **interpolation(input: { function: (number) =\u003e number, value: number, points: number[] })**  \n  Interpolates a set of data points from a function and value through Newton Interpolation.\n\n```js\ninterpolation({\n  function: Math.log,\n  value: 2,\n  points: [1, 4, 6]\n})\n\n➔ 0.5658443469009827\n```\n\n- **regression(input: number[])**  \n  Computes the linear and polynomial regression from a set of data points.\n\n```js\nregression([\n  [-2, -1],\n  [1, 2],\n  [4, 59],\n  [-1, 4],\n  [3, 24],\n  [-4, -53]\n]);\n\n➔ {\n  linear: {\n    m: 10.97864768683274,\n    b: 4.00355871886121\n  },\n  polynomial: {\n    a: 6.689189189189188,\n    b: 11.060810810810809,\n    c: -0.34459459459459435\n  }\n}\n```\n\n### 📊 Population Statistics\n\n- **populationDensity(population, area)**  \n  Returns density (people per unit area).\n\n- **birthRate(births, population)**  \n  Returns births per 1000 people.\n\n- **deathRate(deaths, population)**  \n  Returns deaths per 1000 people.\n\n- **Population Data**  \n  Pre-defined population figures (as of Feb 2025):\n  ```javascript\n  population.br.sp; // Brazil São Paulo: 11,452,000\n  population.us.ny; // USA New York: 20,201,249\n  ```\n\n## Contributing\n\nContributions are welcome! Please follow the [contribution guidelines](https://github.com/igorwastaken/math-utils/blob/main/CONTRIBUTING.md).\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/igorwastaken/math-utils.git\n   ```\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n3. Run tests:\n   ```bash\n   npm test\n   ```\n\n## License\n\nMIT © Igor Figueiredo  \n[Full License Text](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorwastaken%2Fmath-problems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figorwastaken%2Fmath-problems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figorwastaken%2Fmath-problems/lists"}