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}

Download files

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

Source Distribution

brational-2.1.tar.gz (39.7 kB view details)

Uploaded Source

Built Distribution

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

brational-2.1-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file brational-2.1.tar.gz.

File metadata

  • Download URL: brational-2.1.tar.gz
  • Upload date:
  • Size: 39.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for brational-2.1.tar.gz
Algorithm Hash digest
SHA256 86c4fd889e1879feefafe7e4c197cd6772aa24834e33ab71185c98c4264ee353
MD5 07aa20ba5120f5424e65d6f1ce3a60b3
BLAKE2b-256 c41bdeddb8712211b5279e2136f2c2409a75f775f6ac692bf267265464e81541

See more details on using hashes here.

File details

Details for the file brational-2.1-py3-none-any.whl.

File metadata

  • Download URL: brational-2.1-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for brational-2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ab220046448650136c581c6286759049e65ce1e332e05028b5ebecb69de6f99
MD5 aa49f9dfd3b63109bcede31bed94d340
BLAKE2b-256 dfaf09875205f5ead1721d3cea6e861b0e0e7cf8abbee222180aea58af1f2f66

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1 This release

2 files

2.0.1

2 files

2.0

2 files

1.2.0

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

0.3.0

2 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