@@ -1309,19 +1309,19 @@ class PossibleZeroQ(SympyFunction):
13091309 <dd>returns 'True' if basic symbolic and numerical methods suggest that expr has value zero, and 'False' otherwise.
13101310 </dl>
13111311
1312- ## Test whether a numeric expression is zero:
1313- ## >> PossibleZeroQ[E^(I Pi/4) - (-1)^(1/4)]
1314- ## = True
1312+ Test whether a numeric expression is zero:
1313+ >> PossibleZeroQ[E^(I Pi/4) - (-1)^(1/4)]
1314+ = True
13151315
1316- ## The determination is approximate.
1316+ The determination is approximate.
13171317
13181318 Test whether a symbolic expression is likely to be identically zero:
13191319 >> PossibleZeroQ[(x + 1) (x - 1) - x^2 + 1]
13201320 = True
13211321
13221322
1323- ## >> PossibleZeroQ[(E + Pi)^2 - E^2 - Pi^2 - 2 E Pi]
1324- ## = True
1323+ >> PossibleZeroQ[(E + Pi)^2 - E^2 - Pi^2 - 2 E Pi]
1324+ = True
13251325
13261326 Show that a numeric expression is nonzero:
13271327 >> PossibleZeroQ[E^Pi - Pi^E]
@@ -1346,6 +1346,11 @@ def apply(self, expr, evaluation):
13461346
13471347 sympy_expr = expr .to_sympy ()
13481348 result = _iszero (sympy_expr )
1349+ if result is None :
1350+ # try expanding the expression
1351+ exprexp = Expression ("ExpandAll" , expr ).evaluate (evaluation )
1352+ exprexp = exprexp .to_sympy ()
1353+ result = _iszero (exprexp )
13491354 if result is None :
13501355 # Can't get exact answer, so try approximate equal
13511356 numeric_val = Expression ("N" , expr ).evaluate (evaluation )
0 commit comments