Compare commits

..
Author SHA1 Message Date
Christopher Smith e1a56ea55e Update test_solvers.py 2019-03-24 15:23:00 -05:00
796 changed files with 54434 additions and 99738 deletions
-10
View File
@@ -1,10 +0,0 @@
This folder currently holds ``durations.json`` and ``blacklisted.json`` which are used in our pytest configuration.
``durations.json`` allows the two options ``--quickcheck`` and ``--veryquickcheck`` to be passed to ``pytest``.
Currently, the list of slow tests is updated intermittently by running::
$ ./.ci/generate_durations_log.sh
$ ./.ci/parse_durations_log.py
$ git commit -am "pytest: Updated .ci/durations.json"
make sure you have a C compiler, a Fortran compiler, numpy, scipy, cython, matplotlib & sage installed (the latter can
be tricky, in which case just make sure that no sage tests are removed in the git diff).
+195 -850
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash
ABS_REPO_PATH=$(unset CDPATH && cd "$(dirname "$0")/.." && echo $PWD)
cat <<EOF >${ABS_REPO_PATH}/.ci/blacklisted.json
{
@@ -10,4 +10,4 @@ cat <<EOF >${ABS_REPO_PATH}/.ci/blacklisted.json
]
}
EOF
${PYTHON:-python} -m pytest -ra --durations 0 --verbose | tee $ABS_REPO_PATH/.ci/durations.log
python3 -m pytest -ra --durations 0 --verbose | tee $ABS_REPO_PATH/.ci/durations.log
View File
-3
View File
@@ -1,3 +0,0 @@
# These are supported funding model platforms
custom: ['https://numfocus.salsalabs.org/donate-to-sympy/index.html']
-9
View File
@@ -7,12 +7,9 @@
# track a file that is ignored for some reason, you have to use
# "git add -f". See "git help gitignore" for more information.
# Virtualenv
/.venv/
# Regular Python bytecode file
*.pyc
__pycache__/
# Optimized Python bytecode file
*.pyo
@@ -20,12 +17,6 @@ __pycache__/
# Vim's swap files
*.sw[op]
# VSCode settings file
.vscode/
# PyCharm settings file
/.idea/
# Generated files from Jython
*$py.class
-6
View File
@@ -355,7 +355,6 @@ Peter Enenkel <peter.enenkel+git@gmail.com> <peter.enenkel+github@gmail.com>
Jithin D. George <jithindgeorge93@gmail.com>
Lev Chelyadinov <leva181777@gmail.com>
Sourav Ghosh <souravghosh2197@gmail.com>
Ethan Ward <etkewa@gmail.com> etkewa@gmail.com <qsRf9sGKy9rV>
Ethan Ward <etkewa@gmail.com>
Ethan Ward <etkewa@gmail.com> <ethanward@email.arizona.edu>
Nilabja Bhattacharya <nilabja10201992@gmail.com>
@@ -413,8 +412,3 @@ Supreet Agrawal <supreet11agrawal@gmail.com> stm <supreet11agrawal@gmail.com>
Bavish Kulur <bavishkulur@gmail.com> bavish2201 <bavishkulur@gmail.com>
Divyanshu Thakur <divyanshu@iiitmanipur.ac.in> Divyanshu <divyanshu@iiitmanipur.ac.in>
Shubham Kumar Jha <skjha832@gmail.com> ShubhamKJha <skjha832@gmail.com>
Frédéric Chapoton <fchapoton2@gmail.com> fchapoton <fchapoton2@gmail.com>
Salmista-94 <alejandrogroso@hotmail.com> alejandrogroso@hotmail.com <Salmista-94>
Jack <ivanenko@ucu.edu.ua> LilJohny <ivanenko@ucu.edu.ua>
Nabanita Dash <dashnabanita@gmail.com> Nabanita Dash <31562743+Naba7@users.noreply.github.com>
Rajiv Ranjan Singh <rajivperfect007@gmail.com> Rajiv Ranjan Singh <42106787+iamrajiv@users.noreply.github.com>
+9 -29
View File
@@ -8,13 +8,14 @@ env:
matrix:
- SPLIT="1/2" TEST_SYMPY="true"
- SPLIT="2/2" TEST_SYMPY="true"
- TEST_DOCTESTS="true" FASTCACHE="false" TEST_SETUP="true" TEST_EXAMPLES="true"
- TEST_DOCTESTS="true" FASTCACHE="false" TEST_SETUP="true"
global:
- secure: "YIEZal9EBTL+fg2YmoZoS8Bvt3eAVUOZjb38CtqpzR2CCSXWoUk35KG23m2NknlY1iKfYJyt7XWBszT/VKOQEbWQq7PIakV4vIByrWacgBxy1x3WC+rZoW7TX+JJiL+y942qIYbMoNMMB8xFpE5RDLSjSecMpFhJJXoafVTvju8="
dist: trusty
python:
- 2.7
- 3.4
- 3.5
matrix:
@@ -31,7 +32,7 @@ matrix:
dist: xenial
sudo: true
env:
- TEST_DOCTESTS="true" FASTCACHE="false" TEST_SETUP="true" TEST_EXAMPLES="true"
- TEST_DOCTESTS="true" FASTCACHE="false" TEST_SETUP="true"
- python: 3.7
dist: xenial
sudo: true
@@ -44,26 +45,11 @@ matrix:
- SPLIT="2/2" TEST_SYMPY="true"
- stage: test
python: 3.8-dev
dist: xenial
sudo: true
env:
- TEST_DOCTESTS="true" FASTCACHE="false" TEST_SETUP="true" TEST_EXAMPLES="true"
- python: 3.8-dev
dist: xenial
sudo: true
env:
- SPLIT="1/2" TEST_SYMPY="true"
- python: 3.8-dev
dist: xenial
sudo: true
env:
- SPLIT="2/2" TEST_SYMPY="true"
- python: 2.7
python: 2.7
env:
- TEST_ASCII="true"
# space separated list of optional dependencies(conda packages) to install and test
- TEST_OPT_DEPENDENCY="numpy scipy gmpy2 matplotlib>=2.2 theano llvmlite autowrap cython wurlitzer python-symengine=0.3.* tensorflow numexpr ipython antlr-python-runtime>=4.7,<4.8 antlr>=4.7,<4.8 cloudpickle python=2.7 pyglet pycosat python-clang"
- TEST_OPT_DEPENDENCY="numpy scipy gmpy2 matplotlib>=2.2 theano llvmlite autowrap cython wurlitzer python-symengine=0.3.* tensorflow numexpr ipython antlr-python-runtime>=4.7,<4.8 antlr>=4.7,<4.8 cloudpickle python=2.7"
addons:
apt:
packages:
@@ -78,7 +64,7 @@ matrix:
# and we aren't actually using the Travis Python anyway.
env:
- TEST_ASCII="true"
- TEST_OPT_DEPENDENCY="numpy scipy gmpy2 matplotlib theano llvmlite autowrap cython wurlitzer python-symengine=0.3.* tensorflow numexpr ipython antlr-python-runtime>=4.7,<4.8 antlr>=4.7,<4.8 cloudpickle pyglet pycosat lfortran python-clang"
- TEST_OPT_DEPENDENCY="numpy scipy gmpy2 matplotlib theano llvmlite autowrap cython wurlitzer python-symengine=0.3.* tensorflow numexpr ipython antlr-python-runtime>=4.7,<4.8 antlr>=4.7,<4.8 cloudpickle"
- TEST_SAGE="true"
addons:
apt:
@@ -166,7 +152,7 @@ matrix:
# duplicated here and in that section below.
- python: "pypy"
env:
- TEST_DOCTESTS="true" TEST_EXAMPLES="true"
- TEST_DOCTESTS="true"
- FASTCACHE="false"
addons:
apt:
@@ -244,9 +230,6 @@ before_install:
pip install coverage;
coverage debug sys;
fi
- if [ "$TRAVIS_PYTHON_VERSION" == "3.8-dev" ]; then
pip uninstall -y Cython;
fi
- |
if [[ -n "${TEST_OPT_DEPENDENCY}" ]]; then
# We do this conditionally because it saves us some downloading if the
@@ -284,7 +267,7 @@ before_install:
pip list | grep "numpy" && pip uninstall -y numpy;
fi
- if [[ "${TEST_SPHINX}" == "true" ]]; then
pip install "sphinx" "docutils" doctr matplotlib sphinx-math-dollar;
pip install "sphinx" "docutils" doctr matplotlib;
fi
install:
@@ -299,9 +282,6 @@ install:
- pip install mpmath
# -We:invalid makes invalid escape sequences error in Python 3.6. See
# -#12028.
# SyntaxWarning flag for catching errors in Python3.8
# Issue - #16973. -We:invalid can be dropped from 3.8 onwards, but
# it needs to be there for earlier versions.
- |
if [[ "${TEST_SETUP}" == "true" ]]; then
# The install cycle below is to test installation on systems without
@@ -311,7 +291,7 @@ install:
~/.venv-no-setuptools/bin/pip uninstall -y setuptools;
~/.venv-no-setuptools/bin/python -We:invalid setup.py -q install;
fi
python -We:invalid -We::SyntaxWarning -m compileall -f -q sympy/;
python -We:invalid -m compileall -f -q sympy/;
python -We:invalid setup.py -q install;
pip list --format=columns;
+2 -26
View File
@@ -4,7 +4,7 @@ those who explicitly didn't want to be mentioned. People with a * next
to their names are not found in the metadata of the git history. This
file is generated automatically by running `./bin/authors_update.py`.
There are a total of 822 authors.
There are a total of 798 authors.
Ondřej Čertík <ondrej@certik.cz>
Fabian Pedregosa <fabian@fseoane.net>
@@ -785,7 +785,7 @@ Daniel Ingram <ingramds@appstate.edu>
Jogi Miglani <jmig5776@gmail.com>
Takumasa Nakamura <n.takumasa@gmail.com>
Ritu Raj Singh <RituRajSingh878@gmail.com>
Rajiv Ranjan Singh <rajivperfect007@gmail.com>
Rajiv Ranjan Singh <42106787+iamrajiv@users.noreply.github.com>
Vera Lozhkina <veralozhkina@gmail.com>
adhoc-king <46354827+adhoc-king@users.noreply.github.com>
Mikel Rouco <mikel.mrm@gmail.com>
@@ -804,27 +804,3 @@ Alpesh Jamgade <alpeshjamgade21@gmail.com>
Shubham Abhang <shubhamabhang77@gmail.com>
Vishesh Mangla <manglavishesh64@gmail.com>
Nicko van Someren <nicko@nicko.org>
dandiez <47832466+dandiez@users.noreply.github.com>
Frédéric Chapoton <fchapoton2@gmail.com>
jhanwar <f2015463@pilani.bits-pilani.ac.in>
Noumbissi valere Gille Geovan <noumbissivalere@gmail.com>
Salmista-94 <alejandrogroso@hotmail.com>
Shivani Kohli <shivanikohli.09@gmail.com>
Parker Berry <parker.berry@marquette.edu>
Pragyan Mehrotra <pragyan18168@iiitd.ac.in>
Nabanita Dash <dashnabanita@gmail.com>
Gaetano Guerriero <x.guerriero@tin.it>
Ankit Pandey <pandeyan@grinnell.edu>
Ritesh Kumar <ritesh99rakesh@gmail.com>
kkkkx <709563092@qq.com>
wate123 <junlin0604@gmail.com>
Corwinpro <corwinat@gmail.com>
Anway De <anway1756@gmail.com>
znxftw <vishnu2101@gmail.com>
Jack <ivanenko@ucu.edu.ua>
OrestisVaggelis <orestis22000@gmail.com>
Nikhil Maan <nikhilmaan22@gmail.com>
Abhinav Anand <abhinav.anand2807@gmail.com>
sqs <googol.sqs@gmail.com>
Juan Barbosa <js.barbosa10@uniandes.edu.co>
Prionti Nasir <pdn3628@rit.edu>
+3 -1
View File
@@ -20,7 +20,7 @@ if sys.version_info < (3, 6):
from subprocess import run, PIPE
from distutils.version import LooseVersion
from collections import OrderedDict
from collections import defaultdict, OrderedDict
def red(text):
return "\033[31m%s\033[0m" % text
@@ -47,6 +47,8 @@ git_ver = run(['git', '--version'], stdout=PIPE, encoding='utf-8').stdout[12:]
if LooseVersion(git_ver) < LooseVersion(minimal):
print(yellow("Please use a git version >= %s" % minimal))
from sympy.utilities.misc import filldedent
def author_name(line):
assert line.count("<") == line.count(">") == 1
assert line.endswith(">")
+19 -42
View File
@@ -30,9 +30,6 @@ except ImportError:
# It's html.parser in Python 3
from html.parser import HTMLParser
from sympy.utilities.misc import filldedent
# Load color templates, used from sympy/utilities/runtests.py
color_templates = (
("Black", "0;30"),
@@ -313,21 +310,14 @@ def process_function(name, c_name, b_obj, mod_path, f_sk, f_md, f_mdt, f_idt,
if name.startswith('_'):
f_sk.append(full_name)
else:
doc = obj.__doc__
if type(doc) is str:
if not doc:
add_md = True
elif not '>>>' in doc:
add_mdt = True
elif _is_indirect(name, doc):
add_idt = True
else:
f_doctest = True
elif doc is None:
# this was a function defined in the docstring
f_doctest = True
if not obj.__doc__:
add_md = True
elif not '>>>' in obj.__doc__:
add_mdt = True
elif _is_indirect(name, obj.__doc__):
add_idt = True
else:
assert None, type(doc)
f_doctest = True
function = True
@@ -380,23 +370,15 @@ def process_class(c_name, obj, c_sk, c_md, c_mdt, c_idt, c_has_doctest,
c = True
full_name = "LINE %d: %s" % (line_no, c_name)
doc = obj.__doc__
if type(doc) is str:
if not doc:
c_md.append(full_name)
elif not '>>>' in doc:
c_mdt.append(full_name)
elif _is_indirect(c_name, doc):
c_idt.append(full_name)
else:
c_dt = True
c_has_doctest.append(full_name)
elif doc is None:
# this was a class defined in the docstring
if not obj.__doc__:
c_md.append(full_name)
elif not '>>>' in obj.__doc__:
c_mdt.append(full_name)
elif _is_indirect(c_name, obj.__doc__):
c_idt.append(full_name)
else:
c_dt = True
c_has_doctest.append(full_name)
else:
assert None, type(doc)
in_sphinx = False
if sphinx:
@@ -453,7 +435,7 @@ def coverage(module_path, verbose=False, no_color=False, sphinx=True):
if member in skip_members:
continue
# Identify if the member (class/def) is a part of this module
# Identify if the member (class/def) a part of this module
obj = getattr(m, member)
obj_mod = inspect.getmodule(obj)
@@ -552,10 +534,6 @@ def coverage(module_path, verbose=False, no_color=False, sphinx=True):
def go(sympy_top, file, verbose=False, no_color=False, exact=True, sphinx=True):
# file names containing any string in skip_paths will be skipped,
skip_paths = []
if os.path.isdir(file):
doctests, total_sphinx, num_functions = 0, 0, 0
for F in os.listdir(file):
@@ -606,11 +584,10 @@ if __name__ == "__main__":
args = parser.parse_args()
if args.sphinx and not os.path.exists(os.path.join(sympy_top, 'doc', '_build', 'html')):
print(filldedent("""
Cannot check Sphinx coverage without a documentation build.
To build the docs, run "cd doc; make html". To skip
checking Sphinx coverage, pass --no-sphinx.
"""))
print("""
Cannot check Sphinx coverage without a documentation build. To build the
docs, run "cd doc; make html". To skip checking Sphinx coverage, pass --no-sphinx.
""")
sys.exit(1)
full_coverage = True
+37 -38
View File
@@ -27,7 +27,7 @@ from __future__ import print_function
import os
import re
import sys
from argparse import ArgumentParser
from optparse import OptionParser
minver = '3.4'
try:
@@ -41,6 +41,8 @@ except ImportError:
"https://launchpad.net/ubuntu/+source/python-coverage/" % minver)
sys.exit(-1)
REPORT_DIR = "covhtml"
REFRESH = False
omit_dir_patterns = ['.*tests', 'benchmark', 'examples',
'pyglet', 'test_external']
@@ -58,13 +60,13 @@ def generate_covered_files(top_dir):
yield os.path.join(dirpath, filename)
def make_report(
test_args, source_dir='sympy/', report_dir='covhtml', use_cache=False,
slow=False
):
def make_report(source_dir, report_dir, use_cache=False, slow=False):
# code adapted from /bin/test
from get_sympy import path_hack
sympy_top = path_hack()
bin_dir = os.path.abspath(os.path.dirname(__file__)) # bin/
sympy_top = os.path.split(bin_dir)[0] # ../
sympy_dir = os.path.join(sympy_top, 'sympy') # ../sympy/
if os.path.isdir(sympy_dir):
sys.path.insert(0, sympy_top)
os.chdir(sympy_top)
cov = coverage.coverage()
@@ -77,43 +79,40 @@ def make_report(
cov.erase()
cov.start()
import sympy
sympy.test(*test_args, subprocess=False, slow=slow)
sympy.test(source_dir, subprocess=False)
if slow:
sympy.test(source_dir, subprocess=False, slow=slow)
#sympy.doctest() # coverage doesn't play well with doctests
cov.stop()
try:
cov.save()
except PermissionError:
import warnings
warnings.warn(
"PermissionError has been raised while saving the " \
"coverage result.",
RuntimeWarning
)
cov.save()
covered_files = list(generate_covered_files(source_dir))
if report_dir in os.listdir(os.curdir):
for f in os.listdir(report_dir):
if f.split('.')[-1] in ['html', 'css', 'js']:
os.remove(os.path.join(report_dir, f))
cov.html_report(morfs=covered_files, directory=report_dir)
parser = ArgumentParser()
parser.add_argument(
'-c', '--use-cache', action='store_true', default=False,
help='Use cached data.')
parser.add_argument(
'-d', '--report-dir', default='covhtml',
help='Directory to put the generated report in.')
parser.add_argument(
"--slow", action="store_true", dest="slow", default=False,
help="Run slow functions also.")
options, args = parser.parse_known_args()
if __name__ == '__main__':
report_dir = options.report_dir
use_cache = options.use_cache
slow = options.slow
make_report(
args, report_dir=report_dir, use_cache=use_cache, slow=slow)
parser = OptionParser()
parser.add_option('-c', '--use-cache', action='store_true', default=False,
help='Use cached data.')
parser.add_option('-d', '--report-dir', default='covhtml',
help='Directory to put the generated report in.')
parser.add_option("--slow", action="store_true", dest="slow",
default=False, help="Run slow functions also.")
options, args = parser.parse_args()
if args:
source_dir = args[0]
else:
source_dir = 'sympy/'
make_report(source_dir, **options.__dict__)
print("The generated coverage report is in covhtml directory.")
print(
"Open %s in your web browser to view the report" %
os.sep.join([report_dir, 'index.html'])
)
print("Open %s in your web browser to view the report" % os.sep.join(
'sympy covhtml index.html'.split()))
+1 -40
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A tool to help keep .mailmap up-to-date with the
current git authors.
@@ -49,11 +50,6 @@ def author_name(line):
assert line.endswith(">")
return line.split("<", 1)[0].strip()
def author_email(line):
assert line.count("<") == line.count(">") == 1
assert line.endswith(">")
return line.split("<", 1)[1][:-1].strip()
sysexit = 0
print(blue("checking git authors..."))
@@ -120,41 +116,6 @@ if multi:
for e in sorted(dups[k]):
print('\t%s' % e)
bad_names = []
bad_emails = []
for i in git_people:
name = author_name(i)
email = author_email(i)
if '@' in name:
bad_names.append(i)
elif '@' not in email:
bad_emails.append(i)
if bad_names:
print()
print(yellow(filldedent("""
The following people appear to have an email address
listed for their name. Entries should be added to
.mailmap so that names are formatted like
"Name <email address>".
""")))
for i in bad_names:
print("\t%s" % i)
# TODO: Should we check for bad emails as well? Some people have empty email
# addresses. The above check seems to catch people who get the name and email
# backwards, so let's leave this alone for now.
# if bad_emails:
# print()
# print(yellow(filldedent("""
# The following names do not appear to have valid
# emails. Entries should be added to .mailmap that
# use a proper email address. If there is no email
# address for a person, use "none@example.com".
# """)))
# for i in bad_emails:
# print("\t%s" % i)
print()
print(blue("checking .mailmap..."))
+1 -1
View File
@@ -25,7 +25,7 @@ hard_dependencies = ['mpmath']
# These libraries are optional, but are always imported at SymPy import time
# when they are installed. External libraries should only be added to this
# list if they are required for core SymPy functionality.
hard_optional_dependencies = ['gmpy', 'gmpy2', 'fastcache', 'pycosat']
hard_optional_dependencies = ['gmpy', 'gmpy2', 'fastcache']
import sys
import os
+7 -20
View File
@@ -58,7 +58,7 @@ else:
coverage.process_startup()
''')
EOF
export COVERAGE_PROCESS_START=$TRAVIS_BUILD_DIR/coveragerc_travis
export COVERAGE_PROCESS_START=$TRAVIS_BUILD_DIR/.coveragerc
fi
if [[ "${TEST_ASCII}" == "true" ]]; then
@@ -137,8 +137,9 @@ test_list = [
# ipython
'*ipython*',
# antlr, lfortran, clang
'sympy/parsing/',
# antlr
'sympy/parsing/tests/test_autolev',
'sympy/parsing/tests/test_latex',
# matchpy
'*rubi*',
@@ -150,11 +151,6 @@ test_list = [
# cloudpickle
'pickling',
# pycosat
'sympy/logic',
'sympy/assumptions',
]
blacklist = [
@@ -184,19 +180,15 @@ doctest_list = [
# ipython
'*ipython*',
# antlr, lfortran, clang
'sympy/parsing/',
# antlr
'sympy/parsing/autolev',
'sympy/parsing/latex',
# matchpy
'*rubi*',
# codegen
'sympy/codegen/',
# pycosat
'sympy/logic',
'sympy/assumptions',
]
if not (sympy.test(*test_list, blacklist=blacklist) and sympy.doctest(*doctest_list)):
@@ -250,8 +242,3 @@ fi
if [[ "${TEST_COVERAGE}" == "true" ]]; then
unset COVERAGE_PROCESS_START
fi
if [[ "${TEST_EXAMPLES}" == "true" ]]; then
# No need to change directory if executed after the rst doctest
examples/all.py -q
fi
+1 -1
View File
@@ -11,7 +11,7 @@
# heuristics to know where a multi-line expression is
# broken. As a result you can't use more than one space
# in a sequence. However you can and must indent your
# expression using standard Python rules.
# expression using standard Pyhon rules.
#
# You can retrieve the last output using '_' built-in
# symbol. If the previous command did not generate
-26
View File
@@ -7,7 +7,6 @@ Debian/Ubuntu
To make the html documentation, install the prerequisites::
apt-get install python-sphinx texlive-latex-recommended dvipng librsvg2-bin imagemagick docbook2x graphviz
python -m pip install sphinx-math-dollar
and do::
@@ -31,7 +30,6 @@ Fedora
Fedora (and maybe other RPM based distributions), install the prerequisites::
dnf install python3-sphinx librsvg2 ImageMagick docbook2X texlive-dvipng-bin texlive-scheme-medium librsvg2-tools
python -m pip install sphinx-math-dollar
After that, run::
@@ -49,30 +47,6 @@ And view it at::
_build/html/index.html
Mac
---
- Install MacTex: http://www.tug.org/mactex/
- Install homebrew: https://brew.sh/
Install these packages with homebrew:
```bash
brew install imagemagick graphviz docbook librsvg
```
Install these packages with either pip or conda:
```bash
python -m pip install mpmath matplotlib sphinx sphinx-math-dollar
```
or
```bash
conda install -c conda-forge mpmpath matplotlib sphinx sphinx-math-dollar
```
Windows 10
----------
+1 -1
View File
@@ -9,7 +9,7 @@
*
*/
@import url("classic.css");
@import url("basic.css");
@import url(https://fonts.googleapis.com/css?family=Open+Sans);
/* -- page layout ----------------------------------------------------------- */
+2 -83
View File
@@ -12,9 +12,6 @@
# serve to show the default value.
import sys
import inspect
import os
import subprocess
import sympy
# If your extensions are in another directory, add it here.
@@ -25,7 +22,7 @@ sys.path = ['ext'] + sys.path
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.addons.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.linkcode', 'sphinx_math_dollar',
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode',
'sphinx.ext.mathjax', 'numpydoc', 'sympylive',
'sphinx.ext.graphviz', 'matplotlib.sphinxext.plot_directive']
@@ -207,83 +204,5 @@ texinfo_documents = [
]
# Use svg for graphviz
graphviz_output_format = 'svg'
# Requried for linkcode extension.
# Get commit hash from the external file.
commit_hash_filepath = '../commit_hash.txt'
commit_hash = None
if os.path.isfile(commit_hash_filepath):
with open(commit_hash_filepath, 'r') as f:
commit_hash = f.readline()
# Get commit hash from the external file.
if not commit_hash:
try:
commit_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'])
commit_hash = commit_hash.decode('ascii')
commit_hash = commit_hash.rstrip()
except:
import warnings
warnings.warn(
"Failed to get the git commit hash as the command " \
"'git rev-parse HEAD' is not working. The commit hash will be " \
"assumed as the SymPy master, but the lines may be misleading " \
"or nonexistent as it is not the correct branch the doc is " \
"built with. Check your installation of 'git' if you want to " \
"resolve this warning.")
commit_hash = 'master'
fork = 'sympy'
blobpath = \
"https://github.com/{}/sympy/blob/{}/sympy/".format(fork, commit_hash)
def linkcode_resolve(domain, info):
"""Determine the URL corresponding to Python object."""
if domain != 'py':
return
modname = info['module']
fullname = info['fullname']
submod = sys.modules.get(modname)
if submod is None:
return
obj = submod
for part in fullname.split('.'):
try:
obj = getattr(obj, part)
except Exception:
return
# strip decorators, which would resolve to the source of the decorator
# possibly an upstream bug in getsourcefile, bpo-1764286
try:
unwrap = inspect.unwrap
except AttributeError:
pass
else:
obj = unwrap(obj)
try:
fn = inspect.getsourcefile(obj)
except Exception:
fn = None
if not fn:
return
try:
source, lineno = inspect.getsourcelines(obj)
except Exception:
lineno = None
if lineno:
linespec = "#L%d-L%d" % (lineno, lineno + len(source) - 1)
else:
linespec = ""
fn = os.path.relpath(fn, start=os.path.dirname(sympy.__file__))
return blobpath + fn + linespec
+1 -1
View File
@@ -127,7 +127,7 @@ For easier use, there is a syntactic sugar for expressions.
For example, ``cos(x) + 1`` is equal to ``cos(x).__add__(1)`` is equal to
``Add(cos(x), Integer(1))``
This works because Python allows you to override the behavior of built-in
This works becauses Python allows you to override the behavior of built-in
operations ``+, *, -, /`` etc., by defining methods with names ``__add__``,
``__mul__`` etc., so ``cos(x) + 1`` is evaluated as ``cos(x).__add__(1)``.
+1 -1
View File
@@ -9,7 +9,7 @@ recommended method of installation is through Anaconda, which includes
mpmath, as well as several other useful libraries. Alternatively, some Linux
distributions have SymPy packages available.
SymPy officially supports Python 2.7, 3.5, 3.6, 3.7, and PyPy.
SymPy officially supports Python 2.7, 3.4, 3.5, 3.6 and PyPy.
Anaconda
========
+3 -3
View File
@@ -1,6 +1,6 @@
========
Algebras
========
===============
Algebras Module
===============
Introduction
------------
@@ -1,6 +0,0 @@
======
Common
======
.. automodule:: sympy.assumptions.handlers.common
:members:
@@ -11,8 +11,6 @@ Contents
:maxdepth: 3
calculus.rst
common.rst
matrices.rst
ntheory.rst
order.rst
sets.rst
@@ -1,6 +0,0 @@
========
Matrices
========
.. automodule:: sympy.assumptions.handlers.matrices
:members:
+3 -3
View File
@@ -1,8 +1,8 @@
.. _assumptions_module:
===========
Assumptions
===========
==================
Assumptions Module
==================
.. automodule:: sympy.assumptions
+1 -6
View File
@@ -10,10 +10,5 @@ Calculus
.. automodule:: sympy.calculus.singularities
:members:
.. _finite_diff:
.. automodule:: sympy.calculus.finite_diff
:members:
.. automodule:: sympy.calculus.util
.. automodule :: sympy.calculus.finite_diff
:members:
+2 -3
View File
@@ -1,6 +1,5 @@
===============
Category Theory
===============
Category Theory Module
======================
Introduction
------------
+5 -15
View File
@@ -1,8 +1,8 @@
.. _codegen_prose:
===============
Code Generation
===============
================================================
Structural Details of Code Generation with SymPy
================================================
Several submodules in SymPy allow one to generate directly compilable and
executable code in a variety of different programming languages from SymPy
@@ -164,8 +164,8 @@ An example of Mathematica code printer::
>>> expr = summation(expr, (n, -1, 1))
>>> mathematica_code(expr)
T*(x[-T]*Sin[(T + t)/T]/(T + t) + x[T]*Sin[(-T + t)/T]/(-T + t) + x[0]*Sin[t/T
]/t)
T*x[-T]*Sin[(T + t)/T]/(T + t) + T*x[T]*Sin[(-T + t)/T]/(-T + t) + T*x[0]*Sin[
t/T]/t
We can go through a common expression in different languages we support and see
how it works::
@@ -548,9 +548,6 @@ Classes and functions for rewriting expressions (sympy.codegen.rewriting)
.. automodule:: sympy.codegen.rewriting
:members:
.. automodule:: sympy.codegen.matrix_nodes
:members:
Tools for simplifying expressions using approximations (sympy.codegen.approximations)
-------------------------------------------------------------------------------------
@@ -615,10 +612,3 @@ Fortran utilities (sympy.codegen.futils)
.. automodule:: sympy.codegen.futils
:members:
Array utilities (sympy.codegen.array_utils)
-------------------------------------------
.. automodule:: sympy.codegen.array_utils
:members:
+3 -4
View File
@@ -1,8 +1,8 @@
.. _combinatiorics-docs:
=============
Combinatorics
=============
====================
Combinatorics Module
====================
Contents
========
@@ -23,4 +23,3 @@ Contents
testutil.rst
tensor_can.rst
fp_groups.rst
pc_groups.rst
-307
View File
@@ -1,307 +0,0 @@
Polycyclic Groups
=================
Introduction
------------
This module presents the functionality designed for computing with
polycyclic groups(PcGroup for short). The name of the corresponding
SymPy object is ``PolycyclicGroup``. The functions or classes described
here are studied under **Computational Group Theory**.
Overview of functionalities
```````````````````````````
* The construction of PolycyclicGroup from a given PermutationGroup.
* Computation of polycyclic generating sequence(pcgs for short) and
polycyclic series(pc_series).
* Computation of relative order for polycyclic series.
* Implementation of class Collector which can be treated as a base for polycylic groups.
* Implementation of polycyclic group presentation(pc_presentation for short).
* Computation of exponent vector, depth and leading exponent for a given element
of a polycyclic group.
For a description of fundamental algorithms of polycyclic groups, we
often make use of *Handbook of Computational Group Theory*.
The Construction of Polycyclic Groups
-------------------------------------
Given a Permutation Group, A Polycyclic Group is constructed by computing the
corresponding polycylic generating sequence, polycyclic series and it's
relative order.
Attributes of PolycyclicGroup
`````````````````````````````
* ``pc_sequence`` : Polycyclic sequence is formed by collecting all the missing
generators between the adjacent groups in the derived series of given
permutation group.
* ``pc_series`` : Polycyclic series is formed by adding all the missing generators
of ``der[i+1]`` in ``der[i]``, where ``der`` represents derived series.
* ``relative_order`` : A list, computed by the ratio of adjacent groups in pc_series.
* ``collector`` : By default, it is None. Collector class provides the polycyclic presentation.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> G = SymmetricGroup(4)
>>> PcGroup = G.polycyclic_group()
>>> len(PcGroup.pcgs)
4
>>> pc_series = PcGroup.pc_series
>>> pc_series[0]==G
True
>>> gen = pc_series[len(pc_series)-1].generators[0]
>>> gen.is_identity
True
>>> PcGroup.relative_order
[2, 3, 2, 2]
The Construction of Collector
-----------------------------
Collector is one of the attributes of class PolycyclicGroup.
Attributes of Collector
```````````````````````
Collector posses all the attributes of PolycyclicGroup, In addition there are
few more attributes which are defined below:
* ``free_group`` : free_group provides the mapping of polycyclic generating sequence with
the free group elements.
* ``pc_presentation`` : Provides the presentation of polycyclic groups with the
help of power and conjugate relators.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> G = SymmetricGroup(3)
>>> PcGroup = G.polycyclic_group()
>>> Collector = PcGroup.collector
>>> Collector.free_group
<free group on the generators (x0, x1)>
>>> Collector.pc_presentation
{x0**2: (), x1**3: (), x0**-1*x1*x0: x1**2}
Computation of Minimal Uncollected Subword
``````````````````````````````````````````
A word ``V`` defined on generators in the free_group of pc_group is a minimal
uncollected subword of the word ``W`` if ``V`` is a subword of ``W`` and it has one of
the following form:
* `v = {x_{i+1}}^{a_j}x_i`
* `v = {x_{i+1}}^{a_j}{x_i}^{-1}`
* `v = {x_i}^{a_j}`
`a_j \notin \{0, \ldots \mathrm{relative\_order}[j]-1\}`.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> from sympy.combinatorics.free_groups import free_group
>>> G = SymmetricGroup(4)
>>> PcGroup = G.polycyclic_group()
>>> collector = PcGroup.collector
>>> F, x1, x2 = free_group("x1, x2")
>>> word = x2**2*x1**7
>>> collector.minimal_uncollected_subword(word)
((x2, 2),)
Computation of Subword Index
````````````````````````````
For a given word and it's subword, subword_index computes the
starting and ending index of the subword in the word.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> from sympy.combinatorics.free_groups import free_group
>>> G = SymmetricGroup(4)
>>> PcGroup = G.polycyclic_group()
>>> collector = PcGroup.collector
>>> F, x1, x2 = free_group("x1, x2")
>>> word = x2**2*x1**7
>>> w = x2**2*x1
>>> collector.subword_index(word, w)
(0, 3)
>>> w = x1**7
>>> collector.subword_index(word, w)
(2, 9)
Computation of Collected Word
`````````````````````````````
A word ``W`` is called collected, if ``W`` `= {x_{i_1}}^{a_1} \ldots {x_{i_r}}^{a_r}`
with `i_1 < i_2< \ldots < i_r` and `a_j` is in `\{1 \ldots s_{j-1}\}`, where `s_j`
represents the respective relative order.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> from sympy.combinatorics.perm_groups import PermutationGroup
>>> from sympy.combinatorics.free_groups import free_group
>>> G = SymmetricGroup(4)
>>> PcGroup = G.polycyclic_group()
>>> collector = PcGroup.collector
>>> F, x0, x1, x2, x3 = free_group("x0, x1, x2, x3")
>>> word = x3*x2*x1*x0
>>> collected_word = collector.collected_word(word)
>>> free_to_perm = {}
>>> free_group = collector.free_group
>>> for sym, gen in zip(free_group.symbols, collector.pcgs):
... free_to_perm[sym] = gen
>>> G1 = PermutationGroup()
>>> for w in word:
... sym = w[0]
... perm = free_to_perm[sym]
... G1 = PermutationGroup([perm] + G1.generators)
>>> G2 = PermutationGroup()
>>> for w in collected_word:
... sym = w[0]
... perm = free_to_perm[sym]
... G2 = PermutationGroup([perm] + G2.generators)
>>> G1 == G2
True
Computation of Polycyclic Presentation
--------------------------------------
The computation of presentation starts from the bottom of the pcgs and polycyclic series.
Storing all the previous generators from pcgs and then taking the last generator
as the generator which acts as a conjugator and conjugates all the previous
generators in the list.
To get a clear picture, start with an example of SymmetricGroup(4). For S(4) there are 4
generators in pcgs say `[x_0, x_1, x_2, x_3]` and the relative_order vector is [2, 3, 2, 2].
Starting from bottom of this sequence the presentation is computed in order as below.
using only `[x_3]` from ``pcgs`` and ``pc_series[4]`` compute:
* `x_3^2`
using only `[x_3]` from ``pcgs`` and ``pc_series[3]`` compute:
* `x_2^2`
* `x_2^{-1}x_3x_2`
using `[x_3, x_2]` from ``pcgs`` and ``pc_series[2]`` compute:
* `x_1^3`
* `x_1^{-1}x_3x_1`
* `x_1^{-1}x_2x_1`
using `[x_3, x_2, x_1]` from ``pcgs`` and ``pc_series[1]`` compute:
* `x_0^2`
* `x_0^{-1}x_3x_0`
* `x_0^{-1}x_2x_0`
* `x_0^{-1}x_1x_0`
One thing to note is same group can have different pcgs due to variying derived_series which,
results in different polycyclic presentations.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> from sympy.combinatorics.permutations import Permutation
>>> G = SymmetricGroup(4)
>>> PcGroup = G.polycyclic_group()
>>> collector = PcGroup.collector
>>> pcgs = PcGroup.pcgs
>>> len(pcgs)
4
>>> free_group = collector.free_group
>>> pc_resentation = collector.pc_presentation
>>> free_to_perm = {}
>>> for s, g in zip(free_group.symbols, pcgs):
... free_to_perm[s] = g
>>> for k, v in pc_resentation.items():
... k_array = k.array_form
... if v != ():
... v_array = v.array_form
... lhs = Permutation()
... for gen in k_array:
... s = gen[0]
... e = gen[1]
... lhs = lhs*free_to_perm[s]**e
... if v == ():
... assert lhs.is_identity
... continue
... rhs = Permutation()
... for gen in v_array:
... s = gen[0]
... e = gen[1]
... rhs = rhs*free_to_perm[s]**e
... assert lhs == rhs
Computation of Exponent Vector
------------------------------
Any generator of the polycyclic group can be represented with the help of it's
polycyclic generating sequence. Hence, the length of exponent vector is equal to
the length of the pcgs.
A given generator ``g`` of the polycyclic group, can be represented as
`g = x_1^{e_1} \ldots x_n^{e_n}`, where `x_i` represents polycyclic generators
and ``n`` is the number of generators in the free_group equal to the length of pcgs.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> from sympy.combinatorics.permutations import Permutation
>>> G = SymmetricGroup(4)
>>> PcGroup = G.polycyclic_group()
>>> collector = PcGroup.collector
>>> pcgs = PcGroup.pcgs
>>> collector.exponent_vector(G[0])
[1, 0, 0, 0]
>>> exp = collector.exponent_vector(G[1])
>>> g = Permutation()
>>> for i in range(len(exp)):
... g = g*pcgs[i]**exp[i] if exp[i] else g
>>> assert g == G[1]
Depth of Polycyclic generator
`````````````````````````````
Depth of a given polycyclic generator is defined as the index of the first
non-zero entry in the exponent vector.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> G = SymmetricGroup(3)
>>> PcGroup = G.polycyclic_group()
>>> collector = PcGroup.collector
>>> collector.depth(G[0])
2
>>> collector.depth(G[1])
1
Computation of Leading Exponent
```````````````````````````````
Leading exponent represents the exponent of polycyclic generator at the above depth.
>>> from sympy.combinatorics.named_groups import SymmetricGroup
>>> G = SymmetricGroup(3)
>>> PcGroup = G.polycyclic_group()
>>> collector = PcGroup.collector
>>> collector.leading_exponent(G[1])
1
Bibliography
------------
.. [Ho05] Derek F. Holt,
Handbook of Computational Group Theory.
In the series 'Discrete Mathematics and its Applications',
`Chapman & Hall/CRC 2005, xvi + 514 p <https://www.crcpress.com/Handbook-of-Computational-Group-Theory/Holt-Eick-OBrien/p/book/9781584883722>`_.
+2 -3
View File
@@ -1,6 +1,5 @@
========
Concrete
========
Concrete Mathematics
====================
Hypergeometric terms
--------------------
+2 -3
View File
@@ -1,6 +1,5 @@
====
Core
====
SymPy Core
==========
sympify
-------
+2 -15
View File
@@ -1,6 +1,5 @@
============
Cryptography
============
Basic Cryptography Module
=========================
.. warning::
@@ -51,18 +50,10 @@ substitutions at different times in the message.
.. autofunction:: decipher_shift
.. autofunction:: encipher_rot13
.. autofunction:: decipher_rot13
.. autofunction:: encipher_affine
.. autofunction:: decipher_affine
.. autofunction:: encipher_atbash
.. autofunction:: decipher_atbash
.. autofunction:: encipher_substitution
.. autofunction:: encipher_vigenere
@@ -142,7 +133,3 @@ substitutions at different times in the message.
.. autofunction:: encipher_gm
.. autofunction:: decipher_gm
.. autofunction:: encipher_railfence
.. autofunction:: decipher_railfence
+2 -3
View File
@@ -1,6 +1,5 @@
=====================
Differential Geometry
=====================
Differential Geometry Module
============================
.. module:: sympy.diffgeom
+2 -3
View File
@@ -1,6 +1,5 @@
========
Discrete
========
Discrete Module
===============
The ``discrete`` module in SymPy implements methods to compute discrete
transforms and convolutions of finite sequences.
+1 -2
View File
@@ -1,7 +1,6 @@
.. _evalf-label:
====================
Numerical Evaluation
Numerical evaluation
====================
Basics
+2 -3
View File
@@ -1,8 +1,7 @@
.. _functions:
=========
Functions
=========
Functions Module
****************
.. module:: sympy.functions
+3 -3
View File
@@ -1,6 +1,6 @@
========
Geometry
========
===============
Geometry Module
===============
Introduction
+1 -1
View File
@@ -36,7 +36,7 @@ Here `D` is the Differential Operator and `L` is called the annihilator
of the function.
A unique holonomic function can be defined from the annihilator and a set of
initial conditions.
initial conditons.
For instance:
.. math::
+1 -1
View File
@@ -1,7 +1,7 @@
Converting other representations to holonomic
=============================================
.. currentmodule:: sympy.holonomic.holonomic
.. module:: sympy.holonomic.holonomic
Converting hypergeometric functions
-----------------------------------
+3 -3
View File
@@ -1,8 +1,8 @@
.. _holonomic-docs:
=========
Holonomic
=========
===================
Holonomic Functions
===================
.. automodule:: sympy.holonomic
+1 -1
View File
@@ -29,7 +29,7 @@ a holonomic functions.
>>> p * q
HolonomicFunction((2) + (-2)*Dx + (1)*Dx**2, x, 0, [0, 1])
.. currentmodule:: sympy.holonomic.holonomic
.. module:: sympy.holonomic.holonomic
Integration and Differentiation
-------------------------------
+1 -1
View File
@@ -1,7 +1,7 @@
Representation of holonomic functions in SymPy
==============================================
.. currentmodule:: sympy.holonomic.holonomic
.. module:: sympy.holonomic.holonomic
Class :class:`DifferentialOperator` is used to represent the annihilator
but we create differential operators easily using the function
+1 -1
View File
@@ -1,4 +1,4 @@
.. currentmodule:: sympy.holonomic.holonomic
.. module:: sympy.holonomic.holonomic
Uses and Current limitations
============================
+23 -23
View File
@@ -16,49 +16,49 @@ access any SymPy module, or use the list below:
.. toctree::
:maxdepth: 2
algebras.rst
assumptions/index.rst
calculus/index.rst
categories.rst
codegen.rst
combinatorics/index.rst
concrete.rst
core.rst
combinatorics/index.rst
ntheory.rst
crypto.rst
diffgeom.rst
solvers/diophantine.rst
concrete.rst
discrete.rst
evalf.rst
codegen.rst
numeric-computation.rst
functions/index.rst
geometry/index.rst
holonomic/index.rst
simplify/hyperexpand.rst
solvers/inequalities.rst
integrals/integrals.rst
liealgebras/index.rst
logic.rst
matrices/index.rst
ntheory.rst
numeric-computation.rst
evalf.rst
solvers/ode.rst
parsing.rst
solvers/pde.rst
physics/index.rst
plotting.rst
polys/index.rst
printing.rst
plotting.rst
assumptions/index.rst
rewriting.rst
series/index.rst
sets.rst
simplify/simplify.rst
solvers/solvers.rst
solvers/solveset.rst
simplify/hyperexpand.rst
stats.rst
solvers/ode.rst
solvers/pde.rst
solvers/solvers.rst
solvers/diophantine.rst
solvers/inequalities.rst
solvers/solveset.rst
tensor/index.rst
rewriting.rst
utilities/index.rst
parsing.rst
calculus/index.rst
physics/index.rst
categories.rst
diffgeom.rst
vector/index.rst
algebras.rst
Contributions to Docs
Contributions to docs
---------------------
All contributions are welcome. If you'd like to improve something, look into
+2 -3
View File
@@ -1,6 +1,5 @@
=========
Integrals
=========
Symbolic Integrals
==================
.. module:: sympy.integrals
+3 -3
View File
@@ -1,6 +1,6 @@
===========
Lie Algebra
===========
==================
Lie Algebra Module
==================
.. automodule:: sympy.liealgebras
+2 -3
View File
@@ -1,6 +1,5 @@
=====
Logic
=====
Logic Module
============
.. module:: sympy.logic
-4
View File
@@ -34,10 +34,6 @@ Matrix Expressions Core Reference
:members:
.. autoclass:: MatPow
:members:
.. autoclass:: HadamardProduct
:members:
.. autoclass:: HadamardPower
:members:
.. autoclass:: Inverse
:members:
.. autoclass:: Transpose
-25
View File
@@ -325,31 +325,6 @@ but we can also apply functions to our matrix entries using ``applyfunc()``. Her
[ ]
[0 0 2]
If you want to extract a common factor from a matrix you can do so by
applying ``gcd`` to the data of the matrix:
>>> from sympy.abc import x, y
>>> from sympy import gcd
>>> m = Matrix([[x, y], [1, x*y]]).inv(); m
[ -x*y y ]
[---------- ----------]
[ 2 2 ]
[- x *y + y - x *y + y]
[ ]
[ 1 -x ]
[---------- ----------]
[ 2 2 ]
[- x *y + y - x *y + y]
>>> gcd(tuple(_))
1
----------
2
- x *y + y
>>> m/_
[-x*y y ]
[ ]
[ 1 -x]
One more useful matrix-wide entry application function is the substitution function. Let's declare a matrix with symbolic entries then substitute a value. Remember we can substitute anything - even another symbol!:
>>> from sympy import Symbol
+1 -34
View File
@@ -1,6 +1,5 @@
=============
Number Theory
=============
====================
.. module:: sympy.ntheory.generate
@@ -50,8 +49,6 @@ Ntheory Functions Reference
.. autofunction:: factorint
.. autofunction:: factorrat
.. autofunction:: primefactors
.. autofunction:: divisors
@@ -88,20 +85,6 @@ Ntheory Functions Reference
.. autoclass:: primeomega
:members:
.. autofunction:: mersenne_prime_exponent
.. autofunction:: is_perfect
.. autofunction:: is_mersenne_prime
.. autofunction:: abundance
.. autofunction:: is_abundant
.. autofunction:: is_deficient
.. autofunction:: is_amicable
.. module:: sympy.ntheory.modular
.. autofunction:: symmetric_residue
@@ -130,18 +113,8 @@ Ntheory Functions Reference
.. module:: sympy.ntheory.primetest
.. autofunction:: is_euler_pseudoprime
.. autofunction:: is_square
.. autofunction:: mr
.. autofunction:: is_lucas_prp
.. autofunction:: is_strong_lucas_prp
.. autofunction:: is_extra_strong_lucas_prp
.. autofunction:: isprime
.. module:: sympy.ntheory.residue_ntheory
@@ -154,8 +127,6 @@ Ntheory Functions Reference
.. autofunction:: sqrt_mod
.. autofunction:: sqrt_mod_iter
.. autofunction:: quadratic_residues
.. autofunction:: nthroot_mod
@@ -179,7 +150,3 @@ Ntheory Functions Reference
.. module:: sympy.ntheory.egyptian_fraction
.. autofunction:: egyptian_fraction
.. module:: sympy.ntheory.bbp_pi
.. autofunction:: pi_hex_digits
+2 -24
View File
@@ -1,6 +1,5 @@
=======
Parsing
=======
Parsing input
=============
Parsing Functions Reference
---------------------------
@@ -91,27 +90,6 @@ change between releases, and become stricter, more relaxed, or some mix.
.. autoclass:: sympy.parsing.latex.LaTeXParsingError
SymPy Expression Reference
--------------------------
.. module:: sympy.parsing.sym_expr
.. autoclass:: SymPyExpression
:members:
`Fortran` Parsing Reference
---------------------------------
.. module:: sympy.parsing.fortran.fortran_parser
.. autoclass:: ASR2PyVisitor
:members:
.. autofunction:: call_visitor
.. autofunction:: src_to_sympy
Runtime Installation
--------------------
@@ -5,7 +5,7 @@ Solving Beam Bending Problems using Singularity Functions
To make this document easier to read, enable pretty printing:
.. plot::
:context: reset
:context:
:format: doctest
:include-source: True
@@ -175,7 +175,7 @@ final loading can be displayed:
- 258⋅<x> + 52⋅<x> - 8⋅<x> + 50⋅<x - 5> + 8⋅<x - 5> - 12⋅<x - 9>
At this point, the beam is fully defined and the internal shear and bending
moments are calculated:
moments are calculated like so:
.. plot::
:context:
@@ -246,7 +246,7 @@ Example 2
---------
There is a beam of length 30 meters. A moment of magnitude 120 Nm is
applied in the clockwise direction at the end of the beam. A point load
applied in the clockwise direction at the end of the beam. A pointload
of magnitude 8 N is applied from the top of the beam at the starting
point. There are two simple supports below the beam. One at the end
and another one at a distance of 10 meters from the start. The
@@ -377,7 +377,7 @@ Example 4
An overhanging beam of length 8 meters is pinned at 1 meter from starting point
and supported by a roller 1 meter before the other end. It is subjected
to a distributed constant load of 10 KN/m from the starting point till
2 meters away from it. Two point loads of 20KN and 8KN are applied at
2 meters away from it. Two pointloads of 20KN and 8KN are applied at
5 meters and 7.5 meters away from the starting point respectively.
::
@@ -738,7 +738,7 @@ Example 9
---------
There is a cantilever beam of length 4 meters. For first 2 meters
its moment of inertia is ``1.5*I`` and ``I`` for the rest.
its moment of inertia is ``1.5*I`` and ``I`` for the other end.
A pointload of magnitude 20 N is applied from the top at its free end.
::
@@ -791,7 +791,7 @@ Example 10
A combined beam, with constant flexural rigidity ``E*I``, is formed by joining
a Beam of length ``2*l`` to the right of another Beam of length ``l``. The whole beam
is fixed at both of its ends. A point load of magnitude ``P`` is also applied
is fixed at both of its both end. A point load of magnitude ``P`` is also applied
from the top at a distance of ``2*l`` from starting point.
::
@@ -866,7 +866,7 @@ from the top at a distance of ``2*l`` from starting point.
E⋅I E⋅I E⋅I
Example 11
----------
==========
Any type of load defined by a polynomial can be applied to the beam. This
allows approximation of arbitrary load distributions. The following example
+3 -3
View File
@@ -1,8 +1,8 @@
.. _physics-docs:
=======
Physics
=======
==============
Physics Module
==============
.. automodule:: sympy.physics
@@ -82,7 +82,7 @@ The parser can be used as follows::
>>> sympy_code = parse_autolev(open('double_pendulum.al'), include_numeric=True)
# The include_pydy flag is False by default. Setting it to True will
# enable PyDy simulation code to be outputted if applicable.
# enable PyDy simulation code to be outputed if applicable.
>>> print(sympy_code)
import sympy.physics.mechanics as me
+51 -55
View File
@@ -223,42 +223,40 @@ The following example shows how to use the momenta functions in
One begins by creating the requisite symbols to describe the system. Then
the reference frame is created and the kinematics are done. ::
>>> from sympy import symbols
>>> from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame
>>> from sympy.physics.mechanics import RigidBody, Particle, Point, outer
>>> from sympy.physics.mechanics import linear_momentum, angular_momentum
>>> m, M, l1 = symbols('m M l1')
>>> q1d = dynamicsymbols('q1d')
>>> N = ReferenceFrame('N')
>>> O = Point('O')
>>> O.set_vel(N, 0 * N.x)
>>> Ac = O.locatenew('Ac', l1 * N.x)
>>> P = Ac.locatenew('P', l1 * N.x)
>>> a = ReferenceFrame('a')
>>> a.set_ang_vel(N, q1d * N.z)
>>> Ac.v2pt_theory(O, N, a)
l1*q1d*N.y
>>> P.v2pt_theory(O, N, a)
2*l1*q1d*N.y
>> from sympy import symbols
>> from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame
>> from sympy.physics.mechanics import RigidBody, Particle, Point, outer
>> from sympy.physics.mechanics import linear_momentum, angular_momentum
>> m, M, l1 = symbols('m M l1')
>> q1d = dynamicsymbols('q1d')
>> N = ReferenceFrame('N')
>> O = Point('O')
>> O.set_vel(N, 0 * N.x)
>> Ac = O.locatenew('Ac', l1 * N.x)
>> P = Ac.locatenew('P', l1 * N.x)
>> a = ReferenceFrame('a')
>> a.set_ang_vel(N, q1d * N.z)
>> Ac.v2pt_theory(O, N, a)
>> P.v2pt_theory(O, N, a)
Finally, the bodies that make up the system are created. In this case the
system consists of a particle Pa and a RigidBody A. ::
>>> Pa = Particle('Pa', P, m)
>>> I = outer(N.z, N.z)
>>> A = RigidBody('A', Ac, a, M, (I, Ac))
>> Pa = Particle('Pa', P, m)
>> I = outer(N.z, N.z)
>> A = RigidBody('A', Ac, a, M, (I, Ac))
Then one can either choose to evaluate the momenta of individual components
of the system or of the entire system itself. ::
>>> linear_momentum(N,A)
>> linear_momentum(N,A)
M*l1*q1d*N.y
>>> angular_momentum(O, N, Pa)
>> angular_momentum(O, N, Pa)
4*l1**2*m*q1d*N.z
>>> linear_momentum(N, A, Pa)
>> linear_momentum(N, A, Pa)
(M*l1*q1d + 2*l1*m*q1d)*N.y
>>> angular_momentum(O, N, A, Pa)
(M*l1**2*q1d + 4*l1**2*m*q1d + q1d)*N.z
>> angular_momentum(O, N, A, Pa)
(4*l1**2*m*q1d + q1d)*N.z
It should be noted that the user can determine either momenta in any frame
in :mod:`mechanics` as the user is allowed to specify the reference frame when
@@ -327,34 +325,33 @@ The following example shows how to use the energy functions in
As was discussed above in the momenta functions, one first creates the system
by going through an identical procedure. ::
>>> from sympy import symbols
>>> from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame, outer
>>> from sympy.physics.mechanics import RigidBody, Particle
>>> from sympy.physics.mechanics import kinetic_energy, potential_energy, Point
>>> m, M, l1, g, h, H = symbols('m M l1 g h H')
>>> omega = dynamicsymbols('omega')
>>> N = ReferenceFrame('N')
>>> O = Point('O')
>>> O.set_vel(N, 0 * N.x)
>>> Ac = O.locatenew('Ac', l1 * N.x)
>>> P = Ac.locatenew('P', l1 * N.x)
>>> a = ReferenceFrame('a')
>>> a.set_ang_vel(N, omega * N.z)
>>> Ac.v2pt_theory(O, N, a)
l1*omega*N.y
>>> P.v2pt_theory(O, N, a)
2*l1*omega*N.y
>>> Pa = Particle('Pa', P, m)
>>> I = outer(N.z, N.z)
>>> A = RigidBody('A', Ac, a, M, (I, Ac))
>> from sympy import symbols
>> from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame, outer
>> from sympy.physics.mechanics import RigidBody, Particle, mechanics_printing
>> from symp.physics.mechanics import kinetic_energy, potential_energy, Point
>> mechanics_printing()
>> m, M, l1, g, h, H = symbols('m M l1 g h H')
>> omega = dynamicsymbols('omega')
>> N = ReferenceFrame('N')
>> O = Point('O')
>> O.set_vel(N, 0 * N.x)
>> Ac = O.locatenew('Ac', l1 * N.x)
>> P = Ac.locatenew('P', l1 * N.x)
>> a = ReferenceFrame('a')
>> a.set_ang_vel(N, omega * N.z)
>> Ac.v2pt_theory(O, N, a)
>> P.v2pt_theory(O, N, a)
>> Pa = Particle('Pa', P, m)
>> I = outer(N.z, N.z)
>> A = RigidBody('A', Ac, a, M, (I, Ac))
The user can then determine the kinetic energy of any number of entities of the
system: ::
>>> kinetic_energy(N, Pa)
2*l1**2*m*omega(t)**2
>>> kinetic_energy(N, Pa, A)
M*l1**2*omega(t)**2/2 + 2*l1**2*m*omega(t)**2 + omega(t)**2/2
>> kinetic_energy(N, Pa)
2*l1**2*m*q1d**2
>> kinetic_energy(N, Pa, A)
M*l1**2*q1d**2/2 + 2*l1**2*m*q1d**2 + q1d**2/2
It should be noted that the user can determine either kinetic energy relative
to any frame in :mod:`mechanics` as the user is allowed to specify the
@@ -366,15 +363,14 @@ every entity of the system using the :mod:`potential_energy` property. The
potential energy of any number of entities comprising the system can then be
determined: ::
>>> Pa.potential_energy = m * g * h
>>> A.potential_energy = M * g * H
>>> potential_energy(A, Pa)
>> Pa.potential_energy = m * g * h
>> A.potential_energy = M * g * H
>> potential_energy(A, Pa)
H*M*g + g*h*m
One can also determine the Lagrangian for this system: ::
>>> from sympy.physics.mechanics import Lagrangian
>>> Lagrangian(N, Pa, A)
-H*M*g + M*l1**2*omega(t)**2/2 - g*h*m + 2*l1**2*m*omega(t)**2 + omega(t)**2/2
>> Lagrangian(Pa, A)
-H*M*g + M*l1**2*q1d**2/2 - g*h*m + 2*l1**2*m*q1d**2 + q1d**2/2
Please refer to the docstrings to learn more about each function.
+2 -2
View File
@@ -108,9 +108,9 @@ the outcoming result):
>>> from sympy.physics.units import convert_to
>>> convert_to(q, day)
71.5112118495813*pi*day
71.5123904642338*pi*day
>>> convert_to(q, day).n()
224.659097795948*day
224.662800523082*day
We could also have the solar mass and the day as units coming from the
astrophysical system, but we wanted to show how to create a unit that one needs.
+4 -11
View File
@@ -1,6 +1,5 @@
========
Plotting
========
Plotting Module
===============
.. module:: sympy.plotting.plot
@@ -46,12 +45,6 @@ Plotting Function Reference
.. autofunction:: sympy.plotting.plot_implicit.plot_implicit
PlotGrid Class
--------------
.. autoclass:: sympy.plotting.plot.PlotGrid
:members:
Series Classes
--------------
@@ -88,8 +81,8 @@ Series Classes
Pyglet Plotting
---------------
Pyglet Plotting Module
======================
.. module:: sympy.plotting.pygletplot
+3 -3
View File
@@ -1,8 +1,8 @@
.. _polys-docs:
=======================
Polynomial Manipulation
=======================
===============================
Polynomials Manipulation Module
===============================
Computations with polynomials are at the core of computer algebra and
having a fast and robust polynomials manipulation module is a key for
+9 -23
View File
@@ -1,8 +1,7 @@
========
Printing
========
Printing System
===============
See the :ref:`tutorial-printing` section in tutorial for introduction into
See the :ref:`tutorial-printing` section in Tutorial for introduction into
printing.
This guide documents the printing system in SymPy and how it works
@@ -14,7 +13,8 @@ Printer Class
.. automodule:: sympy.printing.printer
The main class responsible for printing is ``Printer`` (see also its
`source code <https://github.com/sympy/sympy/blob/master/sympy/printing/printer.py>`_):
`source code
<https://github.com/sympy/sympy/blob/master/sympy/printing/printer.py>`_):
.. autoclass:: Printer
:members: doprint, _print, set_global_settings, order
@@ -185,10 +185,10 @@ An example where line wrapping is required:
>>> expr = sqrt(1-x**2).series(x,n=20).removeO()
>>> print(fcode(expr))
-715.0d0/65536.0d0*x**18 - 429.0d0/32768.0d0*x**16 - 33.0d0/
@ 2048.0d0*x**14 - 21.0d0/1024.0d0*x**12 - 7.0d0/256.0d0*x**10 -
@ 5.0d0/128.0d0*x**8 - 1.0d0/16.0d0*x**6 - 1.0d0/8.0d0*x**4 - 1.0d0
@ /2.0d0*x**2 + 1
-715.0d0/65536.0d0*x**18 - 429.0d0/32768.0d0*x**16 - 33.0d0/
@ 2048.0d0*x**14 - 21.0d0/1024.0d0*x**12 - 7.0d0/256.0d0*x**10 -
@ 5.0d0/128.0d0*x**8 - 1.0d0/16.0d0*x**6 - 1.0d0/8.0d0*x**4 - 1.0d0
@ /2.0d0*x**2 + 1
In case of line wrapping, it is handy to include the assignment so that lines
are wrapped properly when the assignment part is added.
@@ -301,20 +301,6 @@ Mathematica code printing
.. autofunction:: sympy.printing.mathematica.mathematica_code
Maple code printing
-------------------
.. module:: sympy.printing.maple
.. autoclass:: sympy.printing.maple.MapleCodePrinter
:members:
.. autoattribute:: MapleCodePrinter.printmethod
.. autofunction:: sympy.printing.maple.maple_code
.. autofunction:: sympy.printing.maple.print_maple_code
Javascript Code printing
------------------------
+2 -3
View File
@@ -1,5 +1,4 @@
==============
Term Rewriting
Term rewriting
==============
Term rewriting is a very general class of functionalities which are used to
@@ -62,7 +61,7 @@ use ``rewrite()`` to do specific type of rewrite::
Common Subexpression Detection and Collection
---------------------------------------------
.. currentmodule:: sympy.simplify.cse_main
.. module:: sympy.simplify.cse_main
Before evaluating a large expression, it is often useful to identify common
subexpressions, collect them and evaluate them at once. This is implemented
+3 -3
View File
@@ -1,8 +1,8 @@
.. _series-docs:
======
Series
======
=============
Series Module
=============
The series module implements series expansions as a function and many related
functions.
+1 -26
View File
@@ -1,6 +1,5 @@
====
Sets
====
===========
.. automodule:: sympy.sets.sets
@@ -94,27 +93,3 @@ ComplexRegion
:members:
.. autofunction:: normalize_theta_set
Iteration over sets
^^^^^^^^^^^^^^^^^^^
For set unions, `\{a, b\} \cup \{x, y\}` can be treated as
`\{a, b, x, y\}` for iteration regardless of the distinctiveness of
the elements, however, for set intersections, assuming that
`\{a, b\} \cap \{x, y\}` is `\varnothing` or `\{a, b \}` would not
always be valid, since some of `a`, `b`, `x` or `y` may or may not be
the elements of the intersection.
Iterating over the elements of a set involving intersection, complement,
or symmetric difference yields (possibly duplicate) elements of the set
provided that all elements are known to be the elements of the set.
If any element cannot be determined to be a member of a set then the
iteration gives ``TypeError``.
This happens in the same cases where ``x in y`` would give an error.
There are some reasons to implement like this, even if it breaks the
consistency with how the python set iterator works.
We keep in mind that sympy set comprehension like ``FiniteSet(*s)`` from
a existing sympy sets could be a common usage.
And this approach would make ``FiniteSet(*s)`` to be consistent with any
symbolic set processing methods like ``FiniteSet(*simplify(s))``.
+3 -4
View File
@@ -1,12 +1,11 @@
========================
Hypergeometric Expansion
========================
Details on the Hypergeometric Function Expansion Module
#######################################################
This page describes how the function :func:`hyperexpand` and related code
work. For usage, see the documentation of the symplify module.
Hypergeometric Function Expansion Algorithm
===========================================
*******************************************
This section describes the algorithm used to expand hypergeometric functions.
Most of it is based on the papers [Roach1996]_ and [Roach1997]_.
+1 -6
View File
@@ -1,6 +1,5 @@
========
Simplify
========
********
.. currentmodule:: sympy.simplify.simplify
@@ -16,10 +15,6 @@ nthroot
-------
.. autofunction:: nthroot
kroneckersimp
-------------
.. autofunction:: kroneckersimp
besselsimp
----------
.. autofunction:: besselsimp
-16
View File
@@ -64,10 +64,6 @@ the various ODE solving methods. For this reason, they are documented here.
^^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_sol_simplicity
:obj:`factorable`
^^^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_factorable
:obj:`1st_exact`
^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_1st_exact
@@ -88,14 +84,6 @@ the various ODE solving methods. For this reason, they are documented here.
^^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_1st_linear
:obj:`2nd_linear_airy`
^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_2nd_linear_airy
:obj:`2nd_linear_bessel`
^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_2nd_linear_bessel
:obj:`Bernoulli`
^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_Bernoulli
@@ -124,10 +112,6 @@ the various ODE solving methods. For this reason, they are documented here.
^^^^^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_nth_algebraic
:obj:`nth_order_reducible`
^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_nth_order_reducible
:obj:`separable`
^^^^^^^^^^^^^^^^
.. autofunction:: sympy.solvers.ode.ode_separable
+1 -1
View File
@@ -524,7 +524,7 @@ How are symbolic parameters handled in solveset?
>>> not_empty_in(FiniteSet(x/2).intersect(Interval(0, 1)), x)
Interval(0, 2)
>>> not_empty_in(FiniteSet(x, x**2).intersect(Interval(1, 2)), x)
Union(Interval(1, 2), Interval(-sqrt(2), -1))
Union(Interval(-sqrt(2), -1), Interval(1, 2))
References
+4 -26
View File
@@ -1,6 +1,5 @@
=====
Stats
=====
===========
.. automodule:: sympy.stats
@@ -8,7 +7,7 @@ Random Variable Types
^^^^^^^^^^^^^^^^^^^^^
Finite Types
------------
---------------
.. autofunction:: DiscreteUniform
.. autofunction:: Die
.. autofunction:: Bernoulli
@@ -19,7 +18,7 @@ Finite Types
.. autofunction:: Rademacher
Discrete Types
--------------
-----------------
.. autofunction:: Geometric
.. autofunction:: Poisson
.. autofunction:: Logarithmic
@@ -28,7 +27,7 @@ Discrete Types
.. autofunction:: Zeta
Continuous Types
----------------
-------------------
.. autofunction:: Arcsin
.. autofunction:: Benini
@@ -46,8 +45,6 @@ Continuous Types
.. autofunction:: Frechet
.. autofunction:: Gamma
.. autofunction:: GammaInverse
.. autofunction:: Gompertz
.. autofunction:: Gumbel
.. autofunction:: Kumaraswamy
.. autofunction:: Laplace
.. autofunction:: Logistic
@@ -60,8 +57,6 @@ Continuous Types
.. autofunction:: RaisedCosine
.. autofunction:: Rayleigh
.. autofunction:: StudentT
.. autofunction:: ShiftedGompertz
.. autofunction:: Trapezoidal
.. autofunction:: Triangular
.. autofunction:: Uniform
.. autofunction:: UniformSum
@@ -70,22 +65,6 @@ Continuous Types
.. autofunction:: WignerSemicircle
.. autofunction:: ContinuousRV
Joint Types
-----------
.. autofunction:: JointRV
.. autofunction:: GeneralizedMultivariateLogGamma
.. autofunction:: GeneralizedMultivariateLogGammaOmega
.. autofunction:: Multinomial
.. autofunction:: MultivariateBeta
.. autofunction:: MultivariateEwens
.. autofunction:: MultivariateT
.. autofunction:: NegativeMultinomial
.. autofunction:: NormalGamma
Stochastic Processes
--------------------
.. autofunction:: DiscreteMarkovChain
Interface
^^^^^^^^^
@@ -94,7 +73,6 @@ Interface
.. autofunction:: E
.. autoclass:: Expectation
.. autofunction:: density
.. autofunction:: entropy
.. autofunction:: given
.. autofunction:: where
.. autofunction:: variance
+3 -3
View File
@@ -1,8 +1,8 @@
.. _tensor_module:
======
Tensor
======
=============
Tensor Module
=============
.. automodule:: sympy.tensor
+15 -11
View File
@@ -5,12 +5,25 @@ Tensor
.. module:: sympy.tensor.tensor
.. autoclass:: _TensorManager
:members:
.. autoclass:: TensorIndexType
:members:
.. autoclass:: TensorIndex
:members:
.. autofunction:: tensor_indices
.. autoclass:: TensorSymmetry
:members:
.. autofunction:: tensorsymmetry
.. autoclass:: TensorType
:members:
.. autoclass:: TensorHead
:members:
@@ -25,17 +38,8 @@ Tensor
.. autofunction:: canon_bp
.. autofunction:: tensor_mul
.. autofunction:: riemann_cyclic_replace
.. autofunction:: riemann_cyclic
.. autoclass:: TensorSymmetry
:members:
.. autofunction:: tensorsymmetry
.. autoclass:: TensorType
:members:
.. autoclass:: _TensorManager
:members:
+3 -3
View File
@@ -1,6 +1,6 @@
======
Vector
======
=============
Vector Module
=============
The vector module provides tools for basic vector math
and differential calculus with respect to 3D Cartesian coordinate
@@ -101,7 +101,7 @@ Coefficients of `c_i` evaluated at `x_i + 2*h`:
>>> m32 = P(x0+2*h, x0, c, n).diff(c[1])
>>> m33 = P(x0+2*h, x0, c, n).diff(c[2])
Matrix of the coefficients is 3x3 in this case:
Matrix of the coeffcients is 3x3 in this case:
>>> M = Matrix([[m11, m12, m13], [m21, m22, m23], [m31, m32, m33]])
@@ -143,7 +143,7 @@ at `x_i` and thus using points at `x_{i-1}`, `x_{i}`, and `x_{i+1}`. So here i
>>> m31 = P(x0+h, x0, c, n).diff(c[0])
>>> m32 = P(x0+h, x0, c, n).diff(c[1])
>>> m33 = P(x0+h, x0, c, n).diff(c[2])
>>> # matrix of the coefficients is 3x3 in this case
>>> # matrix of the coeffcients is 3x3 in this case
>>> M = Matrix([[m11, m12, m13], [m21, m22, m23], [m31, m32, m33]])
Now that we have the matrix of coefficients we next form the right-hand-side and solve by inverting `M`:
@@ -219,7 +219,7 @@ degree polynomial P coefficients of `c_i` evaluated at `x_i, x_{i-1},` and `x_{i
>>> m32 = P(xN-2*h, xN, c, n).diff(c[1])
>>> m33 = P(xN-2*h, xN, c, n).diff(c[2])
Next we construct the `3 \times 3` matrix of the coefficients:
Next we construct the `3 \times 3` matrix of the coeffcients:
>>> M = Matrix([[m11, m12, m13], [m21, m22, m23], [m31, m32, m33]])
>>> # matrix of the function values...actually a vector of right hand sides
@@ -247,8 +247,7 @@ Also, we note that output of formats appropriate to Fortran, C, etc. may be d
given above.
Next we show how to perform these and many other discritizations of derivatives, but using a
much more efficient approach originally due to Bengt Fornberg and now incorporated into SymPy.
much more efficient approach originally due to Bengt Fornberg and now incorported into SymPy.
:ref:`calculus-finite-differences`
:ref:`Finite difference weights <finite_diff>`
+5 -7
View File
@@ -196,11 +196,11 @@ definite integrals. Here is a sampling of some of the power of ``integrate``.
⎮ sin⎝x ⎠ dx
⌡
>>> integ.doit()
⎛√2⋅x⎞
3⋅√2⋅√π⋅S⎜────⎟⋅Γ(3/4)
⎝ √π ⎠
──────────────────────
8⋅Γ(7/4)
⎛√2⋅x⎞
3⋅√2⋅√π⋅fresnels⎜────⎟⋅Γ(3/4)
⎝ √π ⎠
─────────────────────────────
8⋅Γ(7/4)
>>> integ = Integral(x**y*exp(-x), (x, 0, oo))
>>> integ
@@ -322,8 +322,6 @@ The ``O`` notation supports arbitrary limit points (other than 0):
-5 + ──────── + ──────── + ──────── + ──────── + x + O⎝(x - 6) ; x → 6⎠
2 6 24 120
.. _calculus-finite-differences:
Finite differences
==================
+26 -27
View File
@@ -30,38 +30,37 @@ expression looks like internally by using ``srepr``
The easiest way to tear this apart is to look at a diagram of the expression
tree:
.. This comes from dotprint(x**2 + x*y, labelfunc=srepr)
.. This comes from dotprint(2**x + x*y, labelfunc=srepr)
.. graphviz::
digraph{
# Graph style
"ordering"="out"
"rankdir"="TD"
#########
# Nodes #
#########
"Add(Pow(Symbol('x'), Integer(2)), Mul(Symbol('x'), Symbol('y')))_()" ["color"="black", "label"="Add", "shape"="ellipse"];
"Pow(Symbol('x'), Integer(2))_(0,)" ["color"="black", "label"="Pow", "shape"="ellipse"];
"Symbol('x')_(0, 0)" ["color"="black", "label"="Symbol('x')", "shape"="ellipse"];
"Integer(2)_(0, 1)" ["color"="black", "label"="Integer(2)", "shape"="ellipse"];
"Mul(Symbol('x'), Symbol('y'))_(1,)" ["color"="black", "label"="Mul", "shape"="ellipse"];
"Symbol('x')_(1, 0)" ["color"="black", "label"="Symbol('x')", "shape"="ellipse"];
"Symbol('y')_(1, 1)" ["color"="black", "label"="Symbol('y')", "shape"="ellipse"];
"Symbol(x)_(0, 0)" ["color"="black", "label"="Symbol('x')", "shape"="ellipse"];
"Integer(2)_(1, 1)" ["color"="black", "label"="Integer(2)", "shape"="ellipse"];
"Symbol(y)_(0, 1)" ["color"="black", "label"="Symbol('y')", "shape"="ellipse"];
"Symbol(x)_(1, 0)" ["color"="black", "label"="Symbol('x')", "shape"="ellipse"];
"Mul(Symbol(x), Symbol(y))_(0,)" ["color"="black", "label"="Mul", "shape"="ellipse"];
"Pow(Symbol(x), Integer(2))_(1,)" ["color"="black", "label"="Pow", "shape"="ellipse"];
"Add(Mul(Symbol(x), Symbol(y)), Pow(Symbol(x), Integer(2)))_()" ["color"="black", "label"="Add", "shape"="ellipse"];
#########
# Edges #
#########
"Add(Pow(Symbol('x'), Integer(2)), Mul(Symbol('x'), Symbol('y')))_()" -> "Pow(Symbol('x'), Integer(2))_(0,)";
"Add(Pow(Symbol('x'), Integer(2)), Mul(Symbol('x'), Symbol('y')))_()" -> "Mul(Symbol('x'), Symbol('y'))_(1,)";
"Pow(Symbol('x'), Integer(2))_(0,)" -> "Symbol('x')_(0, 0)";
"Pow(Symbol('x'), Integer(2))_(0,)" -> "Integer(2)_(0, 1)";
"Mul(Symbol('x'), Symbol('y'))_(1,)" -> "Symbol('x')_(1, 0)";
"Mul(Symbol('x'), Symbol('y'))_(1,)" -> "Symbol('y')_(1, 1)";
"Mul(Symbol(x), Symbol(y))_(0,)" -> "Symbol(x)_(0, 0)";
"Mul(Symbol(x), Symbol(y))_(0,)" -> "Symbol(y)_(0, 1)";
"Pow(Symbol(x), Integer(2))_(1,)" -> "Symbol(x)_(1, 0)";
"Pow(Symbol(x), Integer(2))_(1,)" -> "Integer(2)_(1, 1)";
"Add(Mul(Symbol(x), Symbol(y)), Pow(Symbol(x), Integer(2)))_()" -> "Mul(Symbol(x), Symbol(y))_(0,)";
"Add(Mul(Symbol(x), Symbol(y)), Pow(Symbol(x), Integer(2)))_()" -> "Pow(Symbol(x), Integer(2))_(1,)";
}
.. note::
@@ -83,16 +82,16 @@ expression, 2, we got ``Integer(2)``. ``Integer`` is the SymPy class for
integers. It is similar to the Python built-in type ``int``, except that
``Integer`` plays nicely with other SymPy types.
When we write ``x**2``, this creates a ``Pow`` object. ``Pow`` is short for
When we write ``2**x``, this creates a ``Pow`` object. ``Pow`` is short for
"power".
>>> srepr(x**2)
"Pow(Symbol('x'), Integer(2))"
>>> srepr(2**x)
"Pow(Integer(2), Symbol('x'))"
We could have created the same object by calling ``Pow(x, 2)``
We could have created the same object by calling ``Pow(2, x)``
>>> Pow(x, 2)
x**2
>>> Pow(2, x)
2**x
Note that in the ``srepr`` output, we see ``Integer(2)``, the SymPy version of
integers, even though technically, we input ``2``, a Python int. In general,
@@ -105,7 +104,7 @@ function that does this is ``sympify`` [#sympify-fn]_.
>>> type(sympify(2))
<class 'sympy.core.numbers.Integer'>
We have seen that ``x**2`` is represented as ``Pow(x, 2)``. What about
We have seen that ``2**x`` is represented as ``Pow(2, x)``. What about
``x*y``? As we might expect, this is the multiplication of ``x`` and ``y``.
The SymPy class for multiplication is ``Mul``.
@@ -117,13 +116,13 @@ Thus, we could have created the same object by writing ``Mul(x, y)``.
>>> Mul(x, y)
x*y
Now we get to our final expression, ``x**2 + x*y``. This is the addition of
our last two objects, ``Pow(x, 2)``, and ``Mul(x, y)``. The SymPy class for
Now we get to our final expression, ``2**x + x*y``. This is the addition of
our last two objects, ``Pow(2, x)``, and ``Mul(x, y)``. The SymPy class for
addition is ``Add``, so, as you might expect, to create this object, we use
``Add(Pow(x, 2), Mul(x, y))``.
``Add(Pow(2, x), Mul(x, y))``.
>>> Add(Pow(x, 2), Mul(x, y))
x**2 + x*y
>>> Add(Pow(2, x), Mul(x, y))
2**x + x*y
SymPy expression trees can have many branches, and can be quite deep or quite
broad. Here is a more complicated example
+2 -2
View File
@@ -151,7 +151,7 @@ raise it to the ``-1`` power.
>>> N**-1
Traceback (most recent call last):
...
NonInvertibleMatrixError: Matrix det == 0; not invertible.
ValueError: Matrix det == 0; not invertible.
To take the transpose of a Matrix, use ``T``.
@@ -427,7 +427,7 @@ guaranteed to be accurate in some limited domain of numerics and symbols,
and any complicated expressions beyond its decidability are treated as ``None``,
which behaves similarly to logical ``False``.
The list of methods using zero testing procedures are as follows:
The list of methods using zero testing procedures are as followings.
``echelon_form`` , ``is_echelon`` , ``rank`` , ``rref`` , ``nullspace`` ,
``eigenvects`` , ``inverse_ADJ`` , ``inverse_GE`` , ``inverse_LU`` ,
+6 -13
View File
@@ -221,7 +221,6 @@ imported from ``sympy.printing.mathml``.
``print_mathml()`` prints the output. If you want the string, use the
function ``mathml()``.
Dot
---
@@ -230,33 +229,27 @@ format, which can be rendered with Graphviz. See the
:ref:`tutorial-manipulation` section for some examples of the output of this
printer.
Here is an example of the raw output of the ``dotprint()`` function
>>> from sympy.printing.dot import dotprint
>>> from sympy.abc import x
>>> print(dotprint(x+2))
>>> print(dotprint(x+2))
digraph{
<BLANKLINE>
# Graph style
"ordering"="out"
"rankdir"="TD"
<BLANKLINE>
#########
# Nodes #
#########
<BLANKLINE>
"Add(Integer(2), Symbol('x'))_()" ["color"="black", "label"="Add", "shape"="ellipse"];
"Add(Integer(2), Symbol(x))_()" ["color"="black", "label"="Add", "shape"="ellipse"];
"Integer(2)_(0,)" ["color"="black", "label"="2", "shape"="ellipse"];
"Symbol('x')_(1,)" ["color"="black", "label"="x", "shape"="ellipse"];
<BLANKLINE>
"Symbol(x)_(1,)" ["color"="black", "label"="x", "shape"="ellipse"];
#########
# Edges #
#########
<BLANKLINE>
"Add(Integer(2), Symbol('x'))_()" -> "Integer(2)_(0,)";
"Add(Integer(2), Symbol('x'))_()" -> "Symbol('x')_(1,)";
"Add(Integer(2), Symbol(x))_()" -> "Integer(2)_(0,)";
"Add(Integer(2), Symbol(x))_()" -> "Symbol(x)_(1,)";
}
.. rubric:: Footnotes
.. [#srepr-fn] SymPy does not use the Python builtin ``repr()`` function for
+15 -9
View File
@@ -110,7 +110,7 @@ In the ``solveset`` module, the non linear system of equations is solved using
>>> nonlinsolve([x**2 + 1, y**2 + 1], [x, y])
{(-ⅈ, -ⅈ), (-ⅈ, ⅈ), (ⅈ, -ⅈ), (ⅈ, ⅈ)}
3. When both real and complex solution are present:
3. When both real and complex solution is present:
>>> from sympy import sqrt
>>> system = [x**2 - 2*y**2 -2, x*y - 2]
@@ -118,11 +118,17 @@ In the ``solveset`` module, the non linear system of equations is solved using
>>> nonlinsolve(system, vars)
{(-2, -1), (2, 1), (-√2⋅ⅈ, √2⋅ⅈ), (√2⋅ⅈ, -√2⋅ⅈ)}
>>> n = Dummy('n')
>>> system = [exp(x) - sin(y), 1/y - 3]
>>> nonlinsolve(system, vars)
{({2⋅n⋅ⅈ⋅π + log(sin(1/3)) | n ∊ ℤ}, 1/3)}
>>> real_soln = (log(sin(S(1)/3)), S(1)/3)
>>> img_lamda = Lambda(n, 2*n*I*pi + Mod(log(sin(S(1)/3)), 2*I*pi))
>>> complex_soln = (ImageSet(img_lamda, S.Integers), S(1)/3)
>>> soln = FiniteSet(real_soln, complex_soln)
>>> nonlinsolve(system, [x, y]) == soln
True
4. When the system is positive-dimensional system (has infinitely many solutions):
4. If non linear system of equations is Positive dimensional system (A system with
infinitely many solutions is said to be positive-dimensional):
>>> nonlinsolve([x*y, x*y - x], [x, y])
{(0, y)}
@@ -142,14 +148,14 @@ In the ``solveset`` module, the non linear system of equations is solved using
``solve`` can be used for such cases:
>>> solve([x**2 - y**2/exp(x)], [x, y], dict=True)
⎡⎧ ⎛-y ⎞⎫ ⎧ ⎛y⎞⎫⎤
⎢⎨x: 2⋅W⎜───⎟⎬, ⎨x: 2⋅W⎜─⎟⎬⎥
⎣⎩ ⎝ 2 ⎠⎭ ⎩ ⎝2⎠⎭⎦
⎡⎧ ⎛y⎞⎫⎤
⎢⎨x: 2⋅LambertW⎜─⎟⎬⎥
⎣⎩ ⎝2⎠⎭⎦
3. Currently ``nonlinsolve`` is not properly capable of solving the system of equations
having trigonometric functions.
``solve`` can be used for such cases (but does not give all solution):
``solve`` can be used for such cases(not all solution):
>>> solve([sin(x + y), cos(x - y)], [x, y])
⎡⎛-3⋅π 3⋅π⎞ ⎛-π π⎞ ⎛π 3⋅π⎞ ⎛3⋅π π⎞⎤
@@ -179,7 +185,7 @@ multiplicity 1 and ``3`` is a root of multiplicity 2.
``solve`` can be used for such cases:
>>> solve(x*exp(x) - 1, x )
[W(1)]
[LambertW(1)]
.. _tutorial-dsolve:
+1
View File
@@ -30,6 +30,7 @@ if not plt:
import mpmath
from sympy.utilities.autowrap import ufuncify
from sympy.utilities.lambdify import implemented_function
from sympy import symbols, legendre, pprint
+3 -1
View File
@@ -2,9 +2,11 @@
"""Demonstration of quantum dense coding."""
from sympy import pprint
from sympy import sqrt, pprint
from sympy.physics.quantum import qapply
from sympy.physics.quantum.gate import H, X, Z, CNOT
from sympy.physics.quantum.qubit import Qubit
from sympy.physics.quantum.circuitplot import circuit_plot
from sympy.physics.quantum.grover import superposition_basis
+1 -1
View File
@@ -15,7 +15,7 @@ $ python fem.py
"""
from sympy import symbols, Symbol, factorial, Rational, zeros, eye, \
from sympy import symbols, Symbol, factorial, Rational, zeros, div, eye, \
integrate, diff, pprint, reduced
x, y, z = symbols('x,y,z')
+5 -4
View File
@@ -7,9 +7,10 @@ computation of the digits of pi.
"""
from mpmath import libmp, pi
from mpmath import functions as mpf_funs
import math
from sympy.core.compatibility import clock
from time import clock
import sys
@@ -69,9 +70,9 @@ def calculateit(func, base, n, tofile):
def interactive():
"""Simple function to interact with user"""
print("Compute digits of pi with SymPy\n")
base = int(input("Which base? (2-36, 10 for decimal) \n> "))
digits = int(input("How many digits? (enter a big number, say, 10000)\n> "))
tofile = input("Output to file? (enter a filename, or just press enter\nto print directly to the screen) \n> ")
base = input("Which base? (2-36, 10 for decimal) \n> ")
digits = input("How many digits? (enter a big number, say, 10000)\n> ")
tofile = raw_input("Output to file? (enter a filename, or just press enter\nto print directly to the screen) \n> ")
if tofile:
tofile = open(tofile, "w")
calculateit(pi, base, digits, tofile)
+5 -4
View File
@@ -3,15 +3,16 @@
"""
Plotting Examples
Suggested Usage: python -i pyglet_plotting.py
Suggested Usage: python -i plotting.py
"""
from sympy import symbols, sin, cos, pi, sqrt
from sympy.core.compatibility import range, clock
from sympy import symbols
from sympy.plotting.pygletplot import PygletPlot
from sympy import sin, cos, pi, sqrt, exp
from sympy.core.compatibility import range
from time import sleep
from time import sleep, clock
def main():
+2 -2
View File
@@ -15,8 +15,8 @@ SymPy, but that's a long journey.
"""
from sympy import Basic, Symbol, Matrix, \
ones, sqrt, pprint, Eq, sympify
from sympy import Basic, exp, Symbol, sin, Rational, I, Mul, Matrix, \
ones, sqrt, pprint, simplify, Eq, sympify
from sympy.physics import msigma, mgamma
+2 -2
View File
@@ -13,8 +13,8 @@ something is not clear, like what the Ricci tensor is, etc.
"""
from sympy import (exp, Symbol, sin, dsolve, Function,
Matrix, Eq, pprint, solve)
from sympy import (exp, Symbol, sin, Rational, Derivative, dsolve, Function,
Matrix, Eq, pprint, Pow, classify_ode, solve)
def grad(f, X):
+1 -1
View File
@@ -23,7 +23,7 @@ def main():
show( limit(x*(sqrt(x**2 + 1) - x), x, oo), Rational(1)/2 )
show( limit(x - sqrt3(x**3 - 1), x, oo), Rational(0) )
show( limit(x - sqrt(x**3 - 1), x, oo), Rational(0) )
show( limit(log(1 + exp(x))/x, x, -oo), Rational(0) )
+1 -1
View File
@@ -12,7 +12,7 @@ from sympy.physics.secondquant import (AntiSymmetricTensor, wicks,
F, Fd, NO, evaluate_deltas, substitute_dummies, Commutator,
simplify_index_permutations, PermutationOperator)
from sympy import (
symbols, Rational, latex, Dummy
symbols, expand, pprint, Rational, latex, Dummy
)
pretty_dummies_dict = {
+1 -1
View File
@@ -9,7 +9,7 @@ import sys
from sample import sample
from sympy import sqrt, Symbol
from sympy import log, pi, sqrt, sin, Symbol
from sympy.core.compatibility import is_sequence
from sympy.external import import_module
+1 -1
View File
@@ -9,7 +9,7 @@ import sys
from sample import sample
from sympy import Symbol
from sympy import sin, Symbol
from sympy.external import import_module
@@ -5,7 +5,7 @@
Demonstrates various ways to solve partial differential equations
"""
from sympy import symbols, Eq, Function, pde_separate, pprint, sin, cos
from sympy import symbols, Eq, Function, pde_separate, pprint, sin, cos, latex
from sympy import Derivative as D
@@ -20,7 +20,7 @@ def main():
eq = Eq(D(Xi(r, phi, theta), r, 2) + 2/r * D(Xi(r, phi, theta), r) +
1/(r**2 * sin(phi)**2) * D(Xi(r, phi, theta), theta, 2) +
cos(phi)/(r**2 * sin(phi)) * D(Xi(r, phi, theta), phi) +
1/r**2 * D(Xi(r, phi, theta), phi, 2), 0)
1/r**2 * D(Xi(r, phi, theta), phi, 2))
pprint(eq)
pprint("We can either separate this equation in regards with variable r:")
+1 -1
View File
@@ -21,7 +21,7 @@ def sample2d(f, x_args):
try:
f = sympify(f)
except SympifyError:
raise ValueError("f could not be interpreted as a SymPy function")
raise ValueError("f could not be interpretted as a SymPy function")
try:
x, x_min, x_max, x_n = x_args
except (TypeError, IndexError):
+1 -1
View File
@@ -6,7 +6,7 @@ Demonstrates matrix computations using the Vandermonde matrix.
* https://en.wikipedia.org/wiki/Vandermonde_matrix
"""
from sympy import Matrix, pprint, Rational, symbols, Symbol, zeros
from sympy import Matrix, pprint, Rational, sqrt, symbols, Symbol, zeros
from sympy.core.compatibility import range
+1 -1
View File
@@ -44,7 +44,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"There are a number of steps needed to construct matrix $A$. Let us consider an example from https://dl.acm.org/citation.cfm?id=550525 to \n",
"There are a number of steps needed to contruct matrix $A$. Let us consider an example from https://dl.acm.org/citation.cfm?id=550525 to \n",
"show the construction."
]
},
+1 -1
View File
@@ -68,7 +68,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"From the definition, it is clear that the resultant will equal zero if and only if $p$ and $q$ have at least one common root. Thus, the resultant becomes very useful in identifying whether common roots exist. "
"From the definition, it is clear that the resultant will equal zero if and only if $p$ and $q$ have at least one common root. Thus, the resultant becomes very usefull in identifying whether common roots exist. "
]
},
{
+1 -1
View File
@@ -3,7 +3,7 @@ FROM continuumio/anaconda3
WORKDIR /root
RUN apt-get update \
&& apt-get install -y libc6-i386 libc6 linux-headers-amd64 git make zip graphviz inkscape texlive-xetex texlive-fonts-recommended texlive-latex-extra librsvg2-bin docbook2x latexmk libatlas-dev libatlas-base-dev liblapack-dev gfortran gcc \
&& apt-get install -y libc6-i386 libc6 linux-headers-amd64 git make zip graphviz inkscape texlive-xetex texlive-fonts-recommended texlive-latex-extra librsvg2-bin docbook2x latexmk \
&& apt-get -y clean
RUN conda config --add channels conda-forge
+2 -14
View File
@@ -24,12 +24,6 @@ First, make sure that you have done the following things
- Push the release branch up to origin, and make a pull request for it against
master.
- Create the release notes page for the new release on the wiki. See
https://github.com/sympy/sympy-bot/issues/26. The easiest way to do this is
to copy the old release notes to a new page and remove all the changes, and
update the version number. The formatting on the release notes page is
important as otherwise the bot will fail, so it is best to do it this way.
It is important to create a new branch because that lets master continue as
normal. The release script will automatically checkout the release branch from
origin, which is why you need to push it (it determines what the release
@@ -60,9 +54,9 @@ script can take about an hour or so to run (depending on how long the tests
take). Every time you re-run the script, it pulls from the branch and runs
everything from scratch.
At the end it will print two things, the list of authors, and the sha256 sums.
At the end it will print two things, the list of authors, and the md5 sums.
Copy the list of authors into the release notes. You should verify that the
sha256 sums of the release files are the same as what are printed.
md5 sums of the release files are the same as what are printed.
# Tagging the release
@@ -144,9 +138,3 @@ Once you have it working, push the changes up to Dockerhub
docker push sympy/sympy-release
You'll need access to the sympy org, ask Aaron or Ondřej if you need it.
It is usually not necessary to rebuild the Docker container. The container
first pulls the latest version of the release branch before running rever
(see `pull_and_run_rever.sh`), so unless you modify that script, or change the
packages that are installed in the container, it should not be necessary to
rebuild it.
+32 -82
View File
@@ -33,20 +33,16 @@ $ACTIVITIES = [
'mailmap_update',
'test_sympy',
'source_tarball',
'wheel',
'build_docs',
'copy_release_files',
'compare_tar_against_git',
'test_tarball27',
'test_tarball34',
'test_tarball35',
'test_tarball36',
'test_tarball37',
'test_wheel27',
'test_wheel35',
'test_wheel36',
'test_wheel37',
'print_authors',
'sha256',
'md5',
# 'tag',
]
@@ -74,8 +70,8 @@ def mailmap_update():
@activity
def test_sympy():
with run_in_conda_env(['mpmath', 'matplotlib>=2.2', 'numpy', 'scipy', 'theano',
'ipython', 'gmpy2', 'fastcache', 'symengine', 'libgfortran', 'cython',
'tensorflow', 'llvmlite', 'wurlitzer', 'autowrap',
'ipython', 'gmpy2', 'fastcache', 'symengine', 'libgfortran', 'libgcc',
'gcc', 'cython', 'tensorflow', 'llvmlite', 'wurlitzer', 'autowrap',
'python-symengine=0.3.*', 'numexpr', 'antlr-python-runtime>=4.7,<4.8',
'antlr>=4.7,<4.8'], 'sympy-tests'):
@@ -87,16 +83,9 @@ def source_tarball():
# Assumes this is run in Docker and git is already clean
./setup.py sdist --keep-temp
@activity(deps={'_version', 'mailmap_update', 'test_sympy'})
def wheel():
with run_in_conda_env(['mpmath', 'python=3.6', 'setuptools', 'pip', 'wheel'], 'sympy-release'):
# Assumes this is run in Docker and git is already clean
./setup.py bdist_wheel --universal --keep-temp
@activity(deps={'_version'})
def build_docs():
with run_in_conda_env(['sphinx', 'docutils', 'numpy', 'mpmath', 'matplotlib'],
with run_in_conda_env(['sphinx', 'docutils', 'numpy', 'mpmath'],
envname='sympy-release-docs'):
cd doc
@@ -119,7 +108,7 @@ def build_docs():
cd ../../../
@activity(deps={'source_tarball', 'wheel', 'build_docs'})
@activity(deps={'source_tarball', 'build_docs'})
def copy_release_files():
ls dist
cp dist/* /root/release/
@@ -128,6 +117,10 @@ def copy_release_files():
def test_tarball27():
test_tarball('2.7')
@activity(deps={'source_tarball'})
def test_tarball34():
test_tarball('3.4')
@activity(deps={'source_tarball'})
def test_tarball35():
test_tarball('3.5')
@@ -140,22 +133,6 @@ def test_tarball36():
def test_tarball37():
test_tarball('3.7')
@activity(deps={'wheel'})
def test_wheel27():
test_wheel('2.7')
@activity(deps={'wheel'})
def test_wheel35():
test_wheel('3.5')
@activity(deps={'wheel'})
def test_wheel36():
test_wheel('3.6')
@activity(deps={'wheel'})
def test_wheel37():
test_wheel('3.7')
@activity(deps={'source_tarball'})
def compare_tar_against_git():
"""
@@ -199,7 +176,7 @@ def compare_tar_against_git():
if fail:
sys.exit(red("Non-whitelisted files found or not found in the tarball"))
@activity(deps={'source_tarball', 'wheel'})
@activity(deps={'source_tarball'})
def print_authors():
"""
Print authors text to put at the bottom of the release notes
@@ -223,18 +200,18 @@ Thanks to everyone who contributed to this release!
print("- " + name)
print()
@activity(deps={'source_tarball', 'wheel', 'build_docs'})
def sha256():
@activity(deps={'source_tarball', 'build_docs'})
def md5():
"""
Print the sha256 sums of the release files
Print the md5 sums of the release files
"""
_sha256(print_=True)
_md5(print_=True)
def _sha256(print_=True, local=False):
def _md5(print_=True, local=False):
if local:
out = $(shasum -a 256 @(release_files()))
out = $(md5sum @(release_files()))
else:
out = $(shasum -a 256 /root/release/*)
out = $(md5sum /root/release/*)
# Remove the release/ part for printing. Useful for copy-pasting into the
# release notes.
out = [i.split() for i in out.strip().split('\n')]
@@ -243,12 +220,7 @@ def _sha256(print_=True, local=False):
print(out)
return out
@activity(deps={'mailmap_update', 'sha256', 'print_authors',
'source_tarball', 'wheel', 'build_docs',
'compare_tar_against_git', 'test_tarball27',
'test_tarball35', 'test_tarball36', 'test_wheel27',
'test_wheel35', 'test_wheel36',
'test_wheel37', 'test_sympy'})
@activity(deps={'mailmap_update', 'md5', 'print_authors', 'source_tarball', 'build_docs', 'compare_tar_against_git', 'test_tarball27', 'test_tarball34', 'test_tarball35', 'test_tarball36', 'test_sympy'})
def release():
pass
@@ -282,32 +254,16 @@ def test_tarball(py_version):
Test that the tarball can be unpacked and installed, and that sympy
imports in the install.
"""
if py_version not in {'2.7', '3.5', '3.6', '3.7'}: # TODO: Add win32
raise ValueError("release must be one of 2.7, 3.5, 3.6, or 3.7 not %s" % py_version)
with run_in_conda_env(['python=%s' % py_version], 'test-install-%s' % py_version):
cp @('/root/release/{source}'.format(**tarball_format)) @("releasetar.tar.gz".format(**tarball_format))
tar xvf releasetar.tar.gz
cd @("{source-orig-notar}".format(**tarball_format))
python setup.py install
python -c "import sympy; print(sympy.__version__); print('sympy installed successfully')"
python -m isympy --help
isympy --help
def test_wheel(py_version):
"""
Test that the wheel can be installed, and that sympy imports in the install.
"""
if py_version not in {'2.7', '3.4', '3.5', '3.6', '3.7'}: # TODO: Add win32
raise ValueError("release must be one of 2.7, 3.4, 3.5, 3.6, or 3.7 not %s" % py_version)
with run_in_conda_env(['python=%s' % py_version], 'test-install-%s' % py_version):
cp @('/root/release/{wheel}'.format(**tarball_format)) @("{wheel}".format(**tarball_format))
pip install @("{wheel}".format(**tarball_format))
cp @('/root/release/{source}'.format(**tarball_format)) @("releasetar.tar".format(**tarball_format))
tar xvf releasetar.tar
cd @("/root/{source-orig-notar}".format(**tarball_format))
python setup.py install
python -c "import sympy; print(sympy.__version__); print('sympy installed successfully')"
python -m isympy --help
isympy --help
@@ -321,7 +277,6 @@ def get_tarball_name(file):
source-orig: The original name of the source tarball
source-orig-notar: The name of the untarred directory
source: The source tarball (after renaming)
wheel: The wheel
html: The name of the html zip
html-nozip: The name of the html, without ".zip"
pdf-orig: The original name of the pdf file
@@ -343,8 +298,6 @@ def get_tarball_name(file):
name += ".{extension}"
elif file == 'pdf-orig':
name = "sympy-{version}.pdf"
elif file == 'wheel':
name = 'sympy-{version}-py2.py3-none-any.whl'
else:
raise ValueError(file + " is not a recognized argument")
@@ -356,7 +309,6 @@ tarball_name_types = {
'source-orig',
'source-orig-notar',
'source',
'wheel',
'html',
'html-nozip',
'pdf-orig',
@@ -589,7 +541,7 @@ def _GitHub_release(username=None, user='sympy', token=None,
print(green("Done"))
# TODO: download the files and check that they have the right sha256 sum
# TODO: download the files and check that they have the right md5 sum
def _size(print_=True):
"""
@@ -613,8 +565,8 @@ def table():
tarball_formatter_dict['version'] = shortversion
sha256s = [i.split('\t') for i in _sha256(print_=False, local=True).split('\n')]
sha256s_dict = {name: sha256 for sha256, name in sha256s}
md5s = [i.split('\t') for i in _md5(print_=False, local=True).split('\n')]
md5s_dict = {name: md5 for md5, name in md5s}
sizes = [i.split('\t') for i in _size(print_=False).split('\n')]
sizes_dict = {name: size for size, name in sizes}
@@ -637,7 +589,7 @@ def table():
with tag('table'):
with tag('tr'):
for headname in ["Filename", "Description", "size", "sha256"]:
for headname in ["Filename", "Description", "size", "md5"]:
with tag("th"):
table.append(headname)
@@ -653,7 +605,7 @@ def table():
with tag('td'):
table.append(sizes_dict[name])
with tag('td'):
table.append(sha256s_dict[name])
table.append(md5s_dict[name])
out = ' '.join(table)
return out
@@ -670,7 +622,7 @@ See https://github.com/sympy/sympy/wiki/release-notes-for-{shortversion} for the
{htmltable}
**Note**: Do not download the **Source code (zip)** or the **Source code (tar.gz)**
files below.
files above.
"""
out = out.format(shortversion=shortversion, htmltable=htmltable)
print(blue("Here are the release notes to copy into the GitHub release "
@@ -877,7 +829,6 @@ def check_tag_exists():
descriptions = OrderedDict([
('source', "The SymPy source installer.",),
('wheel', "A wheel of the package.",),
('html', '''Html documentation. This is the same as
the <a href="https://docs.sympy.org/latest/index.html">online documentation</a>.''',),
('pdf', '''Pdf version of the <a href="https://docs.sympy.org/latest/index.html"> html documentation</a>.''',),
@@ -1029,16 +980,13 @@ git_whitelist = {
'.gitattributes',
'.gitignore',
'.mailmap',
# Travis and CI
# Travis
'.travis.yml',
'.ci/durations.json',
'.ci/generate_durations_log.sh',
'.ci/parse_durations_log.py',
'.ci/blacklisted.json',
'.editorconfig',
'.coveragerc',
'codecov.yml',
'pytest.ini',
# Code of conduct
'CODE_OF_CONDUCT.md',
# Pull request template
@@ -1110,6 +1058,8 @@ git_whitelist = {
# This is just a distribute version of setup.py. Used mainly for setup.py
# develop, which we don't care about in the release tarball
'setupegg.py',
# Example on how to use tox to test Sympy. For development.
'tox.ini.sample',
# pytest stuff
'conftest.py',
# Encrypted deploy key for deploying dev docs to GitHub
+5 -44
View File
@@ -33,12 +33,8 @@ import sys
import os
import shutil
import glob
import subprocess
from distutils.command.sdist import sdist
min_mpmath_version = '0.19'
mpmath_version = '0.19'
# This directory
dir_setup = os.path.dirname(os.path.realpath(__file__))
@@ -62,11 +58,11 @@ except ImportError:
from distutils.version import LooseVersion
try:
import mpmath
if mpmath.__version__ < LooseVersion(min_mpmath_version):
if mpmath.__version__ < LooseVersion(mpmath_version):
raise ImportError
except ImportError:
print("Please install the mpmath package with a version >= %s"
% min_mpmath_version)
% mpmath_version)
sys.exit(-1)
PY3 = sys.version_info[0] > 2
@@ -126,8 +122,6 @@ modules = [
'sympy.parsing.autolev._antlr',
'sympy.parsing.autolev.test-examples',
'sympy.parsing.autolev.test-examples.pydy-example-repo',
'sympy.parsing.c',
'sympy.parsing.fortran',
'sympy.parsing.latex',
'sympy.parsing.latex._antlr',
'sympy.physics',
@@ -310,37 +304,6 @@ class antlr(Command):
sys.exit(-1)
class sdist_sympy(sdist):
def run(self):
# Fetch git commit hash and write down to commit_hash.txt before
# shipped in tarball.
commit_hash = None
commit_hash_filepath = 'doc/commit_hash.txt'
try:
commit_hash = \
subprocess.check_output(['git', 'rev-parse', 'HEAD'])
commit_hash = commit_hash.decode('ascii')
commit_hash = commit_hash.rstrip()
print('Commit hash found : {}.'.format(commit_hash))
print('Writing it to {}.'.format(commit_hash_filepath))
except:
pass
if commit_hash:
with open(commit_hash_filepath, 'w') as f:
f.write(commit_hash)
super(sdist_sympy, self).run()
try:
os.remove(commit_hash_filepath)
print(
'Successfully removed temporary file {}.'
.format(commit_hash_filepath))
except OSError as e:
print("Error deleting %s - %s." % (e.filename, e.strerror))
# Check that this list is uptodate against the result of the command:
# python bin/generate_test_list.py
tests = [
@@ -446,7 +409,6 @@ if __name__ == '__main__':
'clean': clean,
'audit': audit,
'antlr': antlr,
'sdist': sdist_sympy,
},
classifiers=[
'License :: OSI Approved :: BSD License',
@@ -458,15 +420,14 @@ if __name__ == '__main__':
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
install_requires=[
'mpmath>=%s' % min_mpmath_version,
'mpmath>=%s' % mpmath_version,
],
**extra_kwargs
)
+1 -1
View File
@@ -80,7 +80,7 @@ from .algebras import *
# from combinatorics import *
# This module is slow to import:
#from physics import units
from .plotting import plot, textplot, plot_backends, plot_implicit, plot_parametric
from .plotting import plot, textplot, plot_backends, plot_implicit
from .printing import *
from .interactive import init_session, init_printing
+46 -38
View File
@@ -27,28 +27,6 @@ you still need to use ``Symbol('foo')`` or ``symbols('foo')``.
You can freely mix usage of ``sympy.abc`` and ``Symbol``/``symbols``, though
sticking with one and only one way to get the symbols does tend to make the code
more readable.
The module also defines some special names to help detect which names clash
with the default SymPy namespace.
``_clash1`` defines all the single letter variables that clash with
SymPy objects; ``_clash2`` defines the multi-letter clashing symbols;
and ``_clash`` is the union of both. These can be passed for ``locals``
during sympification if one desires Symbols rather than the non-Symbol
objects for those names.
Examples
========
>>> from sympy import S
>>> from sympy.abc import _clash1, _clash2, _clash
>>> S("Q & C", locals=_clash1)
C & Q
>>> S('pi(x)', locals=_clash2)
pi(x)
>>> S('pi(C, Q)', locals=_clash)
pi(C, Q)
"""
from __future__ import print_function, division
@@ -92,20 +70,50 @@ _greek = list(greeks) # make a copy, so we can mutate it
_greek.remove("lambda")
_greek.append("lamda")
ns = {}
exec_('from sympy import *', ns)
_clash1 = {}
_clash2 = {}
while ns:
_k, _ = ns.popitem()
if _k in _greek:
_clash2[_k] = Symbol(_k)
_greek.remove(_k)
elif _k in _latin:
_clash1[_k] = Symbol(_k)
_latin.remove(_k)
_clash = {}
_clash.update(_clash1)
_clash.update(_clash2)
def clashing():
"""Return the clashing-symbols dictionaries.
del _latin, _greek, Symbol, _k
``clash1`` defines all the single letter variables that clash with
SymPy objects; ``clash2`` defines the multi-letter clashing symbols;
and ``clash`` is the union of both. These can be passed for ``locals``
during sympification if one desires Symbols rather than the non-Symbol
objects for those names.
Examples
========
>>> from sympy import S
>>> from sympy.abc import _clash1, _clash2, _clash
>>> S("Q & C", locals=_clash1)
And(C, Q)
>>> S('pi(x)', locals=_clash2)
pi(x)
>>> S('pi(C, Q)', locals=_clash)
pi(C, Q)
Note: if changes are made to the docstring examples they can only
be tested after removing "clashing" from the list of deleted items
at the bottom of this file which removes this function from the
namespace.
"""
ns = {}
exec_('from sympy import *', ns)
clash1 = {}
clash2 = {}
while ns:
k, _ = ns.popitem()
if k in _greek:
clash2[k] = Symbol(k)
_greek.remove(k)
elif k in _latin:
clash1[k] = Symbol(k)
_latin.remove(k)
clash = {}
clash.update(clash1)
clash.update(clash2)
return clash1, clash2, clash
_clash1, _clash2, _clash = clashing()
del _latin, _greek, clashing, Symbol

Some files were not shown because too many files have changed in this diff Show More