Mathics
This repository is for archival. Please see https://github.com/Mathics3/mathics-core
Top Related Projects
Quick Overview
Mathics is an open-source alternative to Wolfram's Mathematica, implemented in Python. It aims to provide a free and open mathematical software system with a syntax compatible with Mathematica, making it accessible for educational and research purposes.
Pros
- Free and open-source alternative to Mathematica
- Compatible syntax with Mathematica, easing transition for users
- Extensible architecture allowing for community contributions
- Cross-platform support (Windows, macOS, Linux)
Cons
- Limited functionality compared to Mathematica
- Slower performance for complex calculations
- Smaller community and ecosystem compared to established alternatives
- May lack some advanced features found in commercial software
Code Examples
- Basic arithmetic and function evaluation:
In[1]:= 2 + 2
Out[1]= 4
In[2]:= Sin[Pi/2]
Out[2]= 1
- Solving equations:
In[3]:= Solve[x^2 + 3x + 2 == 0, x]
Out[3]= {{x -> -2}, {x -> -1}}
- Plotting a function:
In[4]:= Plot[Sin[x], {x, 0, 2Pi}]
Out[4]= [A graphical plot of sin(x) from 0 to 2π]
Getting Started
To get started with Mathics:
-
Install Mathics using pip:
pip install mathics
-
Launch the Mathics console:
mathics
-
Start using Mathics with Mathematica-like syntax:
In[1]:= Sum[i, {i, 1, 10}] Out[1]= 55
For a graphical interface, install mathics-django
and run python manage.py runserver
to access the web interface.
Competitor Comparisons
A computer algebra system written in pure Python
Pros of SymPy
- Larger and more active community, with more frequent updates and contributions
- Broader scope, covering a wide range of mathematical operations and symbolic computation
- More extensive documentation and learning resources available
Cons of SymPy
- Steeper learning curve for beginners due to its extensive feature set
- May be overkill for simpler mathematical tasks or projects
Code Comparison
Mathics:
In[1]:= Integrate[x^2, x]
Out[1]= x^3 / 3
SymPy:
from sympy import integrate, symbols
x = symbols('x')
result = integrate(x**2, x)
print(result) # Output: x**3/3
Both libraries aim to provide symbolic mathematics capabilities, but SymPy offers a more Python-native approach, while Mathics attempts to emulate Mathematica's syntax and functionality. SymPy is generally more versatile and widely used in the Python ecosystem, whereas Mathics may be more familiar to those transitioning from Mathematica.
Main repository of SageMath
Pros of Sage
- More comprehensive and feature-rich mathematical software system
- Larger and more active community, resulting in better support and documentation
- Integrates numerous open-source packages, providing a wide range of mathematical capabilities
Cons of Sage
- Larger codebase and more dependencies, leading to a more complex installation process
- Higher system requirements and potentially slower performance on less powerful hardware
- Steeper learning curve due to its extensive feature set
Code Comparison
Mathics:
In[1]:= Integrate[x^2, x]
Out[1]= x^3 / 3
Sage:
sage: integrate(x^2, x)
1/3*x^3
Both systems use similar syntax for basic operations, but Sage offers more advanced features and a wider range of mathematical functions. Mathics aims to be more lightweight and accessible, while Sage provides a more comprehensive mathematical environment.
SciPy library main repository
Pros of SciPy
- Extensive ecosystem with a wide range of scientific computing tools
- Highly optimized and efficient implementations of numerical algorithms
- Large and active community, providing support and continuous development
Cons of SciPy
- Steeper learning curve for beginners due to its vast functionality
- Requires additional libraries for symbolic mathematics capabilities
Code Comparison
Mathics (symbolic computation):
In[1]:= Integrate[x^2, x]
Out[1]= x^3 / 3
SciPy (numerical integration):
from scipy import integrate
def f(x):
return x**2
result, error = integrate.quad(f, 0, 1)
print(f"Result: {result}, Error: {error}")
Summary
SciPy is a comprehensive scientific computing library with a focus on numerical methods, while Mathics aims to provide a Mathematica-like environment for symbolic computation. SciPy offers a broader range of tools for various scientific disciplines but may be more complex for newcomers. Mathics provides a more accessible platform for symbolic mathematics but has a narrower scope compared to SciPy's extensive functionality.
The fundamental package for scientific computing with Python.
Pros of NumPy
- Extensive ecosystem and widespread adoption in scientific computing
- Highly optimized C implementations for numerical operations
- Comprehensive documentation and community support
Cons of NumPy
- Focused solely on numerical computing, lacking symbolic math capabilities
- Steeper learning curve for users new to scientific computing
- Larger codebase and dependencies compared to Mathics
Code Comparison
Mathics (Python-like syntax for Mathematica-style operations):
In[1]:= Integrate[x^2, {x, 0, 1}]
Out[1]= 1/3
NumPy (Python with NumPy for numerical operations):
import numpy as np
from scipy import integrate
result = integrate.quad(lambda x: x**2, 0, 1)
print(result[0]) # Output: 0.33333333333333337
Summary
NumPy excels in numerical computing with a robust ecosystem, while Mathics aims to provide Mathematica-like functionality in Python. NumPy is more widely used and optimized for performance, but Mathics offers symbolic computation capabilities. The choice between them depends on specific project requirements and user familiarity with each system's paradigms.
The Julia Programming Language
Pros of Julia
- High-performance scientific computing language with near-C speeds
- Designed for parallelism and distributed computing
- Large and active community with extensive package ecosystem
Cons of Julia
- Longer compilation times, especially for first runs
- Steeper learning curve for users coming from dynamically-typed languages
- Less mature than some established scientific computing environments
Code Comparison
Julia:
function fibonacci(n)
a, b = 0, 1
for _ in 1:n-1
a, b = b, a + b
end
return a
end
Mathics:
def fibonacci(n):
a, b = 0, 1
for _ in range(n-1):
a, b = b, a + b
return a
Additional Notes
Julia is a full-fledged programming language designed for scientific computing, while Mathics is a free, open-source alternative to Mathematica. Julia offers more flexibility and performance for general-purpose programming, whereas Mathics focuses on providing a Mathematica-like environment for symbolic mathematics.
Julia has a larger community and more extensive documentation, making it easier to find resources and support. Mathics, being a smaller project, may have a more limited ecosystem but can be valuable for users familiar with Mathematica syntax.
Both projects are open-source and actively maintained, but Julia has more frequent updates and a larger contributor base.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
NOTE: This repository is now mostly in archive. Please head over to the Mathics3 mathics-core github repository <https://github.com/Mathics3/mathics-core>
_.
Welcome to Mathics!
|Pypi Installs| |Latest Version| |Supported Python Versions| |Travis|_ |SlackStatus|_
|Packaging status|
Mathics is a general-purpose computer algebra system (CAS). It is an open-source alternative to Mathematica. It is free both as in "free beer" and as in "freedom".
The home page of Mathics is https://mathics.org.
ScreenShots
mathicsscript: a text interface +++++++++++++++++++++++++++++++
|mathicsscript|
mathicsserver: a Django-based Web interface +++++++++++++++++++++++++++++++++++++++++++
|mathicssserver|
Installing and Running
See the read the docs guide <https://mathics-development-guide.readthedocs.io/en/latest/>
_ for instructions on installing <https://mathics-development-guide.readthedocs.io/en/latest/installing.html>
_ and running <https://mathics-development-guide.readthedocs.io/en/latest/running.html>
_.
Contributing
Please feel encouraged to contribute to Mathics! Create your own fork, make the desired changes, commit, and make a pull request.
License
Mathics is released under the GNU General Public License Version 3 (GPL3).
.. |SlackStatus| image:: https://mathics-slackin.herokuapp.com/badge.svg .. _SlackStatus: https://mathics-slackin.herokuapp.com/ .. |Travis| image:: https://secure.travis-ci.org/mathics/Mathics.svg?branch=master .. _Travis: https://travis-ci.org/mathics/Mathics .. _PyPI: https://pypi.org/project/Mathics/ .. |mathicsscript| image:: https://github.com/Mathics3/mathicsscript/blob/master/screenshots/mathicsscript1.gif .. |mathicssserver| image:: https://mathics.org/images/mathicsserver.png .. |Latest Version| image:: https://badge.fury.io/py/Mathics3.svg :target: https://badge.fury.io/py/Mathics3 .. |Pypi Installs| image:: https://pepy.tech/badge/Mathics3 .. |Supported Python Versions| image:: https://img.shields.io/pypi/pyversions/Mathics3.svg .. |Packaging status| image:: https://repology.org/badge/vertical-allrepos/mathics.svg :target: https://repology.org/project/mathics/versions
Top Related Projects
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot