Skip to main content

Clean looking engineering calculations for IPython

Project description

ipycalc

Simple Engineering Calculations in Python

Turn the contents of a Jupyter cell into a formatted calculation by following the steps below:

  1. Install ipycalc using pip install ipycalc
  2. Use import ipycalc to bring ipycalc into your notebook's namespace.
  3. Use %%calc as the first line of a cell to indicate that you want to run ipycalc on the contents of a cell.

The basic calculation syntax is:

Variable Description: variable_name = python_expression -> result_decimal_places*result_unit # Reference Text

Key components of the ipycalc syntax are:

  • : (required) The description must come before this character.
  • = (optional) Used to assign a python expression to a variable name. Omit this if you simply want to reprint a previously defined variable.
  • -> (optional) Separates the python expression from the results formatting rules.
  • * (optional) Indicate the number of decimals you want to see in the result to the left of the *, and the units you want to see in the result to the right.
  • # (optional) Indicates reference text to the side of the calculation - handy for equation references or code references.

Here are a few useful things to keep in mind when using ipycalc:

  • Subscripts can be added by using the _ character to indicate the start of a subscript.
  • To stack fractions place the numerator and denominater in parentheses: (num)/(denom) yields $\dfrac{num}{denom}$.
  • If statements and else statements are available using python's inline if statement notation.
  • Square roots can be displayed using sqrt.
  • Prime characters can be displayed using ^prime.
  • US units are built in via Pint. Metric units are not yet supported.

IPycalc is still in its infancy. I'm sure there are bugs, so be cautious and use your head. A special thanks to @connorferster for handcalcs which inspired this project: https://github.com/connorferster/handcalcs

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

ipycalc-0.0.25.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

ipycalc-0.0.25-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file ipycalc-0.0.25.tar.gz.

File metadata

  • Download URL: ipycalc-0.0.25.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for ipycalc-0.0.25.tar.gz
Algorithm Hash digest
SHA256 0b61db9803ac0c2fd3e6952e7cf17d86f89d388e363983ec62191488de2161b3
MD5 5ebe128fe01a2c459b94a0c5d759ab1c
BLAKE2b-256 462c7bb83803c361023e0f8fdec88b704d4b0dc11b4ac15d342d14a7e0841f58

See more details on using hashes here.

File details

Details for the file ipycalc-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: ipycalc-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for ipycalc-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 b3c4d8e365b9242409bf669e96e3a1e4da55f473e5600ec6201b50e1d8966e0b
MD5 4104e91719e124339ed7e8185da9e115
BLAKE2b-256 4bb9441280f590a1e7732f1662e74a37dce7c1c942577d6b23d0d6b35f261603

See more details on using hashes here.

Supported by

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