ibnuljaiffarabi's picture
discrete-math-ai999x 1.6.7: Apache-2.0 release
ba6f1bc
|
Raw History Blame Contribute Delete
11.9 kB
metadata
license: apache-2.0
license_link: LICENSE
library_name: discrete-math-ai999x
language:
  - en
inference: false
pipeline_tag: question-answering
tags:
  - discrete-math
  - number-theory
  - combinatorics
  - graph-theory
  - logic
  - cryptography
  - modular-arithmetic
  - propositional-logic
  - rsa
  - question-answering
  - rust
  - discrete-math-solver
  - step-by-step-solutions
  - homework-help
  - offline
  - zero-hallucination
  - python
  - ai999x
model-index:
  - name: discrete-math-ai999x
    results:
      - task:
          type: question-answering
          name: discrete math question answering
        dataset:
          name: >-
            Golden answers (566 documented questions, Windows + Linux Python
            3.10-3.14)
          type: ai999x-evaluation
        metrics:
          - type: accuracy
            value: 1
            name: identical on every platform

Discrete Math (discrete-math-ai999x)

Discrete Math covers number theory, modular arithmetic, combinatorics, graph theory and network algorithms, logic and the mathematics of cryptography: 103 calculations in 9 topics, each with its formula, its steps and its units, and a plain reason instead of a number when an input is missing or out of range. One compiled engine, four ways to use it: the desktop app, the command line, the browser and Python. Everything runs on your own computer, offline.

The Discrete Math desktop app: Modular multiplicative inverse, with its worked example and live scene

Four ways to use it

Desktop app (Windows, Linux) Windows · Linux
Command line discrete-math (Windows, Linux) Windows · Linux
Browser (any device) Try it on the model page
Python 3.10+ pip install discrete-math-ai999x: on Windows and Linux (x86-64) pip installs the same compiled engine; on other systems (macOS, ARM) it installs a pure-Python build that gives the same answers

See it

From the Discrete Math desktop app: every scene and chart is drawn from the computed answer.

Discrete Math desktop app: a slider moves an input and the answer, the scene and the charts follow

Watch the full clip (MP4)

Modular multiplicative inverse: the live scene in the Discrete Math desktop app
Modular multiplicative inverse
Derangements: the live scene in the Discrete Math desktop app
Derangements
Chromatic number of a small graph: the live scene in the Discrete Math desktop app
Chromatic number of a small graph
Tautology test: the live scene in the Discrete Math desktop app
Tautology test
Affine cipher: the live scene in the Discrete Math desktop app
Affine cipher
Base (radix) conversion: the live scene in the Discrete Math desktop app
Base (radix) conversion
Venn diagram with three sets (inclusion-exclusion): the live scene in the Discrete Math desktop app
Venn diagram with three sets (inclusion-exclusion)
Apportionment: Hamilton, Jefferson, Webster, Adams and Huntington-Hill: the live scene in the Discrete Math desktop app
Apportionment: Hamilton, Jefferson, Webster, Adams and Huntington-Hill

Charts:

Modular multiplicative inverse: a chart in the Discrete Math desktop app
Modular multiplicative inverse
Derangements: a chart in the Discrete Math desktop app
Derangements
Chromatic number of a small graph: a chart in the Discrete Math desktop app
Chromatic number of a small graph
Tautology test: a chart in the Discrete Math desktop app
Tautology test

Ask in words: 15 examples

Each question below was asked on this release; the comment under it is the line it printed.

import discrete_math_ai999x as discrete_math

a = discrete_math.ask("What is the 5th Bell number?")
print(a.outcome, a.values)
# SOLVED {'bell': 52}

a = discrete_math.ask(
    "Encrypt \"AFFINE CIPHER\" with the affine cipher a = 5, b = 8."
)
print(a.outcome, a.values)
# SOLVED {'result': 'IHHWVCSWFRCP'}

a = discrete_math.ask("Is p & ~p a contradiction?")
print(a.outcome, a.values)
# SOLVED {'contradiction': True, 'true_rows': 0, 'witness': None}

a = discrete_math.ask(
    "Solve x ≡ 2 (mod 3), x ≡ 3 (mod 5), x ≡ 2 (mod 7)."
)
print(a.outcome, a.values)
# SOLVED {'x': 23, 'modulus': 105}

a = discrete_math.ask("Convert 1011 from base 2 to base 10.")
print(a.outcome, a.values)
# SOLVED {'result': '11', 'decimal': 11}

a = discrete_math.ask("Compute the Carmichael function of 15.")
print(a.outcome, a.values)
# SOLVED {'lambda': 4}

