Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Strip trailing whitespaces all over SymPy

except:

- thirdparty packages
- pprint tests, where they are needed
  • Loading branch information...
commit 54183704523f5f8b0276d4bd0f04bf57468d274d 1 parent adc0d84
Kirill Smelkov authored
Showing with 519 additions and 527 deletions.
  1. +2 −2 README
  2. +1 −1  TODO
  3. +1 −1  bin/generate_test_list.py
  4. +4 −4 bin/test_isolated
  5. +1 −1  bin/test_pure
  6. +1 −1  bin/test_pure_plotting
  7. +2 −2 data/TeXmacs/bin/tm_sympy
  8. +1 −1  doc/Makefile
  9. +1 −1  doc/api/index.txt
  10. +1 −1  doc/generate_reference.py
  11. +2 −2 doc/man/isympy.xml
  12. +1 −1  doc/src/aboutus.txt
  13. +33 −33 doc/src/guide.txt
  14. +1 −1  doc/src/index.txt
  15. +1 −1  doc/src/modules.txt
  16. +3 −3 doc/src/outreach.txt
  17. +14 −14 doc/src/sympy-patches-tutorial.txt
  18. +35 −35 doc/src/tutorial.txt
  19. +3 −3 examples/all
  20. +1 −1  examples/fem_test.py
  21. +2 −2 examples/print_pretty.py
  22. +2 −2 examples/print_pygame.py
  23. +8 −8 examples/relativity.py
  24. +3 −3 examples/t.py
  25. +2 −2 examples/tensors.py
  26. +5 −5 sympy/core/add.py
  27. +6 −6 sympy/core/assumptions.py
  28. +6 −6 sympy/core/basic.py
  29. +16 −16 sympy/core/decimal_math.py
  30. +12 −12 sympy/core/function.py
  31. +1 −1  sympy/core/interval.py
  32. +2 −2 sympy/core/methods.py
  33. +3 −3 sympy/core/operations.py
  34. +2 −2 sympy/core/sympify.py
  35. +2 −2 sympy/core/tests/test_arit.py
  36. +2 −2 sympy/core/tests/test_eval_power.py
  37. +4 −4 sympy/core/tests/test_functions.py
  38. +3 −3 sympy/core/tests/test_str.py
  39. +2 −2 sympy/functions/elementary/complexes.py
  40. +4 −4 sympy/functions/elementary/exponential.py
  41. +3 −3 sympy/functions/elementary/tests/test_complexes.py
  42. +4 −4 sympy/functions/elementary/trigonometric.py
  43. +2 −2 sympy/functions/special/polynomials.py
  44. +1 −1  sympy/functions/special/tests/test_polynomials.py
  45. +3 −3 sympy/geometry/ellipse.py
  46. +1 −1  sympy/geometry/tests/test_geometry.py
  47. +5 −5 sympy/integrals/trigonometry.py
  48. +1 −1  sympy/ntheory/primetest.py
  49. +1 −1  sympy/ntheory/residue.py
  50. +0 −8 sympy/ntheory/tests/test_ntheory.py
  51. +1 −1  sympy/numerics/functions2.py
  52. +1 −1  sympy/numerics/quad.py
  53. +12 −12 sympy/parsing/mathematica.py
  54. +1 −1  sympy/parsing/maxima.py
  55. +2 −2 sympy/parsing/tests/test_maxima.py
  56. +1 −1  sympy/physics/tests/test_matrices.py
  57. +37 −37 sympy/plotting/plot.py
  58. +2 −2 sympy/plotting/plot_axes.py
  59. +1 −1  sympy/plotting/plot_camera.py
  60. +15 −15 sympy/plotting/plot_controller.py
  61. +1 −1  sympy/plotting/plot_interval.py
  62. +6 −6 sympy/plotting/plot_mode.py
  63. +2 −2 sympy/plotting/plot_mode_base.py
  64. +2 −2 sympy/plotting/plot_modes.py
  65. +1 −1  sympy/plotting/plot_rotation.py
  66. +4 −4 sympy/plotting/plot_window.py
  67. +4 −4 sympy/polynomials/base.py
  68. +4 −4 sympy/polynomials/div_.py
  69. +10 −10 sympy/polynomials/factor_.py
  70. +3 −3 sympy/polynomials/fast/gfpoly.py
  71. +12 −12 sympy/polynomials/fast/intpoly.py
  72. +2 −2 sympy/polynomials/fast/modint.py
  73. +2 −2 sympy/polynomials/groebner_.py
  74. +7 −7 sympy/polynomials/tests/test_polynomials.py
  75. +7 −7 sympy/polynomials/tests/test_polynomials_fast.py
  76. +1 −1  sympy/printing/latex.py
  77. +3 −3 sympy/printing/pretty/stringpict.py
  78. +2 −2 sympy/printing/pretty/tests/test_pretty.py
  79. +1 −1  sympy/printing/printer.py
  80. +2 −2 sympy/printing/tests/test_python.py
  81. +47 −47 sympy/series/gruntz.py
  82. +1 −1  sympy/series/limits.py
  83. +3 −3 sympy/series/limits_series.py
  84. +8 −8 sympy/series/order.py
  85. +1 −1  sympy/series/tests/test_gruntz.py
  86. +4 −4 sympy/series/tests/test_order.py
  87. +2 −2 sympy/series/tests/test_series.py
  88. +1 −1  sympy/simplify/simplify.py
  89. +12 −12 sympy/simplify/sqrtdenest.py
  90. +2 −2 sympy/solvers/solvers.py
  91. +2 −2 sympy/solvers/tests/test_ode.py
  92. +2 −2 sympy/solvers/tests/test_recurr.py
  93. +1 −1  sympy/specfun/tests/test_factorials.py
  94. +3 −3 sympy/test_external/test_numpy.py
  95. +12 −12 sympy/utilities/mathml/__init__.py
  96. +13 −13 sympy/utilities/mathml/data/mmlctop.xsl
  97. +15 −15 sympy/utilities/mathml/data/mmltex.xsl
  98. +13 −13 sympy/utilities/mathml/data/simple_mmlctop.xsl
  99. +1 −1  sympy/utilities/memoization.py
  100. +2 −2 sympy/utilities/pkgdata.py
  101. +8 −8 sympy/utilities/pytest.py
View
4 README
@@ -6,11 +6,11 @@ A Python library for symbolic mathematics.
http://code.google.com/p/sympy/
All people who contributed to SymPy by sending at least a patch or more (in
-the order of the date of their first contribution):
+the order of the date of their first contribution):
Ondrej Certik <ondrej@certik.cz>
Fabian Seoane <fabian@fseoane.net>
Jurjen N.E. Bos <jnebos@gmail.com>
- Mateusz Paprocki <mattpap@gmail.com>
+ Mateusz Paprocki <mattpap@gmail.com>
Marc-Etienne M.Leveille <protonyc@gmail.com>
Brian Jorgensen <brian.jorgensen@gmail.com>
Jason Gedge <inferno1386@gmail.com>
View
2  TODO
@@ -2,7 +2,7 @@ Current problems are tracked at:
http://code.google.com/p/sympy/issues/list
-for ideas what should be done in the more distant future, see:
+for ideas what should be done in the more distant future, see:
http://code.google.com/p/sympy/wiki/Discussion
but generally ask on the SymPy mailinglist for uptodate future plan. :)
View
2  bin/generate_test_list.py
@@ -1,7 +1,7 @@
"""
Execute like this:
-$ python bin/generate_test_list.py
+$ python bin/generate_test_list.py
tests = [
'sympy.concrete.tests',
'sympy.core.tests',
View
8 bin/test_isolated
@@ -1,11 +1,11 @@
#! /usr/bin/python
"""
Generates a bash script, that executes py.test or nosetest on each file
-individually.
+individually.
Example:
- $ bin/test_isolated
+ $ bin/test_isolated
Generating py.test isolated testsuite...
Done. Run '/tmp/test_sympy.sh'.
@@ -43,7 +43,7 @@ def get_paths(level=6):
def generate_test_script1(testlib="py.test"):
"""Generates a bash script for doing the test.
-
+
"testlib" is the name of the executable, that is going to execute the test,
for example "py.test" or "nosetests".
"""
@@ -60,7 +60,7 @@ def generate_test_script1(testlib="py.test"):
def generate_test_script2(testlib="nosetests"):
"""Generates a bash script for doing the test.
-
+
"testlib" is the name of the executable, that is going to execute the test,
for example "py.test" or "nosetests".
"""
View
2  bin/test_pure
@@ -1,5 +1,5 @@
# This script is for testig SymPy in pure Python environment
-#
+#
# Usage
# -----
# In this directory execute:
View
2  bin/test_pure_plotting
@@ -1,5 +1,5 @@
# This script is for testig SymPy plotting in pure Python environment
-#
+#
# Usage
# -----
# In this directory execute:
View
4 data/TeXmacs/bin/tm_sympy
@@ -4,7 +4,7 @@
#
# This plugin supports LaTeX printing of SymPy expressions
# using sympy.printing.latex function. It handles pretty
-# printing of containers. If you wish to display raw
+# printing of containers. If you wish to display raw
# Python code, then use 'print' before an expression.
#
# TeXmacs encodes new-lines as spaces so we must use
@@ -13,7 +13,7 @@
# in a sequence. However you can and must indent your
# expression using standard Pyhon rules.
#
-# You can retrive the last output using '_' built-in
+# You can retrive the last output using '_' built-in
# symbol. If the previous command did not generate
# any ouput, it will be assigned with None.
#
View
2  doc/Makefile
@@ -35,7 +35,7 @@ clean:
$(SPHINXBUILDpy):
rm -rf sphinx
mkdir sphinx
- cd sphinx; wget http://pypi.python.org/packages/source/S/Sphinx/Sphinx-$(SPHINXVER).tar.gz;
+ cd sphinx; wget http://pypi.python.org/packages/source/S/Sphinx/Sphinx-$(SPHINXVER).tar.gz;
cd sphinx; tar xzf Sphinx-$(SPHINXVER).tar.gz
html: $(SPHINXBUILDpy) spt-printable
View
2  doc/api/index.txt
@@ -3,7 +3,7 @@ Welcome to SymPy API reference
This is an automaticaly generated API documentation from SymPy sources.
-Click the "modules" (:ref:`modindex`) link in the top right corner to
+Click the "modules" (:ref:`modindex`) link in the top right corner to
browse the modules.
Or click the "index" to see an index of all SymPy functions, methods and
View
2  doc/generate_reference.py
@@ -14,7 +14,7 @@ def isclass(x):
def ismethod(x):
from inspect import ismethod as _ismethod
- if _ismethod(x) or isinstance(x, (types.MethodType, types.FunctionType,
+ if _ismethod(x) or isinstance(x, (types.MethodType, types.FunctionType,
types.UnboundMethodType)) or str(type(x)) in [
"<type 'classmethod'>", "<type 'staticmethod'>"]:
return True
View
4 doc/man/isympy.xml
@@ -8,7 +8,7 @@
docbook2x-man isympy.xml
-this will generate isympy.1 in the current directory. -->
+this will generate isympy.1 in the current directory. -->
<!-- Fill in your name for FIRSTNAME and SURNAME. -->
<!ENTITY dhfirstname "Fabian">
@@ -26,7 +26,7 @@ this will generate isympy.1 in the current directory. -->
<!-- http://www.tldp.org/HOWTO/Man-Page/q2.html). But limit -->
<!-- the length to 30 chars. -->
<!ENTITY dhtitle "&dhpackage; command-line reference">
-
+
<!ENTITY dhucpackage "isympy">
<!ENTITY dhpackage "isympy">
View
2  doc/src/aboutus.txt
@@ -4,7 +4,7 @@ About
SymPy Development Team
----------------------
-SymPy is a team project and it was developed by a lot of people.
+SymPy is a team project and it was developed by a lot of people.
Here is a list of contributors together with what they do, plus links to their
wiki pages (if they have one on the page `People
View
66 doc/src/guide.txt
@@ -74,9 +74,9 @@ into the function ``Add.flatten()``::
@classmethod
def flatten(cls, seq):
- """
+ """
Takes the sequence "seq" of nested Adds and returns a flatten list.
-
+
Returns: (commutative_part, noncommutative_part, lambda_args,
order_symbols)
@@ -95,17 +95,17 @@ into the function ``Add.flatten()``::
and then you can study how it works. I am going to stop here, this should be
enough to get you going -- with the above technique, I am able to understand
-almost any Python code.
+almost any Python code.
.. note:: The above debugging was done on the revision `75544c92be1d <http://hg.sympy.org/sympy/rev/75544c92be1d>`_.
SymPy's Architecture
====================
-We try to make the sources easily understandable, so you can look into the sources and read the doctests, it should be well documented and if you don't understand something, ask on the mailinglist.
+We try to make the sources easily understandable, so you can look into the sources and read the doctests, it should be well documented and if you don't understand something, ask on the mailinglist.
You can find all the decisions archived in the Issues, to see rationale for
-doing this and that.
+doing this and that.
Basics
------
@@ -119,7 +119,7 @@ class supports.
For easier use, there is a syntactic sugar for expressions like:
-``cos(x)+1`` is equal to ``cos(x).__add__(1)`` is equal to ``Add(cos(x),Integer(1))``
+``cos(x)+1`` is equal to ``cos(x).__add__(1)`` is equal to ``Add(cos(x),Integer(1))``
or
@@ -149,7 +149,7 @@ the only requirement is that all equivalent expressions must have the same
canonical form. We tried the conversion to a canonical (standard) form to be
as fast as possible and also in a way so that the result is what you would
write by hand - so for example ``b*a + -4 + b + a*b + 4 + (a+b)**2`` becomes
-``2*a*b + b + (a+b)**2``.
+``2*a*b + b + (a+b)**2``.
Whenever you construct an expression, for example ``Add(x, x)``, the
``Add.__new__()`` is called and it determines what to return. In this case::
@@ -163,7 +163,7 @@ Whenever you construct an expression, for example ``Add(x, x)``, the
Out[3]: <class 'sympy.core.mul.Mul'>
``e`` is actually an instance of ``Mul(2, x)``, because ``Add.__new__()``
-retuned ``Mul``.
+retuned ``Mul``.
Comparisons
-----------
@@ -180,7 +180,7 @@ We made the following decision in SymPy: ``a=Symbol("x")`` and another
``b=Symbol("x")`` (with the same string "x") is the same thing, i.e ``a==b`` is
``True``. We chose ``a==b``, because it is more natural - ``exp(x)==exp(x)`` is
also ``True`` for the same intance of ``x`` but different instances of ``exp``,
-so we chose to have ``exp(x)==exp(x)`` even for different instances of ``x``.
+so we chose to have ``exp(x)==exp(x)`` even for different instances of ``x``.
Sometimes, you need to have a unique symbol, for example as a temporary one in
some calculation, which is going to be substituted for something else at the
@@ -202,7 +202,7 @@ don't implement the ``fdiff()`` method and you construct an expression using
such a class, then trying to use the ``Basic.series()`` method will raise an
exception of not founding the ``fdiff()`` method in your class. This "duck
typing" has an advantage that you just implement the functionality which you
-need.
+need.
You can define the function ``cos`` like this::
@@ -289,7 +289,7 @@ both inside and outside of SymPy. Unapplied functions ``sign`` is just the class
sign
-Both inside and outside of SymPy.
+Both inside and outside of SymPy.
This is the current structure of classes in SymPy::
class BasicType(type):
@@ -338,23 +338,23 @@ Here it's how to define a derivative of the function::
return sympify(0)
So guess what this ``my_function`` is going to be? Well, it's derivative is
-``cos`` and the function value at 0 is 0, but let's pretend we don't know::
+``cos`` and the function value at 0 is 0, but let's pretend we don't know::
In [2]: my_function(x).series(x, 0, 10)
- Out[2]:
- 3 5 7 9
- x x x x
+ Out[2]:
+ 3 5 7 9
+ x x x x
x - ── + ─── - ──── + ────── + O(x**10)
- 6 120 5040 362880
+ 6 120 5040 362880
Looks familiar indeed::
In [3]: sin(x).series(x, 0, 10)
- Out[3]:
- 3 5 7 9
- x x x x
+ Out[3]:
+ 3 5 7 9
+ x x x x
x - ── + ─── - ──── + ────── + O(x**10)
- 6 120 5040 362880
+ 6 120 5040 362880
Let's try some more complicated example. Let's define the derivative in terms of the function itself::
@@ -373,20 +373,20 @@ Let's try some more complicated example. Let's define the derivative in terms of
So what is ``what_am_i``? Let's try it::
In [4]: what_am_i(x).series(x, 0, 10)
- Out[4]:
- 3 5 7 9
- x 2*x 17*x 62*x
+ Out[4]:
+ 3 5 7 9
+ x 2*x 17*x 62*x
x - ── + ──── - ───── + ───── + O(x**10)
- 3 15 315 2835
+ 3 15 315 2835
Well, it's ``tanh``::
In [5]: tanh(x).series(x, 0, 10)
- Out[5]:
- 3 5 7 9
- x 2*x 17*x 62*x
+ Out[5]:
+ 3 5 7 9
+ x 2*x 17*x 62*x
x - ── + ──── - ───── + ───── + O(x**10)
- 3 15 315 2835
+ 3 15 315 2835
The new functions we just defined are regular SymPy objects, you
can use them all over SymPy, e.g.::
@@ -405,14 +405,14 @@ Please use the same way as is shown below all across SymPy.
In [1]: e = sign(x**2)
In [2]: e.args
- Out[2]:
+ Out[2]:
⎛ 2⎞
⎝x ⎠
In [3]: e.args[0]
- Out[3]:
+ Out[3]:
2
- x
+ x
In [4]: (x+y*z).args
Out[4]: (y*z, x)
@@ -447,7 +447,7 @@ Applied functions::
In [2]: isinstance(e, Function)
Out[2]: True
-So ``e`` is a ``sign(z)`` function, but not ``exp(z)`` function.
+So ``e`` is a ``sign(z)`` function, but not ``exp(z)`` function.
Unapplied functions::
@@ -476,7 +476,7 @@ Contributing
We welcome every SymPy user to participate in it's development. Don't worry if
you've never contributed to any open source project, we'll help you learn
-anything necessary, just ask on our mailinglist.
+anything necessary, just ask on our mailinglist.
Don't be afraid to ask anything and don't worry that you are wasting our time
if you are new to SymPy and ask questions that maybe most of the people know
View
2  doc/src/index.txt
@@ -5,7 +5,7 @@
Welcome to SymPy's documentation!
=================================
-This is the central page for all SymPy's documentation.
+This is the central page for all SymPy's documentation.
If you are new to SymPy, start with the Tutorial.
View
2  doc/src/modules.txt
@@ -11,7 +11,7 @@ API documentation
-----------------
This documents all SymPy modules and it is automatically generated from SymPy
-sources.
+sources.
Click the "modules" (:ref:`modindex`) link in the top right corner for
automatically generated documentation.
View
6 doc/src/outreach.txt
@@ -1,7 +1,7 @@
SymPy Presentations
-------------------
-Presentations about SymPy given at conferences are at
+Presentations about SymPy given at conferences are at
`SymPyPresentations <http://code.google.com/p/sympy/wiki/SymPyPresentations>`_
Planet SymPy
@@ -17,7 +17,7 @@ SymPy has a collection of official logos, that can be accessed here:
http://sympy.googlecode.com/svn/materials/logo/
The license of all the logos is the same as SymPy: BSD. See the LICENSE file in
-the trunk for more information.
+the trunk for more information.
Google Summer of Code
---------------------
@@ -36,7 +36,7 @@ Here we list blog/news/magazines mentioning SymPy that we know of.
* Penguin.cz: `Zajímavé programy 50`_ (Czech), July 2007
* Penguin.cz: `Zajímavé programy 55`_ (Czech), October 2007
* `Python Magazine`_, Volume 1, Issue 11, November 2007
-* SymPy and Sage is mentioned in: `CAS and Python`_, December 2007
+* SymPy and Sage is mentioned in: `CAS and Python`_, December 2007
.. _Zajímavé programy 50: http://www.penguin.cz/novinky-view.php?id=1142
.. _Zajímavé programy 55: http://www.penguin.cz/novinky-view.php?id=1149
View
28 doc/src/sympy-patches-tutorial.txt
@@ -12,7 +12,7 @@ SymPy Patches Tutorial
.. .. sidebar:: Talk is cheap. Show me the code.
.. epigraph:: Talk is cheap. Show me the code.
-
+
-- Linus Torvalds [1]_
@@ -647,7 +647,7 @@ and clean workdir
$ :input:`hg st`
$ :input:`hg diff`
- $
+ $
Here is a bit of history:
@@ -714,22 +714,22 @@ For this we go to `sympy` mirroring repository, see whats new, and pull updates:
user: Ondrej Certik <ondrej@certik.cz>
date: Sat Mar 22 16:06:47 2008 +0100
summary: The print ordering of Add has been improved.
-
+
changeset: 1901:7cd8948a664a
user: Kirill Smelkov <kirr@landau.phys.spbu.ru>
date: Mon Mar 24 00:17:12 2008 +0300
summary: [1/2] let's use __slots__
-
+
changeset: 1902:529ba5e4a7c6
user: Kirill Smelkov <kirr@landau.phys.spbu.ru>
date: Mon Mar 24 00:17:13 2008 +0300
summary: [2/2] let's use __slots__
-
+
changeset: 1903:115df7b1ee75
user: Kirill Smelkov <kirr@landau.phys.spbu.ru>
date: Mon Mar 24 00:17:14 2008 +0300
summary: add comments to Mul.flatten
-
+
changeset: 1904:75544c92be1d
tag: tip
user: Kirill Smelkov <kirr@landau.phys.spbu.ru>
@@ -802,7 +802,7 @@ Now we have our patches applied on top of the latest tip.
Sometimes changes we've made *overlap* with the changes made by other
developers. This situation is called conflict_ and has to be resolved using
automated merge programs or by hands.
-
+
This topic is out of scope of this tutorial, but an interested reader is
encouraged to read `chapter 3`_ in hgbook_ and TutorialConflict_ HG wiki
page.
@@ -826,13 +826,13 @@ Ensure last time on outgoing changes
user: Kirill Smelkov <kirr@landau.phys.spbu.ru>
date: Wed Mar 26 15:18:09 2008 +0300
summary: pprint: fix handling of old-style classes (#755)
-
+
changeset: 1906:316070047993
tag: xobj-fix-even-height.patch
user: Kirill Smelkov <kirr@landau.phys.spbu.ru>
date: Wed Mar 26 15:18:09 2008 +0300
summary: pretty: fix xobj for even height
-
+
changeset: 1907:63eb63c9f098
tag: qtip
tag: printer-fix-typos.patch
@@ -849,19 +849,19 @@ And let's finally send them:
comparing with /home/kirr/src/sympy/spt-work/sympy
searching for changes
This patch series consists of 3 patches.
-
+
Subject: [PATCH 0 of 3] :input:`Fix for #755 + two more`
-
+
Write the introductory message for the patch series.
:input:`While working on #755 (pprint fails on old style classes) I've spot a couple`
:input:`of other inconveniences.`
:input:`Please review.`
-
+
To: :input:`sympy-patches@googlegroups.com` TODO put this into .hgrc
- Cc:
-
+ Cc:
+
Sending [PATCH 0 of 3] Fix for #755 + two more ...
Sending [PATCH 1 of 3] pprint: fix handling of old-style classes (#755) ...
Sending [PATCH 2 of 3] pretty: fix xobj for even height ...
View
70 doc/src/tutorial.txt
@@ -34,14 +34,14 @@ Unpack it:
.. parsed-literal::
$ :input:`tar xzf sympy-0.5.12.tar.gz`
-
+
and try it from a Python intepreter:
.. parsed-literal::
$ :input:`cd sympy-0.5.12`
$ :input:`python`
- Python 2.4.4 (#2, Jan 3 2008, 13:36:28)
+ Python 2.4.4 (#2, Jan 3 2008, 13:36:28)
[GCC 4.2.3 20071123 (prerelease) (Debian 4.2.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> :input:`from sympy import Symbol, cos`
@@ -60,7 +60,7 @@ distribution, e.g.:
$ :input:`sudo apt-get install python-sympy`
Reading package lists... Done
- Building dependency tree
+ Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
python-sympy
@@ -68,7 +68,7 @@ distribution, e.g.:
Need to get 991kB of archives.
After this operation, 5976kB of additional disk space will be used.
Get:1 http://ftp.cz.debian.org unstable/main python-sympy 0.5.12-1 [991kB]
- Fetched 991kB in 2s (361kB/s)
+ Fetched 991kB in 2s (361kB/s)
Selecting previously deselected package python-sympy.
(Reading database ... 232619 files and directories currently installed.)
Unpacking python-sympy (from .../python-sympy_0.5.12-1_all.deb) ...
@@ -88,7 +88,7 @@ For experimenting with new features, or when figuring out how to do things, you
can use our special wrapper around IPython called ``isympy`` (located in
``bin/isympy`` if you are running from the source directory) which is just a
standard python shell that has already imported the relevant sympy modules and
-defined the symbols x, y, z and some other things:
+defined the symbols x, y, z and some other things:
.. parsed-literal::
@@ -100,16 +100,16 @@ defined the symbols x, y, z and some other things:
>>> x, y, z = symbols('xyz')
>>> k, m, n = symbols('kmn', integer=True)
>>> f = Function("f")
-
+
Documentation can be found at http://sympy.org/
-
-
+
+
In [1]: :input:`(1/cos(x)).series(x, 0, 10)`
- Out[1]:
- 2 4 6 8
- x 5*x 61*x 277*x
+ Out[1]:
+ 2 4 6 8
+ x 5*x 61*x 277*x
1 + ── + ──── + ───── + ────── + O(x**10)
- 2 24 720 8064
+ 2 24 720 8064
.. note::
@@ -122,7 +122,7 @@ Using SymPy as a calculator
Sympy has three built-in numeric types: Real, Rational and Integer.
-The Rational class represents a rational number as a pair of two Integers: the numerator and the denominator, so Rational(1,2) represents 1/2, Rational(5,2) 5/2 and so on.
+The Rational class represents a rational number as a pair of two Integers: the numerator and the denominator, so Rational(1,2) represents 1/2, Rational(5,2) 5/2 and so on.
::
@@ -140,7 +140,7 @@ The Rational class represents a rational number as a pair of two Integers: the n
proceed with caution while working with python int's since they truncate
-integer division, and that's why::
+integer division, and that's why::
>>> 1/2
0
@@ -152,7 +152,7 @@ You can however do::
>>> from __future__ import division
- >>> 1/2 #doctest: +SKIP
+ >>> 1/2 #doctest: +SKIP
0.5
True division is going to be standard in python3k and ``isympy`` does that too.
@@ -183,7 +183,7 @@ Symbols
-------
In contrast to other Computer Algebra Systems, in SymPy you have to declare
-symbolic variables explicitly::
+symbolic variables explicitly::
>>> from sympy import *
>>> x = Symbol('x')
@@ -276,7 +276,7 @@ Higher derivatives can be calculated using the ``diff(func, var, n)`` method::
-8*cos(2*x)
-.. index::
+.. index::
single: series expansion
single: expansion; series
@@ -308,11 +308,11 @@ Another simple example::
That should print the following after the execution::
1/y + x**2*y**(-3) + x**4*y**(-5) - x*y**(-2) - x**3*y**(-4) + O(x**5)
- 2 4 3
- 1 x x x x
+ 2 4 3
+ 1 x x x x
─ + ── + ── - ── - ── + O(x**5)
- y 3 5 2 4
- y y y y
+ y 3 5 2 4
+ y y y y
.. index:: integration
@@ -359,7 +359,7 @@ Also improper integrals are supported as well::
>>> integrate(log(x), (x, 0, 1))
-1
-.. index::
+.. index::
single: complex numbers
single: expansion; complex
@@ -386,11 +386,11 @@ Differential Equations
In ``isympy``::
In [4]: f(x).diff(x, x) + f(x)
- Out[4]:
- 2
- d
+ Out[4]:
+ 2
+ d
─────(f(x)) + f(x)
- dx dx
+ dx dx
In [5]: dsolve(f(x).diff(x, x) + f(x), f(x))
Out[5]: C₁*sin(x) + C₂*cos(x)
@@ -423,7 +423,7 @@ Matrices
Matrices are created as instances from the Matrix class::
>>> from sympy import Matrix
- >>> Matrix([[1,0], [0,1]])
+ >>> Matrix([[1,0], [0,1]])
[1 0]
[0 1]
@@ -435,11 +435,11 @@ you can also put Symbols in it::
>>> A #doctest: +NORMALIZE_WHITESPACE
[1 x]
[y 1]
-
+
>>> A**2 #doctest: +NORMALIZE_WHITESPACE
- [1+x*y 2*x]
+ [1+x*y 2*x]
[2*y 1+x*y]
-
+
>>> 1
1
@@ -521,16 +521,16 @@ This is a nice ascii-art printing produced by a ``pprint`` function:
>>> from sympy.abc import x
>>> pprint(x**2)
2
- x
+ x
>>> pprint(1/x)
1
x
>>> pprint(Integral(x**2, x))
- ⌠
- ⎮ 2
+ ⌠
+ ⎮ 2
⎮ x dx
- ⌡
+ ⌡
>>>
**Python printing**
@@ -547,7 +547,7 @@ This is a nice ascii-art printing produced by a ``pprint`` function:
>>> print_python(Integral(x**2, x))
x = Symbol('x')
e = Integral(x**2, x)
- >>>
+ >>>
**LaTeX printing**
View
6 examples/all
@@ -13,7 +13,7 @@
# File "./limits_examples.py", line 17, in ?
# [...]
# $
-#
+#
# Obviously, we want to achieve the first result.
# The commented out examples below don't run:
@@ -21,7 +21,7 @@
#./mplot3d.py
./relativity.py
./differential_equations.py
-#./pidigits.py
+#./pidigits.py
./differentiation.py
#./plotting_nice_plot.py
./series.py
@@ -40,4 +40,4 @@
./vandermonde.py
./limits_examples.py
#./qft.py
-#./mplot2d.py
+#./mplot2d.py
View
2  examples/fem_test.py
@@ -4,7 +4,7 @@
"""
Go to the sympy root directory and execute:
-$ python examples/fem_test.py
+$ python examples/fem_test.py
[ 1/60, 0, -1/360, 0, -1/90, -1/360]
[ 0, 4/45, 0, 2/45, 2/45, -1/90]
[-1/360, 0, 1/60, -1/90, 0, -1/360]
View
4 examples/print_pretty.py
@@ -3,8 +3,8 @@
from sympy import *
-x=Symbol("x")
-y=Symbol("y")
+x=Symbol("x")
+y=Symbol("y")
pprint( x**x )
View
4 examples/print_pygame.py
@@ -5,8 +5,8 @@
from sympy.core import basic
from sympy.printing import print_pygame, pprint
-x=Symbol("x")
-y=Symbol("y")
+x=Symbol("x")
+y=Symbol("y")
expressions = (
x**x,
View
16 examples/relativity.py
@@ -100,29 +100,29 @@ def curvature(Rmn):
phi=Symbol(r"\phi")
#general, spherically symmetric metric
-gdd=Matrix((
- (-exp(nu(r)),0,0,0),
+gdd=Matrix((
+ (-exp(nu(r)),0,0,0),
(0, exp(lam(r)), 0, 0),
(0, 0, r**2, 0),
(0, 0, 0, r**2*sin(theta)**2)
))
#spherical - flat
-#gdd=Matrix((
-# (-1, 0, 0, 0),
+#gdd=Matrix((
+# (-1, 0, 0, 0),
# (0, 1, 0, 0),
# (0, 0, r**2, 0),
# (0, 0, 0, r**2*sin(theta)**2)
# ))
#polar - flat
-#gdd=Matrix((
-# (-1, 0, 0, 0),
+#gdd=Matrix((
+# (-1, 0, 0, 0),
# (0, 1, 0, 0),
# (0, 0, 1, 0),
# (0, 0, 0, r**2)
# ))
#polar - on the sphere, on the north pole
-#gdd=Matrix((
-# (-1, 0, 0, 0),
+#gdd=Matrix((
+# (-1, 0, 0, 0),
# (0, 1, 0, 0),
# (0, 0, r**2*sin(theta)**2, 0),
# (0, 0, 0, r**2)
View
6 examples/t.py
@@ -9,9 +9,9 @@
from sympy.core import basic
limits.debug=True
-x=Symbol("x")
-y=Symbol("y")
-w=Symbol("w")
+x=Symbol("x")
+y=Symbol("y")
+w=Symbol("w")
#import pdb
#pdb.run('print limit(sin(x)/x,x,oo)')
View
4 examples/tensors.py
@@ -60,8 +60,8 @@ class nu(Function):
class lam(Function):
pass
-gdd=Matrix((
- (-exp(nu(r)),0,0,0),
+gdd=Matrix((
+ (-exp(nu(r)),0,0,0),
(0, exp(lam(r)), 0, 0),
(0, 0, r**2, 0),
(0, 0, 0, r**2*sin(theta)**2)
View
10 sympy/core/add.py
@@ -19,9 +19,9 @@ class Add(AssocOp, RelMeths, ArithMeths):
@classmethod
def flatten(cls, seq):
- """
+ """
Takes the sequence "seq" of nested Adds and returns a flatten list.
-
+
Returns: (commutative_part, noncommutative_part, lambda_args,
order_symbols)
@@ -147,7 +147,7 @@ def flatten(cls, seq):
@staticmethod
def compare_terms(a, b):
"""
- Is a>b in the sense of ordering in printing?
+ Is a>b in the sense of ordering in printing?
yes ..... return 1
no ...... return -1
@@ -160,7 +160,7 @@ def compare_terms(a, b):
expression and returns the "sane" ordering such as:
1 < x < x**2 < x**3 < O(x**4) etc.
-
+
"""
from sympy.series.order import Order
if isinstance(a, Order) and not isinstance(b, Order):
@@ -425,7 +425,7 @@ def _sage_(self):
s = 0
for x in self.args:
s += x._sage_()
- return s
+ return s
# /cyclic/
View
12 sympy/core/assumptions.py
@@ -1,7 +1,7 @@
class AssumeMeths(object):
""" Define default assumption methods.
-
+
AssumeMeths should be used to derive Basic class only.
All symbolic objects have assumption attributes that
@@ -49,18 +49,18 @@ class AssumeMeths(object):
property decorators) or are attributes of objects/classes.
Examples:
-
+
- True, when we are sure about a property. For example, when we are
working only with real numbers:
>>> from sympy import *
>>> Symbol('x', real = True)
x
-
+
- False
-
+
- None (if you don't know if the property is True or false)
-
+
"""
@@ -252,7 +252,7 @@ def assume(self, **assumptions):
processed = {}
replace = []
- aliases = self._assume_aliases
+ aliases = self._assume_aliases
negs = self._assume_negs
inegs = self._assume_inegs
rels = self._assume_rels
View
12 sympy/core/basic.py
@@ -626,9 +626,9 @@ def _subs_old_new(self, old, new):
def subs(self, *args):
"""
- Substitutes an expression.
-
- Calls either _subs_old_new, _subs_dict or _subs_list depending
+ Substitutes an expression.
+
+ Calls either _subs_old_new, _subs_dict or _subs_list depending
if you give it two arguments (old, new), a dictionary or a list.
Examples:
@@ -659,11 +659,11 @@ def subs(self, *args):
def _subs_list(self, sequence):
"""
- Performs an order sensitive substitution from the
+ Performs an order sensitive substitution from the
input sequence list.
Examples:
-
+
>>> from sympy import *
>>> x, y = symbols('xy')
>>> (x+y)._subs_list( [(x, 3), (y, x**2)] )
@@ -1643,7 +1643,7 @@ def leadterm(self, x):
class Atom(Basic):
"""
A parent class for atomic things.
-
+
Examples: Symbol, Number, Rational, Integer, ...
But not: Add, Mul, Pow, ...
"""
View
32 sympy/core/decimal_math.py
@@ -43,11 +43,11 @@ def exp(x):
getcontext().prec += 2
i, lasts, s, fact, num = 0, 0, 1, 1, 1
while s != lasts:
- lasts = s
+ lasts = s
i += 1
fact *= i
- num *= x
- s += num / fact
+ num *= x
+ s += num / fact
getcontext().prec -= 2
return +s
@@ -57,13 +57,13 @@ def cos(x):
getcontext().prec += 2
i, lasts, s, fact, num, sign = 0, 0, 1, 1, 1, 1
while s != lasts:
- lasts = s
+ lasts = s
i += 2
fact *= i * (i - 1)
num *= x * x
sign *= -1
- s += num / fact * sign
- getcontext().prec -= 2
+ s += num / fact * sign
+ getcontext().prec -= 2
return +s
def sin(x):
@@ -72,7 +72,7 @@ def sin(x):
getcontext().prec += 2
i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1
while s != lasts:
- lasts = s
+ lasts = s
i += 2
fact *= i * (i - 1)
num *= x * x
@@ -85,7 +85,7 @@ def cosh(x):
"""Return the hyperbolic cosine of Decimal x."""
if x == 0:
return D(1)
-
+
getcontext().prec += 2
i, lasts, s, fact, num = 0, 0, 1, 1, 1
while s != lasts:
@@ -101,7 +101,7 @@ def sinh(x):
"""Return the hyperbolic sine of Decimal x."""
if x == 0:
return D(0)
-
+
getcontext().prec += 2
i, lasts, s, fact, num = 1, 0, x, 1, x
while s != lasts:
@@ -117,14 +117,14 @@ def asin(x):
"""Return the arc sine (measured in radians) of Decimal x."""
if abs(x) > 1:
raise ValueError("Domain error: asin accepts -1 <= x <= 1")
-
+
if x == -1:
return pi() / -2
elif x == 0:
return D(0)
elif x == 1:
return pi() / 2
-
+
return atan2(x, D.sqrt(1 - x ** 2))
def acos(x):
@@ -138,7 +138,7 @@ def acos(x):
return pi() / 2
elif x == 1:
return D(0)
-
+
return pi() / 2 - atan2(x, D.sqrt(1 - x ** 2))
def tan(x):
@@ -165,7 +165,7 @@ def atan(x):
return D(0)
elif x == D('Inf'):
return pi() / 2
-
+
if x < -1:
c = pi() / -2
x = 1 / x
@@ -174,14 +174,14 @@ def atan(x):
x = 1 / x
else:
c = 0
-
+
getcontext().prec += 2
x_squared = x ** 2
y = x_squared / (1 + x_squared)
y_over_x = y / x
i, lasts, s, coeff, num = D(0), 0, y_over_x, 1, y_over_x
while s != lasts:
- lasts = s
+ lasts = s
i += 2
coeff *= i / (i + 1)
num *= y
@@ -202,7 +202,7 @@ def atan2(y, x):
abs_y = abs(y)
abs_x = abs(x)
y_is_real = abs_y != D('Inf')
-
+
if x:
if y_is_real:
a = y and atan(y / x) or D(0)
View
24 sympy/core/function.py
@@ -407,7 +407,7 @@ class Derivative(Basic, ArithMeths, RelMeths):
"""
precedence = Basic.Apply_precedence
-
+
@staticmethod
def _symbolgen(*symbols):
last_s = sympify(symbols[len(symbols)-1])
@@ -417,7 +417,7 @@ def _symbolgen(*symbols):
if s != last_s:
next_s = sympify(symbols[i+1])
# next_s = sympify(symbols[i+1]) if s != last_s else None
-
+
if isinstance(s,Integer):
continue
elif isinstance(s, Symbol):
@@ -428,7 +428,7 @@ def _symbolgen(*symbols):
yield s
else:
raise TypeError("Derivative argument must be Symbol|Integer instance (got %s)" % (s.__class__.__name__))
-
+
def __new__(cls, expr, *symbols, **assumptions):
expr = sympify(expr)
if not symbols: return expr
@@ -541,7 +541,7 @@ class Lambda(Function):
>>> plus1 = sum2numbers(1)
>>> plus1(3)
4
-
+
"""
# a minimum of 2 arguments (parameter, expression) are needed
@@ -552,13 +552,13 @@ def __new__(cls,*args):
obj = Function.__new__(cls,*args)
obj.nargs = len(args)
return obj
-
+
@classmethod
def canonize(cls,*args):
obj = Basic.__new__(cls, *args)
#use dummy variables internally, just to be sure
nargs = len(args)
-
+
expression = args[nargs-1]
funargs = [Symbol(str(arg),dummy=True) for arg in args[:nargs-1]]
#probably could use something like foldl here
@@ -566,7 +566,7 @@ def canonize(cls,*args):
expression = expression.subs(arg,funarg)
funargs.append(expression)
obj._args = tuple(funargs)
-
+
return obj
def apply(self, *args):
@@ -588,7 +588,7 @@ def apply(self, *args):
4
"""
-
+
nparams = self.nargs - 1
assert nparams >= len(args),"Cannot call function with more parameters than function variables: %s (%d variables) called with %d arguments" % (str(self),nparams,len(args))
@@ -597,7 +597,7 @@ def apply(self, *args):
expression = self.args[self.nargs-1]
for arg,funarg in zip(args,self.args[:nparams]):
expression = expression.subs(funarg,arg)
-
+
#curry the rest
if nparams != len(args):
unused_args = list(self.args[len(args):nparams])
@@ -612,7 +612,7 @@ def __eq__(self, other):
if isinstance(other, Lambda):
if not len(self.args) == len(other.args):
return False
-
+
selfexpr = self.args[self.nargs-1]
otherexpr = other.args[other.nargs-1]
for selfarg,otherarg in zip(self.args[:self.nargs-1],other.args[:other.nargs-1]):
@@ -623,7 +623,7 @@ def __eq__(self, other):
# return True
return False
-
+
def diff(f, x, times = 1, evaluate=True):
"""Differentiate f with respect to x
@@ -633,7 +633,7 @@ def diff(f, x, times = 1, evaluate=True):
see http://documents.wolfram.com/v5/Built-inFunctions/AlgebraicComputation/Calculus/D.html
"""
-
+
return Derivative(f,x,times, **{'evaluate':evaluate})
def expand(e, **hints):
View
2  sympy/core/interval.py
@@ -23,7 +23,7 @@ def tostr(self, level=0):
r = '(%s)' % (r)
return r
-
+
# /cyclic/
import sympify as _
_.Interval = Interval
View
4 sympy/core/methods.py
@@ -67,7 +67,7 @@ def __rdiv__(self, other):
class NoArithMeths(object):
__slots__ = []
-
+
def __pos__(self):
raise TypeError, _no_unary_operation('+', self)
def __neg__(self):
@@ -98,7 +98,7 @@ def _eval_power(self, other):
class RelMeths(object):
__slots__ = []
-
+
# TODO all comparison methods should return True/False directly
# see #153
View
6 sympy/core/operations.py
@@ -11,9 +11,9 @@
class AssocOp(Basic):
""" Associative operations, can separate noncommutative and
commutative parts.
-
+
(a op b) op c == a op (b op c) == a op b op c.
-
+
Base class for Add and Mul.
"""
@@ -117,4 +117,4 @@ def _eval_template_is_attr(self, is_attr):
return r
_eval_evalf = Basic._seq_eval_evalf
-
+
View
4 sympy/core/sympify.py
@@ -113,8 +113,8 @@ def sympify(a, sympify_lists=False, locals= {}):
# At this point we were given an arbitrary expression
# which does not inherit from Basic and doesn't implement
# _sympy_ (which is a canonical and robust way to convert
- # anything to SymPy expression).
- #
+ # anything to SymPy expression).
+ #
# As a last chance, we try to take "a"'s normal form via str()
# and try to parse it. If it fails, then we have no luck and
# return an exception
View
4 sympy/core/tests/test_arit.py
@@ -149,7 +149,7 @@ def testpow():
@XFAIL
def test_pow2():
- # XXX These fail - they are maybe discutable,
+ # XXX These fail - they are maybe discutable,
# let's see SAGE and similar.
assert ((-x)**2)**Rational(1,3) == ((-x)**Rational(1,3))**2
assert (-x)**Rational(2,3) == x**Rational(2,3)
@@ -922,7 +922,7 @@ class MightyNumeric(tuple):
def __rdiv__(self, other):
return "something"
assert sympify(1)/MightyNumeric((1,2)) == "something"
-
+
def test_issue432b():
class Foo:
def __init__(self):
View
4 sympy/core/tests/test_eval_power.py
@@ -39,10 +39,10 @@ def test_issue350():
a = Symbol('a', real = True)
assert (a**Rational(3))**Rational(2,5) == a**Rational(6,5)
-
+
#assert Number(5)**Rational(2,3)==Number(25)**Rational(1,3)
def test_issue767():
assert --sqrt(sqrt(5)-1)==sqrt(sqrt(5)-1)
-
+
test_issue350()
View
8 sympy/core/tests/test_functions.py
@@ -184,16 +184,16 @@ def test_Lambda():
assert e(4) == 16
assert e(x) == x**2
assert e(y) == y**2
-
+
assert Lambda(x, x**2) == Lambda(x, x**2)
assert Lambda(x, x**2) == Lambda(y, y**2)
assert Lambda(x, x**2) != Lambda(y, y**2+1)
assert Lambda(x,y,x**y) == Lambda(y,x,y**x)
assert Lambda(x,y,x**y) != Lambda(x,y,y**x)
-
- assert Lambda(x,y,x**y)(x,y) == x**y
+
+ assert Lambda(x,y,x**y)(x,y) == x**y
assert Lambda(x,y,x**y)(x) == Lambda(y,x**y)
- assert Lambda(x,y,x**y)(x)(y) == x**y
+ assert Lambda(x,y,x**y)(x)(y) == x**y
assert Lambda(x,y,x**y)(x)(3) == x**3
assert Lambda(x,y,x**y)(3)(y) == 3**y
assert Lambda(x,y,x**y)(3)(3) == 3**3
View
6 sympy/core/tests/test_str.py
@@ -11,10 +11,10 @@ def test_pow():
def test_poly_str():
#if any of these tests fails, it can still be correct, just the terms can
- #be in a different order. That happens for example when we change the
+ #be in a different order. That happens for example when we change the
#hash algorithm. If it is correct, just add another item in the list [] of
#correct results.
- assert str((2*x-(7*x**2 - 2) + 3*y)) in ["2 - 7*x**2 + 2*x + 3*y",
+ assert str((2*x-(7*x**2 - 2) + 3*y)) in ["2 - 7*x**2 + 2*x + 3*y",
"2 + 3*y + 2*x - 7*x**2", "2 + 3*y - 7*x**2 + 2*x",
"3*y + 2*x + 2 - 7*x**2", "2 + 2*x + 3*y - 7*x**2"]
assert str(x-y) in ["x - y", "-y + x"]
@@ -52,7 +52,7 @@ def test_bug4():
e = -2*sqrt(x)-w/sqrt(x)/2
assert str(e) not in ["(-2)*x**1/2(-1/2)*x**(-1/2)*w",
"-2*x**1/2(-1/2)*x**(-1/2)*w","-2*x**1/2-1/2*x**-1/2*w"]
- assert str(e) in ["-2*x**(1/2) - 1/2*x**(-1/2)*w", "-2*x**(1/2) - 1/2*w*x**(-1/2)",
+ assert str(e) in ["-2*x**(1/2) - 1/2*x**(-1/2)*w", "-2*x**(1/2) - 1/2*w*x**(-1/2)",
"-1/2*x**(-1/2)*w - 2*x**(1/2)", "-1/2*w*x**(-1/2) - 2*x**(1/2)"]
def test_Derivative():
View
4 sympy/functions/elementary/complexes.py
@@ -236,14 +236,14 @@ class arg(Function):
is_real = True
is_bounded = True
-
+
@classmethod
def canonize(cls, arg):
x, y = re(arg), im(arg)
arg = C.atan2(y, x)
if arg.is_number:
return arg
-
+
def _eval_conjugate(self):
return self
View
8 sympy/functions/elementary/exponential.py
@@ -189,7 +189,7 @@ def _eval_oseries(self, order):
#if self[0] == (1 + w)*log(1/w*C.sin(2*w)):
# return exp((1 + w)*(-log(w) + log(C.sin(2*w))))
#print "XX2...."
- #Example:
+ #Example:
# self = exp(log(1 + x)/x)
# order = O(x**2)
@@ -372,12 +372,12 @@ def _eval_oseries(self, order):
arg0 = arg.limit(x, 0)
use_lt = (arg0 is S.Zero)
if use_lt: # singularity, #example: self = log(sin(x))
- # arg = (arg / lt) * lt
+ # arg = (arg / lt) * lt
lt = arg.as_leading_term(x) # arg = sin(x); lt = x
- a = (arg/lt).expand() # a = sin(x)/x
+ a = (arg/lt).expand() # a = sin(x)/x
#the idea is to recursively call ln(a).series(), but the problem
#is, that ln(sin(x)/x) gets "simplified" to -log(x)+ln(sin(x)) and
- #an infinite recursion occurs, see also the issue 252.
+ #an infinite recursion occurs, see also the issue 252.
return ln(lt) + ln(a).oseries(order)
# arg -> arg0 + (arg - arg0) -> arg0 * (1 + (arg/arg0 - 1))
z = (arg/arg0 - 1)
View
6 sympy/functions/elementary/tests/test_complexes.py
@@ -38,7 +38,7 @@ def test_re():
assert re(x + r*I) == re(x)
assert re(log(2*I)) == log(2)
-
+
assert re((2+I)**2).expand(complex=True) == 3
def test_im():
@@ -78,7 +78,7 @@ def test_im():
assert im(x + r*I) == im(x) + r
assert im(log(2*I)) == pi/2
-
+
assert im((2+I)**2).expand(complex=True) == 4
def test_abs():
@@ -115,7 +115,7 @@ def test_arg():
assert arg(1+I) == pi/4
assert arg(-1+I) == 3*pi/4
assert arg(1-I) == -pi/4
-
+
p = Symbol('p', positive=True)
assert arg(p) == 0
View
8 sympy/functions/elementary/trigonometric.py
@@ -835,12 +835,12 @@ def _eval_is_real(self):
class atan2(Function):
"""
Returns the atan(y/x) taking two arguments y and x. Signs of
- both y and x are considered to determine the appropriate
+ both y and x are considered to determine the appropriate
quadrant of atan(y/x). The range is (-pi, pi].
"""
-
+
nargs = 2
-
+
@classmethod
def canonize(cls, y, x):
sign_y = C.sign(y)
@@ -857,7 +857,7 @@ def canonize(cls, y, x):
return sign_y * S.Pi/2
else:
abs_yx = C.abs(y/x)
- if sign_y.is_Number and abs_yx.is_number:
+ if sign_y.is_Number and abs_yx.is_number:
phi = C.atan(abs_yx)
if x.is_positive:
return sign_y * phi
View
4 sympy/functions/special/polynomials.py
@@ -195,7 +195,7 @@ class assoc_legendre(PolynomialSequence2):
assoc_legendre(n,m, x) gives P_nm(x) = mth association to Legendre polynomial P_n(x)
Associated Legende polynomial are orthogonal on [-1, 1] with:
-
+
- weight = 1 for the same m, and different n.
- weight = 1/(1-x**2) for the same n, and different m.
@@ -275,7 +275,7 @@ class hermite(PolynomialSequence):
References
==========
- * http://mathworld.wolfram.com/HermitePolynomial.html
+ * http://mathworld.wolfram.com/HermitePolynomial.html
"""
@staticmethod
@recurrence_memo([S.One, 2*_x])
View
2  sympy/functions/special/tests/test_polynomials.py
@@ -24,7 +24,7 @@ def test_legendre():
[sympify("(3/7 - 2/35*30**(1/2))**(1/2)"), \
sympify("-(3/7 - 2/35*30**(1/2))**(1/2)"), \
sympify("(3/7 + (2/35)*30**(1/2))**(1/2)"), \
- sympify("-(3/7 + (2/35)*30**(1/2))**(1/2)")]
+ sympify("-(3/7 + (2/35)*30**(1/2))**(1/2)")]
View
6 sympy/geometry/ellipse.py
@@ -42,7 +42,7 @@ class Ellipse(GeometryEntity):
Out[7]:
[0]: cos(t), sin(t), 'mode=parametric'
[1]: t*cos(1.546086215036205357975518382),
- t*sin(1.546086215036205357975518382), 'mode=parametric'
+ t*sin(1.546086215036205357975518382), 'mode=parametric'
"""
def __new__(cls, center, hradius, vradius, **kwargs):
@@ -176,7 +176,7 @@ def random_point(self):
def equation(self, x='x', y='y'):
"""
Returns the equation of the ellipse.
-
+
Optional parameters x and y can be used to specify symbols, or the
names of the symbols used in the equation.
"""
@@ -330,7 +330,7 @@ def circumference(self):
def equation(self, x='x', y='y'):
"""
Returns the equation of the circle.
-
+
Optional parameters x and y can be used to specify symbols, or the
names of the symbols used in the equation.
"""
View
2  sympy/geometry/tests/test_geometry.py
@@ -354,7 +354,7 @@ def test_polygon():
assert altitudes[p2] == s1[0]
assert altitudes[p3] == s1[2]
- # Ensure
+ # Ensure
assert len(intersection(*bisectors.values())) == 1
assert len(intersection(*altitudes.values())) == 1
assert len(intersection(*m.values())) == 1
View
10 sympy/integrals/trigonometry.py
@@ -53,7 +53,7 @@ def trigintegrate(f, x):
a = M[a]
if n.is_integer and n.is_integer:
-
+
if n.is_odd or m.is_odd:
u = _u
n_, m_ = n.is_odd, m.is_odd
@@ -139,13 +139,13 @@ def calc(k, prev):
⌠ n-1 ⌠
⎮ n S (x)*C(x) n-1 ⎮ n-2
⎮S (x) = - ──────────── + ─── * ⎮ S (x)
- ⌡ n n ⌡
+ ⌡ n n ⌡
see: http://en.wikipedia.org/wiki/List_of_integrals_of_trigonometric_functions
n-1
XXX maybe combine S (x)*C(x) -> S(n*x) + ...?
- """
+ """
n = 2*k
return -(sin(_x))**(n-1) * cos(_x) / n + prev[k-1] * (n-1)/n
@@ -157,13 +157,13 @@ class Cos_2k_integrate(PolynomialSequence):
@recurrence_memo([_x])
def calc(k, prev):
"""recursively calculate \int(cos(x)**2k, x)
-
+
formula used:
⌠ n-1 ⌠
⎮ n C (x)*S(x) n-1 ⎮ n-2
⎮C (x) = ──────────── + ─── * ⎮ C (x)
- ⌡ n n ⌡
+ ⌡ n n ⌡
see: http://en.wikipedia.org/wiki/List_of_integrals_of_trigonometric_functions
View
2  sympy/ntheory/primetest.py
@@ -46,7 +46,7 @@ def _test(n, base):
def mr(n, bases):
"""Perform a Miller-Rabin strong pseudoprime test on n using a
given list of bases/witnesses.
-
+
Reference:
Richard Crandall & Carl Pomerance (2005), "Prime Numbers:
A Computational Perspective", Springer, 2nd edition, 135-138
View
2  sympy/ntheory/residue.py
@@ -68,5 +68,5 @@ def legendre_symbol(a,p):
-
+
View
8 sympy/ntheory/tests/test_ntheory.py
@@ -144,11 +144,3 @@ def test_hex_pi_nth_digits():
assert pi_hex_digits(10000) == '68ac8fcfb8016c'
-
-
-
-
-
-
-
-
View
2  sympy/numerics/functions2.py
@@ -147,7 +147,7 @@ def gamma(x):
"""
gamma(x) -- calculate the gamma function of a real or complex
number x.
-
+
x must not be a negative integer or 0
"""
Float.store()
View
2  sympy/numerics/quad.py
@@ -347,7 +347,7 @@ def nintegrate(f, a, b, method=0, maxsteps=5000, verbose=False):
3.14159265358979323846264338328
The integration interval can be infinite or semi-infinite:
-
+
>>> Float.setdps(15)
>>> print nintegrate(lambda x: exp(-x)*sin(x), 0, oo)
0.5
View
24 sympy/parsing/mathematica.py
@@ -3,41 +3,41 @@
def mathematica (s):
return sympify(parse(s))
-
+
def parse (s):
s = s.strip()
-
+
#Begin rules
rules = (
(r"\A(\w+)\[([^\]]+[^\[]*)\]\Z", #Function call
lambda m: translateFunction(m.group(1)) + "(" + parse(m.group(2)) + ")" ),
-
+
(r"\((.+)\)\((.+)\)", #Parenthesized implied multiplication
lambda m: "(" + parse(m.group(1)) + ")*(" + parse(m.group(2)) + ")" ),
-
+
(r"\A\((.+)\)\Z", #Parenthesized expression
lambda m: "(" + parse(m.group(1)) + ")" ),
-
+
(r"\A(.*[\w\.])\((.+)\)\Z", #Implied multiplication - a(b)
lambda m: parse(m.group(1)) + "*(" + parse(m.group(2)) + ")" ),
-
+
(r"\A\((.+)\)([\w\.].*)\Z", #Implied multiplication - (a)b
lambda m: "(" + parse(m.group(1)) + ")*" + parse(m.group(2)) ),
-
+
(r"\A([\d\.]+)([a-zA-Z].*)\Z", #Implied multiplicatin - 2a
lambda m: parse(m.group(1)) + "*" + parse(m.group(2)) ),
-
+
(r"\A([^=]+)([\^\-\*/\+=]=?)(.+)\Z", #Infix operator
lambda m: parse(m.group(1)) + translateOperator(m.group(2)) + parse(m.group(3)) ))
#End rules
-
+
for rule, action in rules:
m = match(rule, s)
if m:
return action(m)
-
+
return s
-
+
def translateFunction (s):
if s[0:3] == "Arc":
return "a" + s[3:]
@@ -47,4 +47,4 @@ def translateOperator (s):
dictionary = {'^':'**'}
if s in dictionary:
return dictionary[s]
- return s
+ return s
View
2  sympy/parsing/maxima.py
@@ -53,7 +53,7 @@ def parse_maxima(str, globals=None, name_dict={}):
dct = MaximaHelpers.__dict__.copy()
dct.update(name_dict)
obj = sympify(str, locals= dct)
-
+
if assign_var and globals:
globals[assign_var] = obj
View
4 sympy/parsing/tests/test_maxima.py
@@ -35,5 +35,5 @@ def test_maxima_functions():
)
) == factorial(n)
assert parse_maxima('ratsimp((x^2-1)/(x+1))') == x-1
- assert abs( parse_maxima('float(sec(%pi/3) + csc(%pi/3))') - 3.154700538379252) < 10**(-5)
-
+ assert abs( parse_maxima('float(sec(%pi/3) + csc(%pi/3))') - 3.154700538379252) < 10**(-5)
+
View
2  sympy/physics/tests/test_matrices.py
@@ -1,6 +1,6 @@
from sympy.physics.matrices import msigma, mgamma, minkowski_tensor
from sympy import zero, one, I
-
+
def test_Pauli():
View
74 sympy/plotting/plot.py
@@ -20,19 +20,19 @@ class Plot(object):
"""
Plot Examples
=============
-
+
See examples/plotting.py for many more examples.
-
+
>>> from sympy import symbols, Plot
>>> x,y,z = symbols('xyz')
-
+
>>> Plot(x*y**3-y*x**3)
-
+
>>> p = Plot()
>>> p[1] = x*y
>>> p[1].color = z, (0.4,0.4,0.9), (0.9,0.4,0.4)
-
+
>>> p = Plot()
>>> p[1] = x**2+y**2
>>> p[2] = -x**2-y**2
@@ -40,11 +40,11 @@ class Plot(object):
Variable Intervals
==================
-
+
The basic format is [var, min, max, steps], but the
syntax is flexible and arguments left out are taken
from the defaults for the current coordinate mode:
-
+
>>> Plot(x**2) # implies [x,-5,5,100]
>>> Plot(x**2, [], []) # [x,-1,1,40], [y,-1,1,40]
>>> Plot(x**2-y**2, [100], [100]) # [x,-1,1,100], [y,-1,1,100]
@@ -57,32 +57,32 @@ class Plot(object):
Coordinate Modes
================
-
+
Plot supports several curvilinear coordinate modes, and
they independent for each plotted function. You can specify
a coordinate mode explicitly with the 'mode' named argument,
but it can be automatically determined for cartesian or
parametric plots, and therefore must only be specified for
polar, cylindrical, and spherical modes.
-
+
Specifically, Plot(function arguments) and Plot[n] =
(function arguments) will interpret your arguments as a
cartesian plot if you provide one function and a parametric
plot if you provide two or three functions. Similarly, the
arguments will be interpreted as a curve is one variable is
used, and a surface if two are used.
-
+
Supported mode names by number of variables:
-
+
1: parametric, cartesian, polar
2: parametric, cartesian, cylindrical = polar, spherical
-
+
>>> Plot(1, mode='spherical')
Calculator-like Interface
=========================
-
+
>>> p = Plot(visible=False)
>>> f = x**2
>>> p[1] = f
@@ -112,26 +112,26 @@ class Plot(object):
Screen Rotation:
X,Y axis Arrow Keys, A,S,D,W, Numpad 4,6,8,2
Z axis Q,E, Numpad 7,9
-
+
Model Rotation:
Z axis Z,C, Numpad 1,3
-
+
Zoom: R,F, PgUp,PgDn, Numpad +,-
-
+
Reset Camera: X, Numpad 5
-
+
Camera Presets:
XY F1
XZ F2
YZ F3
Perspective F4
-
+
Sensitivity Modifier: SHIFT
-
+
Axes Toggle:
Visible F5
Colors F6
-
+
Close Window: ESCAPE
=============================
@@ -160,8 +160,8 @@ def __init__(self, *fargs, **win_args):
functions in the initializer. This functionality
has been dropped in favor of better automatic
plot plot_mode detection.
-
-
+
+
Named Arguments
===============
@@ -169,21 +169,21 @@ def __init__(self, *fargs, **win_args):
An option string of the form
"key1=value1; key2 = value2" which
can use the following options:
-
+
style = ordinate
none OR frame OR box OR ordinate
-
+
stride = 0.25
val OR (val_x, val_y, val_z)
-
+
overlay = True (draw on top of plot)
True OR False
-
+
colored = False (False uses Black,
True uses colors
R,G,B = X,Y,Z)