Skip to main content

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

Project description

BRational

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

Version: 2.0.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)*(t + 3*q - 3*q*t - q^2)/((1 - q^-1*t)*(1 - q^-2*t^4))

Want $\LaTeX$? No problem:

sage: print(br.brat(q^-3*(1 - q)*(t + 3*q - 3*q*t - q^2)/((1 - q^-1*t)*(1 - q^-2*t^4))).factor().latex())
\dfrac{q^{-3}(1 - q)(t + 3q - 3qt - q^2)}{(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}

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

brational-2.0.1.tar.gz (23.9 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.0.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: brational-2.0.1.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for brational-2.0.1.tar.gz
Algorithm Hash digest
SHA256 944cdd3421ea94856ea441164d902dd4db110d000b9ab2c6c42ac0324eda6d13
MD5 cdebd2647b0c99fa3603772713c290cd
BLAKE2b-256 2728f69e287820f03012d5abcbd29a90503b1d2ea01c1e8f4e0a179b1b1046f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: brational-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for brational-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2df15970d8c7fef581cffe1030f3f2d2e7641f8d22562014f4279867e548bb43
MD5 929bad3535b38bbbfefbcb5665da431e
BLAKE2b-256 93551473ba8f5d0b1b2cf482776df4d437d703426e611feae1fa278f031cf8f6

See more details on using hashes here.

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