Skip to content

Math Tasks Generator - TypeScript library for dynamic math problem creation. Features variables, constraints, auto-answer generation, multiple-choice options, and fraction support. Perfect for educational platforms.

License

Notifications You must be signed in to change notification settings

ArtemZhyto/Math-tasks-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Math Task Generator / Генератор Математичних Завдань

TypeScript Node.js JavaScript Mathematics


Table of Contents / Зміст

English

  1. Project Description
  2. Features
  3. How to Use
  4. Configuration Object
  5. Supporting the Project
  6. Supporters Hall of Fame
  7. Created & Maintained by

Українська

  1. Опис проекту
  2. Можливості
  3. Як використовувати
  4. Об’єкт конфігурації
  5. Підтримка проекту
  6. Зала слави меценатів
  7. Автор та розробник

Math Task Generator

Project Description

A universal generator of mathematical problems with automatic answer generation. Generates problems for calculating perimeters, arithmetic operations, and more. Includes validation and customizable constraints.

Features

  • Generates math tasks with correct answers
  • Supports variables and constraints
  • Auto-generates multiple-choice options
  • Handles units of measurement (cm, mm, etc.)
  • Works with fractions, integers, and decimals
  • Configurable number ranges and validation rules

How to Use

Pass a config object to generateTask():

const config = {
  condition: "Calculate the perimeter of a rectangle with sides @A cm and @B cm",
  template: "concat(multiply(2, sum(@A, @B)), ' cm')",
  variables: {
    A: { range: [5, 12] },
    B: { range: [8, 15] }
  },
  constraints: {
    canBeNegative: false,
    integerResult: true,
    canGenerateWrongAnswer: true
  }
};

const task = generateTask(config);

Example Output:

{
  condition: "Calculate the perimeter of a rectangle with sides 7 cm and 10 cm",
  answers: ["34 cm", "17 cm", "24 cm", "70 cm"],
  correctAnswer: "34 cm"
}

Configuration Object

Field Type Description
condition string Problem text with variables (e.g., @A, @B)
template string Math expression using supported functions.
variables Object Range/value definitions for variables (range: [min,max] or values: [...]).
constraints Object Rules for answers (minResult, maxResult, integerResult, etc.).

Supported Functions

  • Arithmetic: sum, multiply, minus, divide, modulus
  • Fractions: fraction, fractionAdd, toDecimal
  • Comparisons: greater, less, equal
  • Utilities: concat, round, sqrt

Full list: math-functions.ts.

Supporting the Project

If this tool helps you in your work or studies, consider supporting its development:

Your support helps improve and maintain this generator!

💎 Supporters Hall of Fame

We appreciate every contribution! 🎉

Join our supporters family!

🎯 2025 • Artem Zhyto

Math Task Generator

📚 Education ⚡ Open Source 💙 Ukraine


Empowering educators worldwide


Генератор Математичних Завдань

Опис проекту

Універсальний генератор математичних задач із автоматичним підбором відповідей. Генерує завдання на обчислення периметрів, арифметичні дії тощо. Має вбудовану перевірку обмежень.

Можливості

  • Генерує задачі з правильними відповідями
  • Підтримує змінні та обмеження
  • Автоматично створює варіанти вибору
  • Працює з одиницями виміру (см, мм, грн)
  • Обробляє дроби, цілі та десяткові числа
  • Налаштовувані діапазони чисел

Як використовувати

Передайте об’єкт конфігурації у generateTask():

const config = {
  condition: "Обчисліть периметр прямокутника зі сторонами @A см і @B см",
  template: "concat(multiply(2, sum(@A, @B)), ' см')",
  variables: {
    A: { range: [5, 12] },
    B: { range: [8, 15] }
  },
  constraints: {
    canBeNegative: false,
    integerResult: true,
    canGenerateWrongAnswer: true
  }
};

const task = generateTask(config);

Приклад результату:

{
  condition: "Обчисліть периметр прямокутника зі сторонами 7 см і 10 см",
  answers: ["34 см", "17 см", "24 см", "70 см"],
  correctAnswer: "34 см"
}

Об’єкт конфігурації

Поле Тип Опис
condition string Текст задачі із змінними (напр., @A, @B).
template string Математичний вираз зі списком функцій.
variables Object Діапазони/значення змінних (range: [min,max] або values: [...]).
constraints Object Обмеження (minResult, maxResult, integerResult тощо).

Підтримувані функції

  • Арифметика: sum, multiply, minus, divide, modulus
  • Дроби: fraction, fractionAdd, toDecimal
  • Порівняння: greater, less, equal
  • Додатково: concat, round, sqrt

Повний список: math-functions.ts.

Підтримка проекту

Якщо цей генератор корисний у вашій роботі чи навчанні, ви можете підтримати його розвиток:

Ваша підтримка допомагає покращувати та підтримувати цей проект!

💎 Зала слави меценатів

Цінуємо кожен внесок! 🎉

Приєднуйтесь до родини меценатів!

🎯 2025 • Artem Zhyto

Генератор Математичних Завдань

📚 Освіта ⚡ Відкритий код


Надаємо можливості вчителям у всьому світі

About

Math Tasks Generator - TypeScript library for dynamic math problem creation. Features variables, constraints, auto-answer generation, multiple-choice options, and fraction support. Perfect for educational platforms.

Topics

Resources

License

Stars

Watchers

Forks