isympy(1)

πŸ“¦ version 1.13.3, in opensuse-leap 16.0

πŸ’… isympy β€” like, the whole manual, bestie

okay so you found isympy(1), the interactive shell for SymPy, and honestly? it's giving "calculator but make it fashion" ✨ this page is from the isympy manual and we're gonna go through every single bit of it, no cap. buckle up πŸŽ€


✨ NAME ✨

isympy β€” interactive shell for SymPy πŸπŸ’–


🌸 SYNOPSIS 🌸

like, here's how you actually call it:

isympy [-c | --console] [-p ENCODING | --pretty ENCODING] [-t TYPE |
       --types TYPE] [-o ORDER | --order ORDER] [-q | --quiet] [-d |
       --doctest] [-C | --no-cache] [-a | --auto] [-D | --debug] [ -- |
       PYTHONOPTIONS]
isympy [ {-h | --help} | {-v | --version} ]

πŸ¦‹ DESCRIPTION πŸ¦‹

so isympy is a Python shell for SymPy πŸ’œ it's literally just a normal python shell (or an ipython shell if you have the ipython package installed, periodt) that runs these commands for you at startup so you don't have to type them yourself:

>>> from __future__ import division
>>> from sympy import *
>>> x, y, z = symbols("x,y,z")
>>> k, m, n = symbols("k,m,n", integer=True)

so basically starting isympy is the exact same thing as starting python (or ipython) and executing all of the above by hand 🫢 it's made for easy and quick experimentation with SymPy, iykyk.

but bestie, listen β€” for more complicated programs, the move is to write a script and import things explicitly (like, using the "from sympy import sin, log, Symbol, ..." idiom). trust. 🌈

πŸ’… OPTIONS πŸ’…

  • -c SHELL, --console=SHELL β€” picks which shell to use as the console backend: python or ipython, instead of the default one (which is ipython if it's present, or python otherwise). Example: isympy -c python. And SHELL could be either 'ipython' or 'python'. πŸ’–
  • -p ENCODING, --pretty=ENCODING β€” sets up pretty printing in SymPy ✨ by default the most pretty unicode printing is enabled (if your terminal supports it). You can go with the less pretty ASCII printing instead, or no pretty printing at all. Example: isympy -p no. And ENCODING must be one of 'unicode', 'ascii' or 'no'. πŸŽ€
  • -t TYPE, --types=TYPE β€” sets up the ground types for the polys. Default behavior: gmpy ground types are used if gmpy2 or gmpy is installed, and otherwise it falls back to python ground types, which are a little bit slower 😭 you can manually choose python ground types even if gmpy is installed (like, for testing purposes, y'know?).
heads up: sympy ground types are not supported, and should be used only for experimental purposes πŸ™ˆ
also heads up: the gmpy1 ground type is primarily intended for testing; it the use of gmpy even if gmpy2 is available. (that's what the page says, we're keeping it exactly, don't come for me πŸ’€)

This is the same as setting the environment variable SYMPY_GROUND_TYPES to the given ground type (e.g. SYMPY_GROUND_TYPES='gmpy'). 🧚

The ground types can be figured out interactively from the variable sympy.polys.domains.GROUND_TYPES inside the isympy shell itself. πŸ‘‘

Example: isympy -t python. And TYPE must be one of 'gmpy', 'gmpy1' or 'python'. ⭐

  • -o ORDER, --order=ORDER β€” sets up the ordering of terms for printing. The default is lex, which orders terms lexicographically (e.g., x**2 + x + 1). You can pick other orderings, like rev-lex, which uses reverse lexicographic ordering (e.g., 1 + x + x**2). 🌸
note: for very large expressions, ORDER='none' may speed up printing considerably β€” tradeoff being that the order of the terms in the printed expression will have no canonical order. 😬

Example: isympy -o rev-lax (yes, that's what's written, we keep it verbatim πŸ’€). And ORDER must be one of 'lex', 'rev-lex', 'grlex', 'rev-grlex', 'grevlex', 'rev-grevlex', 'old', or 'none'. πŸ”₯

  • -q, --quiet β€” prints only Python's and SymPy's versions to stdout at startup, and nothing else. that's it, that's the vibe πŸ€«πŸ’œ
  • -d, --doctest β€” uses the same format that should be used for doctests. this is equivalent to 'isympy -c python -p no'. πŸŽ€
  • -C, --no-cache β€” disables the caching mechanism. disabling the cache may slow certain operations down considerably 😭 this is useful for testing the cache, or for benchmarking, because the cache can result in deceptive benchmark timings. ngl, sneaky. This is the same as setting the environment variable SYMPY_USE_CACHE to 'no'. πŸ¦‹
  • -a, --auto β€” automatically creates missing symbols ✨ normally, typing the name of a Symbol that hasn't been instantiated first would raise NameError, but with this enabled, any undefined name gets automatically created as a Symbol. This only works in IPython 0.11. πŸ’€
note: this is intended only for interactive, calculator-style usage. in a script that uses SymPy, Symbols should be instantiated at the top, so it's clear what they are. 🫢

This will not override any names that are already defined, which includes the single character letters represented by the mnemonic QCOSINE (see the "Gotchas and Pitfalls" document in the documentation). You can delete existing names by executing "del name" in the shell itself. You can see if a name is defined by typing "'name' in globals()". πŸ‘‘

The Symbols created this way have default assumptions. If you want to place assumptions on symbols, you should create them using symbols() or var(). 🌸

Finally β€” this only works in the top level namespace. so, for example, if you define a function in isympy with an undefined Symbol, it will not work. 😭

  • -D, --debug β€” enables debugging output. This is the same as setting the environment variable SYMPY_DEBUG to 'True'. The debug status is set in the variable SYMPY_DEBUG within isympy. πŸ›πŸ’œ
  • -- PYTHONOPTIONS β€” these options get passed on to the ipython(1) shell. Only supported when ipython is being used (standard python shell not supported). πŸ™ˆ

Two dashes (--) are required to separate PYTHONOPTIONS from the other isympy options. πŸ”₯

For example, to run iSymPy without startup banner and colors:

isympy -q -c ipython -- --colors=NoColor
  • -h, --help β€” prints help output and exits. πŸŽ€
  • -v, --version β€” prints isympy version information and exits. ⭐

πŸ“ FILES πŸ“

  • ${HOME}/.sympy-history β€” saves the history of commands when using the python shell as backend. πŸ’Ύβœ¨

πŸ’€ BUGS πŸ’€

the upstreams BTS can be found at ⟨https://github.com/sympy/sympy/issues⟩ β€” please report all bugs that you find in there, it'll help improve the overall quality of SymPy 🫢 don't be shy, bestie.


🌈 SEE ALSO 🌈

ipython(1), python(1) πŸ‘‘


and that's the whole page, periodt πŸ’… this was isympy(1), dated 2007-10-8 β€” yeah she's vintage, she's iconic, she's been serving since 2007 and still ate. mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from