Skip to main content

BRational

A SageMath package to beautifully format rational functions arising from enumerative algebra into plaintext and latex.

Version: 2.1

Documentation


Example 1

The default factored expression for

$$\dfrac{1 + 3q^{-1}t - 4q^{-1} - 4q^{-2}t + 3q^{-2} + q^{-3}t}{(1 - q^{-1}t)(1 - q^{-2}t^4)}$$

in SageMath is sometimes expressed as

-(q^2 + 3*q*t - 3*q - t)*(q - 1)/((t^2 + q)*(t^2 - q)*(q - t))

Using brational, we get

q^-3*(1 - q)*(3*q + t - q^2 - 3*q*t)/((1 - q^-1*t)*(1 - q^-2*t^4))

Want $\LaTeX$? No problem:

sage: print(br.brat(q^-3*(1 - q)*(3*q + t - q^2 - 3*q*t)/((1 - q^-1*t)*(1 - q^-2*t^4))).factor().latex())
\dfrac{q^{-3}(1 - q)(3q + t - q^2 - 3qt)}{(1 - q^{-1}t)(1 - q^{-2}t^4)}

$$\dfrac{q^{-3}(1 - q)(3q + t - q^2 - 3qt)}{(1 - q^{-1}t)(1 - q^{-2}t^4)}$$

Example 2

The default expression for

$$\dfrac{1 + 26T + 66T^2 + 26T^3 + T^4}{(1 - T)^5}$$

in SageMath is sometimes expressed as

(-T^4 - 26*T^3 - 66*T^2 - 26*T - 1)/(T^5 - 5*T^4 + 10*T^3 - 10*T^2 + 5*T - 1)

Using brational, the default is

(1 + 26*T + 66*T^2 + 26*T^3 + T^4)/(1 - T)^5

And latex:

sage: print(br.brat((1 + 26*T + 66*T^2 + 26*T^3 + T^4)/(1 - T)^5).latex())
\dfrac{1 + 26T + 66T^2 + 26T^3 + T^4}{(1 - T)^5}

Metadata

Release files for brational 2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brational 2.1
File Size Uploaded
brational-2.1.tar.gz 39.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brational 2.1
File Interpreter ABI Platform
brational-2.1-py3-none-any.whl Python 3 none any Details

Total release size: 59.7 kB

Release files / brational-2.1.tar.gz

Download URL brational-2.1.tar.gz
Size 39.7 kB
Tags Source
SHA-256 checksum
How to use checksums
86c4fd889e1879feefafe7e4c197cd6772aa24834e33ab71185c98c4264ee353
BLAKE2b-256 checksum
How to use checksums
c41bdeddb8712211b5279e2136f2c2409a75f775f6ac692bf267265464e81541
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / brational-2.1-py3-none-any.whl

Download URL brational-2.1-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ab220046448650136c581c6286759049e65ce1e332e05028b5ebecb69de6f99
BLAKE2b-256 checksum
How to use checksums
dfaf09875205f5ead1721d3cea6e861b0e0e7cf8abbee222180aea58af1f2f66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

2.1 This release

2 release files

2.0.1

2 release files

2.0

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page