sympy/sympy — pull request #7315 by chaserelock (2014-03-21 05:51:46+00:00)
Title: Heurisch added functionality, new matrix property, issue fixes

integrals: Expanded heurisch() capabilities and revised tests
exponential: Added an alternate form of LambertW to fix issue# 7259
matrix: Added probability transition matrix property and added tests
trigonometric: Added an alternate form of fdiff for tan
test integrals: issue# 1304_2 has been fixed, removed xfail
test integrals: test# 1393 appears fixed, but output should be checked
test integrals: test# 4058 added, issue was pre-git

Improved scope of heurisch() by having the algorithm check for a special
form of a function's derivative. Because heurisch looks for the original
function, cases that have 0/0 forms in their fdiff such as LambertW(x)
have to be represented in a rational form that still evaluated correctly.
This special form has been added as the heurisch_diff property to tan
and LambertW. One issue to note is that without also including the chain
rule for tan (*Derivative(self.args[0],evaluate=True)), error in certain
integrals such as the following appear:
integrate(1/(5 + 3*cos(x) + 4*sin(x)), x)
When the evaluation requests the first derivative of tan(x/2) to solve
this integral, it was not computing the chain rule and the answer was
off by a factor of 2. This behavior should be examined more closely to
find the source.

Fixed a NaN error (isssue#7259) when trying to evaluate:
series(LambertW(x),x)
This happened because of a 0/0 derivative form needed to integrate with
Heurisch. It now evaluates the series and integral correctly. Tests
were added to series and integrals for confirmation.

The derivative of tangent will now show up as the more expected form
sec(x)**2 instead of 1 + tan(x)**2 which was previously needed to
integrate it. This was a result of the heurisch() fix.

For the matrix property addition, it can now test if the matrix could
be a representation of a probability transition. The matrix must be
square and all rows must sum to a probability of 1.