Skip to main content

command-line app for finding multipliers of square roots

Project description

pypi version python version issues GitHub License Repo Stars

A way to rationalize a square root to a whole number. make your square root whole.

This project is intended to be used as a simple calculator for bruteforcing and displaying different variations of irrational square-roots. I quickly built this for myself in a couple hours to fix an issue with my design work. By using this app I found a strong candidate for the side lengths of my hexagon's broken down model. When splayed out into triangles and squares each side length could be approximately represented in whole numbers.

reasexample image
Example from game: Reassembly
Unable to connect the two parts on the right together; the structure loses overall stability
Example from Roblox studio: making a hexagon with walls results in stubborn seams which can be mitigated by choosing a better scale
*Although it's useful for design work where exact precision isn't necessary, this may not be the solution if you're looking to replace the irrational numbers within a 30/60/90 or 45/45/90 triangle with exact whole ones.

The Problem

rationalizing1

A simple issue may be encountered when arranging equally sized squares onto triangle faces. They will not align back onto the standard grid ever again. Image above shows a case where an attempt is made to align the squares back with the grid using another 45 degree right triangle.

Getting The Solution

rationalizing2

The previous example can be broken down into a function that solves for the marked distance:

$y=\frac{3}{2}\cdot x\sqrt{2}-\ 2\cdot x$

where x is the width of a square.

Substituting x with 58 (which I hand picked from a list my app generated), we can simplify $58\sqrt{2}$ into 82 because the real result is only two hundredths of a unit away:

$y=\frac{3}{2}\cdot82-\ 2\cdot58$

the equation then quietly resolves to 7

applying the solution

rationalizing3

Finally, we can fill the gap left by the odd geometry with a rectangle that's exactly 65 units in length.


Installation

  1. Install Python 3.14
  2. Download and extract the repository into a folder
  3. Run run.cmd, run advanced.cmd, or rationalize_sqrt.py through a CLI

Command-Line Arguments (WIP)

Flag Description
--version Show app version
--help Shows argument list
--advanced Runs app with extra options
--checkupdate Check for available updates from GitHub
--no_log Only show best output
--save_results Save results to file
--save_folder Set result save folder

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rationalize_sqrt-0.7.7.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rationalize_sqrt-0.7.7-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file rationalize_sqrt-0.7.7.tar.gz.

File metadata

  • Download URL: rationalize_sqrt-0.7.7.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rationalize_sqrt-0.7.7.tar.gz
Algorithm Hash digest
SHA256 450c69c40c5691c762c5f0c4a17f26d569ae2d6b1093fcac8accbba69b22cf96
MD5 4efebf700655c5d2d0eaef70a0e175d6
BLAKE2b-256 239a674ac136b8c6a06dbe54b9089e24d335959ae5a69f91138f0ba88b488d88

See more details on using hashes here.

Provenance

The following attestation bundles were made for rationalize_sqrt-0.7.7.tar.gz:

Publisher: workflow.yaml on K1CE/Square-Root_rationalizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rationalize_sqrt-0.7.7-py3-none-any.whl.

File metadata

File hashes

Hashes for rationalize_sqrt-0.7.7-py3-none-any.whl
Algorithm Hash digest
SHA256 91e821dfae89c7e5e3c8868f7103e001ce66ced6f9ed7148e6a0d6be7af35b18
MD5 49fd5c80cafe3d8a06f31350e464557c
BLAKE2b-256 9cbec5e6ba7830bc9c75fcd53d5b396894022097a2e9c6ffe9d1aaf1a2634c51

See more details on using hashes here.

Provenance

The following attestation bundles were made for rationalize_sqrt-0.7.7-py3-none-any.whl:

Publisher: workflow.yaml on K1CE/Square-Root_rationalizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page