Skip to main content

Command-line interface to Mathics3

Project description

CI status PyPI Installs Latest Version Supported Python Versions

Packaging status

mathicsscript is a command-line interface to Mathics3.

screenshot

See the screenshot directory for a description and another example.

Features

  • prompt_toolkit and GNU Readline terminal interaction. This includes:
    • saving command history between sessions.

    • variable completion, even for symbol names like \\[Sigma]

    • limited ESC keyboard input; for example esc p esc is π

  • Syntax highlighting using mathics-pygments which includes dynamically created variables and functions.

  • Automatic detection of light or dark terminal background color.

  • Optional Graphics rendering via matplotlib for 2D graphics, and Asymptote for 3D and 2D graphics.

  • Entering and displaying Unicode symbols such as used for Pi or Rule arrows

  • Provision for running in non-interactive batch mode which an be used inside POSIX shells

Installing

To install with the full dependencies, run:

$ make install[full]

To install from git sources so that you run from the git source tree:

$ make develop

Running

Once install run using mathicsscript:

$ mathicsscript
Mathicscript: 7.0.0, Mathics 7.0.0
on CPython 3.11.9 (main, May  6 2024, 12:58:03) [GCC 13.2.0]
Using:
SymPy 1.12.1, mpmath 1.3.0, numpy 1.26.4
cython 3.0.10, matplotlib 3.8.4,
Asymptote version 2.87

Copyright (C) 2011-2024 The Mathics Team.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
See the documentation for the full license.

Quit by evaluating Quit[] or by pressing CONTROL-D.

In[1]:=

For batch use:

$ mathicsscript -c "N[Pi, 30]"
3.14159265358979323846264338328

To read from a file

In file /tmp/test.m:

sum=2+2
integral=Integrate[1,x]
Print["Results: ",{sum,integral}]

Feeding this into mathicsscript:

$ mathicsscript --no-prompt </tmp/test.m
4
x
Results: {4, x}
None

For a full list of options, type mathicsscript --help.

Asymptote key bindings

In asymptote graphs keyboard bindings are (copied from the asymptote doc under 8.29 three:

h: home
f: toggle fitscreen
x: spin about the X axis
y: spin about the Y axis
z: spin about the Z axis
s: stop spinning
m: rendering mode (solid/patch/mesh)
e: export
c: show camera parameters
p: play animation
r: reverse animation
: step animation
+: expand
=: expand
>: expand
-: shrink
_: shrink
<: shrink
q: exit
Ctrl-q: exit

Why not IPython via Jupyter?

There will always be a need for simple terminal-like interaction. Although there is IPython support via Jupyter all of this is pretty heavy-weight. To code to this protocol, a developer needs to write a kernel, and use a wire protocol. This adds complexity not only for the person developing this package, but also for the user who needs to load the extra layers that aren’t used. And when something goes wrong, it is harder to track down problems.

At the other end of the spectrum, if the dependencies of this package are too onerous and you want even simpler, lighter-weight terminal interaction without any of the features mentioned above, use mathics which is distributed as part of the core Mathic3 package.

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

mathicsscript-9.0.0.tar.gz (73.1 kB view details)

Uploaded Source

Built Distribution

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

mathicsscript-9.0.0-py3-none-any.whl (73.6 kB view details)

Uploaded Python 3

File details

Details for the file mathicsscript-9.0.0.tar.gz.

File metadata

  • Download URL: mathicsscript-9.0.0.tar.gz
  • Upload date:
  • Size: 73.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mathicsscript-9.0.0.tar.gz
Algorithm Hash digest
SHA256 3115fb57a1311e1fe392428355b740b9b6ec46489339baaeea904554ebda555d
MD5 8e65dda7613aa72e0f6e64c58699d8a7
BLAKE2b-256 d8f25ec9a9bc99d5efd844e72545f8b54f2a0c9b3536e888d443e944d71f4351

See more details on using hashes here.

File details

Details for the file mathicsscript-9.0.0-py3-none-any.whl.

File metadata

  • Download URL: mathicsscript-9.0.0-py3-none-any.whl
  • Upload date:
  • Size: 73.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mathicsscript-9.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b575578a59567fdf67b636d4923bea5f2197b6a381315b2bab10b3f9b02d616
MD5 b70805a4425a13ed3b4dedbddabae738
BLAKE2b-256 7a1612d838e354953bcff3a2668dc1753a87467f0397e621f7c11c04f6627984

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