a = discrete_math.ask("What is the Bernoulli number B_10?")
print(a.outcome, a.values)
# SOLVED {'numerator': 5, 'denominator': 66, 'value': 0.07575757575757576}

a = discrete_math.ask(
    "Encrypt \"HELLO WORLD\" with a Caesar shift of 3."
)
print(a.outcome, a.values)
# SOLVED {'result': 'KHOORZRUOG'}

a = discrete_math.ask(
    "Is the graph with edges A-B, B-C, C-D, D-A bipartite?"
)
print(a.outcome, a.values)
# SOLVED {'is_bipartite': True}

a = discrete_math.ask(
    "Evaluate (p -> q) & ~r when p = true, q = false, r = false."
)
print(a.outcome, a.values)
# SOLVED {'value': False}

a = discrete_math.ask("Find the smallest x with 3^x ≡ 13 (mod 17).")
print(a.outcome, a.values)
# SOLVED {'x': 4}

a = discrete_math.ask("What is the 8-bit two's complement of -5?")
print(a.outcome, a.values)
# SOLVED {'bits_text': '11111011', 'unsigned': 251}

a = discrete_math.ask("Find the continued fraction of 415/93.")
print(a.outcome, a.values)
# SOLVED {'terms': [4, 2, 6, 7], 'length': 4}

a = discrete_math.ask(
    "Venn diagram: n(A) = 45, n(B) = 60, n(A and B) = 20, n(U) = 100. "
    "Find the count of every region."
)
print(a.outcome, a.values)
# SOLVED {'union': 85, 'only_a': 25, 'only_b': 40, 'neither': 15}

a = discrete_math.ask(
    "How many bracelets with 6 beads can be made using 2 colours?"
)
print(a.outcome, a.values)
# SOLVED {'bracelets': 13, 'necklaces': 14}

Command line: 15 examples

Each command below was run with discrete-math of this release; the lines under it are the answer it printed (the full answer goes on with the method, every input in SI units and the conditions it assumes).

$ discrete-math solve bell n=5
bell = 52

$ discrete-math solve affine_cipher a=5 b=8 "message=AFFINE CIPHER" mode=encrypt
result = IHHWVCSWFRCP

$ discrete-math solve articulation_points "edges=A-B, B-C, C-A, C-D, D-E"
count = 2
points = ["C","D"]

$ discrete-math solve logic_contradiction "formula=p & ~p"
contradiction = true
true_rows = 0
witness = null

$ discrete-math solve crt "residues=[2, 3, 2]" "moduli=[3, 5, 7]"
x = 23
modulus = 105

$ discrete-math solve base_convert digits=1011 from_base=2 to_base=10
result = 11
decimal = 11

$ discrete-math solve carmichael_lambda n=15
lambda = 4

$ discrete-math solve venn_three_sets a=30 b=25 c=20 ab=10 ac=8 bc=5 abc=3 universe=60
union = 55
only_a = 15
only_b = 13
only_c = 10
only_a_and_b = 7
only_a_and_c = 5

$ discrete-math solve apportionment method=jefferson seats=10 "populations=[2400, 3300, 4300]"
seats = [2,3,5]
standard_divisor = 1000
quotas = [2.4,3.3,4.3]
total_seats = 10

$ discrete-math solve bernoulli n=10
numerator = 5
denominator = 66
value = 0.07575757576

$ discrete-math solve caesar_cipher "message=HELLO WORLD" mode=encrypt shift=3
result = KHOORZRUOG

$ discrete-math solve bipartite "edges=A-B, B-C, C-D, D-A"
is_bipartite = true

$ discrete-math solve logic_evaluate "formula=(p -> q) & ~r" "assignment=p = true, q = false, r = false"
value = false

$ discrete-math solve linear_congruence a=3 b=4 m=7
smallest = 6
count = 1
step = 7

$ discrete-math solve twos_complement n=-5 bits=8
bits_text = 11111011
unsigned = 251

Guides

  • Desktop app guide: the window, every calculation, scenes and charts: PDF · HTML · Markdown
  • Python guide: every calculation with a Python example: PDF · HTML · Markdown
  • Command-line guide: every calculation with the command and what it printed: PDF · HTML · Markdown

Every calculation, with its formula, a worked example and its figures: Discrete Math on ai999x.com. Install guides for the app and the command line: https://www.ai999x.com/desktop-cli/.

Version 1.6.7 · License: Apache-2.0 · Author: Ibnul Jaif Farabi · Organization: AI999X · Contact: [email protected] · Support the project

The Future Is Self-Improving.