isympy(1)
π isympy(1) π
β¨ NAME β¨
isympy - interactive shell for SymPy π§
π SYNOPSIS π
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 π¦
okay so isympy is a Python shell for SymPy π It's literally just a normal python shell (an ipython shell if you have the ipython package installed) that runs the following commands for you, 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 starting isympy is basically the same as starting python (or ipython) and typing all of that by hand. It's made for quick and easy experimenting with SymPy β¨ For anything more complicated, bestie, write a script and import things explicitly (using the from sympy import sin, log, Symbol, ... idiom). That's the iconic move π
π OPTIONS π
-c SHELL,--console=SHELLβ use the shell you pick (python or ipython) as the console backend instead of the default one (ipython if it's around, python otherwise) πΈ- Example:
isympy -c python - SHELL has to be either
ipythonorpython
- Example:
-p ENCODING,--pretty=ENCODINGβ sets up pretty printing in SymPy. By default you get the prettiest unicode printing (if your terminal can handle it) π¦ You can switch to the less fancy ASCII printing, or turn pretty printing off completely π- Example:
isympy -p no - ENCODING must be one of
unicode,asciiorno
- Example:
-t TYPE,--types=TYPEβ sets up the ground types for the polys β¨ By default, gmpy ground types are used if gmpy2 or gmpy is installed. Otherwise it falls back to python ground types, which are a tiny bit slower π’ You can still manually pick python ground types even when gmpy is installed (for testing, for example) π§ͺ- Note that sympy ground types aren't supported and should only be used for experimental purposes π
- Note that the gmpy1 ground type is mainly meant for testing. It's the use of gmpy even when gmpy2 is available π
- This is the same as setting the environment variable
SYMPY_GROUND_TYPESto the ground type you give (e.g.,SYMPY_GROUND_TYPES='gmpy') - You can check the ground types interactively from the variable
sympy.polys.domains.GROUND_TYPESinside the isympy shell itself π - Example:
isympy -t python - TYPE must be one of
gmpy,gmpy1orpython
-o ORDER,--order=ORDERβ sets the ordering of terms for printing π The default islex, which orders terms lexicographically (e.g.,x**2 + x + 1). You can pick other orderings, likerev-lex, which uses reverse lexicographic ordering (e.g.,1 + x + x**2) π₯- Note that for really huge expressions,
ORDER='none'can speed up printing a lot, but the tradeoff is that the terms in the printed expression won't have any canonical order - Example:
isympy -o rev-lax - ORDER must be one of
lex,rev-lex,grlex,rev-grlex,grevlex,rev-grevlex,old, ornone
- Note that for really huge expressions,
-q,--quietβ at startup, print only the Python and SymPy versions to stdout, and nothing else π€«-d,--doctestβ uses the format that doctests should use π This is the same asisympy -c python -p no-C,--no-cacheβ turns off the caching mechanism π§ Disabling the cache may slow certain operations down a lot. It's useful for testing the cache or for benchmarking, since the cache can give you deceptive benchmark timings π- This is the same as setting the environment variable
SYMPY_USE_CACHEto'no'
- This is the same as setting the environment variable
-a,--autoβ automatically creates missing symbols πͺ Normally, typing the name of a Symbol that hasn't been instantiated first raises NameError. With this option on, any undefined name gets automatically created as a Symbol. This only works in IPython 0.11 β οΈ- This is only meant 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 π«Ά
- It won't 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 running
del namein the shell itself. To check if a name is defined, type'name' in globals() - The Symbols made this way have default assumptions. If you want assumptions on your symbols, create them with
symbols()orvar()instead π - Finally, this only works in the top level namespace. So if you define a function in isympy that uses an undefined Symbol, it won't work π
-D,--debugβ turns on debugging output π This is the same as setting the environment variableSYMPY_DEBUGto'True'. The debug status gets set in the variableSYMPY_DEBUGwithin isympy-- PYTHONOPTIONSβ these options get passed on to theipython (1)shell π Only supported when ipython is being used (the standard python shell doesn't support them)- You need two dashes (
--) to separate PYTHONOPTIONS from the other isympy options, so don't skip them - For example, to run iSymPy without the startup banner and without colors:
- You need two dashes (
isympy -q -c ipython -- --colors=NoColor
-h,--helpβ prints the help output and exits πββοΈ-v,--versionβ prints the isympy version info and exits π·οΈ
π§ FILES π§
${HOME}/.sympy-historyβ saves your command history when you use the python shell as the backend π
π BUGS π
The upstream BTS lives at https://github.com/sympy/sympy/issues. Please report every bug you find there, because it really helps make SymPy better for everyone π«Ά
π SEE ALSO π
ipython (1), python (1)
ily, and that's the whole isympy(1) page (version date 2007-10-8) ππ Stay curious, stay sparkly β¨π
π¦ where this page comes from
- debian bookworm: isympy-common 1.11.1-1 Β· BSD-3-Clause
- debian trixie: isympy-common 1.13.3-5 Β· BSD-3-Clause
- ubuntu jammy: isympy-common 1.9-1 Β· BSD-3-Clause
- ubuntu noble: isympy-common 1.12-7 Β· BSD-3-Clause
- ubuntu questing: isympy-common 1.13.3-5 Β· BSD-3-Clause
- ubuntu resolute: isympy-common 1.14.0-2 Β· BSD-3-Clause
- ubuntu stonking: isympy-common 1.14.0-4 Β· BSD-3-Clause
- π girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms