Friday, October 19, 2012

SymPy 0.7.2 is released



Major Changes

Python 3 support

SymPy now supports Python 3. The officially supported versions are 3.2 and 3.3, but 3.1 should also work in a pinch. The Python 3-compatible tarballs will be provided separately, but it is also possible to download Python 2 code and convert it manually, via the bin/use2to3 utility. See the README for more

PyPy support

All SymPy tests pass in recent nightlies of PyPy, and so it should have full support as of the next version after 1.9.

Combinatorics

A new module called Combinatorics was added which is the result of a successful GSoC project. It attempts to replicate the functionality of Combinatorica and currently has full featured support for Permutations, Subsets, Gray codes and Prufer codes.
In another GSoC project, facilities from computational group theory were added to the combinatorics module, mainly following the book "Handbook of computational group theory". Currently only permutation groups are supported. The main functionalities are: basic properties (orbits, stabilizers, random elements...), the Schreier-Sims algorithm (three implementations, in increasing speed: with Jerrum's filter, incremental, and randomized (Monte Carlo)), backtrack searching for subgroups with certain properties.

Definite Integration

A new module called meijerint was added, which is also the result of a successful GSoC project. It implements a heuristic algorithm for (mainly) definite integration, similar to the one used in Mathematica. The code is automatically called by the standard integrate() function. This new algorithm allows computation of important integral transforms in many interesting cases, so helper functions for Laplace, Fourier and Mellin transforms were added as well.

Random Variables

A new module called stats was added. This introduces a RandomSymbol type which can be used to model uncertainty in expressions.

Matrix Expressions

A new matrix submodule named expressions was added. This introduces a MatrixSymbol type which can be used to describe a matrix without explicitly stating its entries. A new family of expression types were also added: Transpose, Inverse, Trace, and BlockMatrix. ImmutableMatrix was added so that explicitly defined matrices could interact with other SymPy expressions.

Sets

A number of new sets were added including atomic sets like FiniteSet, Reals, Naturals, Integers, UniversalSet as well as compound sets like ProductSet and TransformationSet. Using these building blocks it is possible to build up a great variety of interesting sets.

Classical Mechanics

A physics submodule named machanics was added which assists in formation of equations of motion for constrained multi-body systems. It is the result of 3 GSoC projects. Some nontrivial systems can be solved, and examples are provided.

Quantum Mechanics

Density operator module has been added. The operator can be initialized with generic Kets or Qubits. The Density operator can also work with TensorProducts as arguments. Global methods are also added that compute entropy and fidelity of states. Trace and partial-trace operations can also be performed on these density operators.
To enable partial trace operations a Tr module has been added to the core library. While the functionality should remain same, this module is likely to be relocated to an alternate folder in the future. One can currently also use sympy.core.Tr to work on general trace operations, but this module is what is needed to work on trace and partial-trace operations on any sympy.physics.quantum objects.
The Density operators, Tr and Partial trace functionality was implemented as part of student participation in GSoC 2012
Expanded angular momentum to include coupled-basis states and product-basis states. Operators can also be treated as acting on the coupled basis (default behavior) or on one component of the tensor product states. The methods for coupling and uncoupling these states can work on an arbitrary number of states. Representing, rewriting and applying states and operators between bases has been improved.

Commutative Algebra

A new module agca was started which seeks to support computations in commutative algebra (and eventually algebraic geometry) in the style of Macaulay2 and Singular. Currently there is support for computing Groebner bases of modules over a (generalized) polynomial ring over a field. Based on this, there are algorithms for various standard problems in commutative algebra, e.g., computing intersections of submodules, equality tests in quotient rings, etc....

Plotting Module

A new plotting module has been added which uses Matplotlib as its back-end. The plotting module has functions to plot the following:
  • 2D line plots
  • 2D parametric plots.
  • 2D implicit and region plots.
  • 3D surface plots.
  • 3D parametric surface plots.
  • 3D parametric line plots.

Differential Geometry

Thanks to a GSoC project the beginning of a new module covering the theory of differential geometry was started. It can be imported withsympy.diffgeom. It is based on "Functional Differential Geometry" by Sussman and Wisdom. Currently implemented are scalar, vector and form fields over manifolds as well as covariant and other derivatives.

Backwards compatibility breaks

-The KroneckerDelta class was moved from sympy/physics/quantum/kronecker.py to sympy/functions/special/tensor_functions.py.
  • Merged the KroneckerDelta class in sympy/physics/secondquant.py with the class above.
  • The Dij class in sympy/functions/special/tensor_functions.py was replaced with KroneckerDelta.
  • The errors raised for invalid float calls on SymPy objects were changed in order to emulate more closely the errors raised by the standard library. The __float__ and __complex__ methods of Expr are concerned with that change.
  • The solve() function returns empty lists instead of None objects if no solutions were found. Idiomatic code of the formsol = solve(...); if sol:... will not be affected by this change.
  • Piecewise no longer accepts a Set or Interval as a condition. One should explicitly specify a variable using Set().contains(x) to obtain a valid conditional.
  • The statistics module has been deprecated in favor of the new stats module.
  • sympy/galgebra/GA.py:
  • set_main() is no longer needed
  • make_symbols() is deprecated (use sympy.symbols() instead)
  • the symbols used in this package are no longer broadcast to the main program
  • The classes for Infinity, NegativeInfinity, and NaN no longer subclass from Rational. Creating a Rational with 0 in the denominator will still return one of these classes, however.

Other Changes

  • A new module gaussopt was added supporting the most basic constructions from Gaussian optics (ray tracing matrices, geometric rays and Gaussian beams).
  • New classes were added to represent the following special functions: classical and generalized exponential integrals (Ei, expint), trigonometric (Si, Ci) and hyperbolic integrals (Shi, Chi), the polylogarithm (polylog) and the Lerch transcendent (lerchphi). In addition to providing all the standard sympy functionality (differentiation, numerical evaluation, rewriting ...), they are supported by both the new meijerint module and the existing hypergeometric function simplification module.
  • An ImmutableMatrix class was created. It has the same interface and functionality of the old Matrix but is immutable and inherits from Basic.
  • A new function in geometry.util named centroid was added which will calculate the centroid of a collection of geometric entities. And the polygon module now allows triangles to be instantiated from combinations of side lengths and angles (using keywords sss, asa, sas) and defines utility functions to convert between degrees and radians.
  • In ntheory.modular there is a function (solve_congruence) to solve congruences such as "What number is 2 mod 3, 3 mod 5 and 2 mod 7?"
  • A utility function named find_unit has been added to physcis.units that allows one to find units that match a given pattern or contain a given unit.
  • There have been some additions and modifications to Expr's methods:
  • Although the problem of proving that two expressions are equal is in general a difficult one (since whatever algorithm is used, there will always be an expression that will slip through the algorithm) the new method of Expr named equals will do its best to answer whether A equals B: A.equals(B) might given True, False or None.
  • coeff now supports a third argument n (which comes 2nd now, instead of right). This n is used to indicate the exponent on x which one seeks: (x**2 + 3*x + 4).coeff(x, 1) -> 3. This makes it possible to extract the constant term from a polynomial:(x**2 + 3*x + 4).coeff(x, 0) -> 4.
  • The method round has been added to round a SymPy expression to a given a number of decimal places (to the left or right of the decimal point).
  • divmod is now supported for all SymPy numbers.
  • In the simplify module, the algorithms for denesting of radicals (sqrtdenest) and simplifying gamma functions (in combsimp) has been significantly improved.
  • The mathematica-similar TableForm function has been added to the printing.tableform module so one can easily generate tables with headings.
  • In addition to the more noticeable changes listed above, there have been numerous smaller additions, improvements and bug fixes in the commits in this release. See the git log for a full list of all changes. The command git log sympy-0.7.1..sympy-0.7.2 will show all commits made between this release and the last. You can also see the issues closed since the last release here.
  • The expand API has been updated. expand() now officially supports arbitrary _eval_expand_hint() methods on custom objects._eval_expand_hint() methods are now only responsible for expanding the top-level expression. All deep=True related logic happens inexpand() itself. See the docstring of expand() for more information and an example.
  • Two options were added to isympy to aid in interactive usage. isympy -a automatically creates symbols, so that typing something likea will give Symbol('a'), even if you never typed a = Symbol('a') or var('a')isympy -i automatically wraps integer literals with Integer, so that 1/2 will give Rational(1, 2) instead of 0.5isympy -I is the same as isympy -a -iisympy -I makes isympy act much more like a traditional interactive computer algebra system. These both require IPython.
  • The official documentation at http://docs.sympy.org now includes an extension that automatically hooks the documentation examples in toSymPy Live.

Authors

The following people contributed at least one patch to this release (names are given in alphabetical order by last name). A total of 103 people contributed to this release. People with a * by their names contributed a patch for the first time for this release; 77 people contributed for the first time for this release.
Thanks to everyone who contributed to this release!
  • Sanket Agarwal*
  • Swapnil Agarwal*
  • Bilal Akhtar*
  • Nathan Alison*
  • Steve Anton*
  • Takafumi Arakaki*
  • Chancellor Arkantos*
  • Manoj Babu K.*
  • Tom Bachmann
  • Oscar Benjamin
  • Raoul Bourquin*
  • Christian Bühler*
  • Jorge E. Cardona*
  • Ondřej Čertík
  • Puneeth Chaganti*
  • Roberto Colistete, Jr.*
  • Renato Coutinho
  • Joan Creus*
  • Addison Cugini
  • Guru Devanla*
  • Joseph Dougherty*
  • Comer Duncan*
  • Joachim Durchholz*
  • Tarun Gaba*
  • Luis Garcia*
  • Gilbert Gede
  • Arpit Goyal*
  • Brian E. Granger
  • Alexey U. Gudchenko
  • Alexandr Gudulin*
  • Matt Habel*
  • Tristan Hume*
  • Kevin Hunter*
  • Gert-Ludwig Ingold*
  • Sachin Irukula*
  • Sergiu Ivanov*
  • Siddhant Jain*
  • Saurabh Jha*
  • Fredrik Johansson
  • David Ju*
  • Kendhia*
  • Andreas Kloeckner*
  • Carsten Knoll*
  • Piotr Korgul*
  • Marcin Kostrzewa*
  • Stefan Krastanov
  • Priit Laes
  • Tim Lahey*
  • Ronan Lamy
  • Nikolay Lazarov*
  • Tomo Lazovich
  • Tobias Lenz*
  • David Li*
  • Bharath M R*
  • Sam Magura
  • Aleksandar Makelov*
  • Saptarshi Mandal
  • Imran Ahmed Manzoor*
  • Shruti Mangipudi*
  • Davy Mao*
  • Miha Marolt*
  • marshall2389*
  • Michael Mayorov*
  • Aaron Meurer
  • Raphael Michel*
  • Jason Moore*
  • Ljubiša Moćić*
  • Angadh Nanjangud*
  • Natalia Nawara*
  • Jens H. Nielsen*
  • Sai Nikhil*
  • Ashwini Oruganti*
  • Prateek Papriwal*
  • Mateusz Paprocki
  • Vladimir Perić
  • Mario Pernici
  • Luke Peterson
  • Alexandr Popov*
  • Nicolas Pourcelot
  • Martin Povišer*
  • Matt Rajca*
  • Julien Rioux*
  • Matthew Rocklin
  • Nikhil Sarda
  • Siddhanathan Shanmugam*
  • Stepan Simsa*
  • Sam Sleight*
  • Chris Smith
  • Geoffry Song*
  • Andrew Straw
  • Alexey Subach*
  • Grzegorz Świrski*
  • Prafullkumar P. Tale
  • Matthias Toews*
  • tsmars15*
  • Nichita Utiu*
  • Srinivas Vasudevan*
  • Sean Vig
  • vishal*
  • George Waksman*
  • Luca Weihs
  • Raymond Wong
  • Jeremias Yehdegho
  • Jim Zhang*
  • Tiffany Zhu*
  • jerryma1121*
  • Rom le Clair*


Friday, April 27, 2012

GSoC 2012 Results Announced

Google has announced the results for Google Summer of Code. I am proud to announce that we got six slots from Google. The following projects have been accepted:

(Project, Student, Mentor)
- Category Theory Module, Sergiu Ivanov, Tom Bachmann
- Density Operators for Quantum Module in sympy.physics.quantum, Guru Devanla, Brian Granger (co-mentor Sean Vig)
- Enhancements to sympy.physics.mechanics, Angadh Nanjangud, Gilbert Gede
- Group Theory, Aleksandar Makelov, David Joyner (co-mentor Aaron Meurer)
- Implicit Plotting Module, Bharath M R, Aaron Meurer
- Vector Analysis, Stefan Krastanov, Matthew Rocklin


Join me in congratulating these students on their acceptance.

In case you don't know, Google Summer of Code is a program where Google pays students to write code for open source projects. SymPy was accepted as a mentoring organization this year. The goal of the program is to help the students learn new skills, in particular in our case:

* contributing to opensource * working with the community * learn git, pull requests, reviews * teach them how to review other's people patches * do useful work for SymPy * have fun, and encourage the students to stay around

To all the students who are accepted, you should be receiving an email from your mentor soon to discuss how you will be communicating over the summer about your project. You should meet with your mentor about once a week during the summer to go over your progress. You should either meet on a public channel (like IRC), or else post minutes of your meeting in some public channel, so that the whole community can see your progress too.

Some of you may also be assigned a backup mentor or co-mentor. These people will also help out in mentoring your project. If you have two mentors and one is not available for something, or does not know the answer, you can ask your co-mentor.

I would like all of us to strongly encourage students this summer to submit pull requests early and often. This will go a long ways towards making sure that you don't end the summer with a ton of code written that never gets merged. Students should help review pull requests by other students, so that we don't get bogged down reviewing so much code.

We also require that all students keep a weekly blog of their work over the summer. If you don't already have a blog, you should start one. I recommend using either Wordpress or Blogger (I personally use and prefer Wordpress because it has a cleaner interface and lets you do $latex math$, but I recommend you test out both). You can also use some other service too if you like. The only requirement is that it has an RSS feed, so we can put it on planet.sympy.org. Once you have set up your blog, send me the url so I can add it there.

Starting on the week of May 21 (when the GSoC period officially begins), We will expect you to have at least one blog post a week, describing your progress for that week, or something interesting about your project. If you don't have a post by the beginning of the day on Saturday, your mentor or I will email you to remind you about it.

I invite other mentors who have blogs to blog as well. And I encourage all community members to follow the student blogs, so you can see their progress.

I would like to thank all the students who applied this year and everyone who submitted a patch. We received way more feedback this year than we ever have before. I would also like to thank all the mentors for helping review patches and proposals.

This summer is looking to be another very productive one for SymPy, and I look forward to it!

Friday, March 16, 2012

Google Summer of Code 2012

SymPy was accepted by Google once again to participate in Google Summer of Code for 2012. Please go to http://www.google-melange.com/gsoc/org/google/gsoc2012/sympy for more information about how to apply and get started.