New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check & fix all assumptions helpers #316

Merged
merged 63 commits into from Sep 9, 2016

Conversation

1 participant
@skirpichev
Copy link
Collaborator

skirpichev commented Jul 24, 2016

  • diofant/concrete/expr_with_limits.py
  • diofant/concrete/products.py
  • diofant/concrete/summations.py
  • diofant/core/add.py
  • diofant/core/expr.py
  • diofant/core/function.py
  • diofant/core/mod.py
  • diofant/core/mul.py
  • diofant/core/numbers.py
  • diofant/core/operations.py
  • diofant/core/power.py
  • diofant/functions/combinatorial/factorials.py
  • diofant/functions/combinatorial/numbers.py
  • diofant/functions/elementary/complexes.py
  • diofant/functions/elementary/exponential.py
  • diofant/functions/elementary/hyperbolic.py
  • diofant/functions/elementary/integers.py
  • diofant/functions/elementary/piecewise.py
  • diofant/functions/elementary/trigonometric.py
  • diofant/functions/special/bessel.py
  • diofant/functions/special/beta_functions.py
  • diofant/functions/special/error_functions.py
  • diofant/functions/special/gamma_functions.py
  • diofant/integrals/integrals.py
  • diofant/ntheory/factor_.py
  • diofant/polys/rootoftools.py
  • diofant/series/order.py
  • diofant/stats/rv.py

  • adapt helpers to return False for nan's
  • 100% coverage of helpers
  • rebase

@skirpichev skirpichev added this to the First public release milestone Jul 24, 2016

@skirpichev skirpichev referenced this pull request Jul 24, 2016

Closed

assumptions todo #34

9 of 9 tasks complete

@skirpichev skirpichev added wrong answer and removed bug labels Aug 17, 2016

@skirpichev skirpichev force-pushed the skirpichev:check-assumptions branch 3 times, most recently from 9fd0956 to c28bbe9 Aug 26, 2016

@skirpichev skirpichev force-pushed the skirpichev:check-assumptions branch from e81e58e to 973182e Sep 3, 2016

@skirpichev skirpichev force-pushed the skirpichev:check-assumptions branch 4 times, most recently from 631d0fb to 7dd7a59 Sep 4, 2016

skirpichev added some commits Jul 24, 2016

Check & fix assumption helpers in factorials.py
rf/ff._eval_is_integer's methods were wrong.  And example
is rf(1, n) == n!  If n>=0 but is not an integer - n!
_can_ be an integer.

Also add 100% test coverage for helpers and do minor code cleanup.

Drop redundant helper for factorial2.
Check assumptions in numbers.py
Drop untested or redundant helpers in genocchi
Check & fix assumptions in diofant/concrete
Product.is_zero was wrong.  For example, Product((n - 2), (n, 0, 3)) == 0,
but n - 2 != 0 for all n.
Drop assumption helper for extended_real from beta_functions.py
I don't think this one was correct.  For example, beta(a, 0)
is zoo, according to
http://functions.wolfram.com/GammaBetaErf/Beta/03/01/01/
Check assumptions in bessel.py
Validation with Mathematica:
    In[1]:= FullSimplify[BesselJ[n, x] \[Element] Reals,
     n \[Element] Integers && x \[Element] Reals]

    Out[1]= True

    In[6]:= FullSimplify[BesselY[n, x] \[Element] Reals,
     n \[Element] Integers && x \[Element] Reals && x > 0]

    Out[6]= True

    In[7]:= FullSimplify[BesselI[n, x] \[Element] Reals,
     n \[Element] Integers && x \[Element] Reals]

    Out[7]= True

    In[9]:= FullSimplify[BesselK[n, x] \[Element] Reals,
     n \[Element] Integers && x \[Element] Reals && x > 0]

    Out[9]= True

For oo or -oo we have zeros:
http://functions.wolfram.com/Bessel-TypeFunctions/BesselJ/03/03/
http://functions.wolfram.com/Bessel-TypeFunctions/BesselK/03/03/
http://functions.wolfram.com/Bessel-TypeFunctions/BesselY/03/03/
http://functions.wolfram.com/Bessel-TypeFunctions/BesselI/03/03/

Airy helper for extended_real's now more conservative.

@skirpichev skirpichev force-pushed the skirpichev:check-assumptions branch from 44169e5 to 250e56c Sep 9, 2016

skirpichev added some commits Aug 30, 2016

Correct Add._eval_is_imaginary
imaginary == I*real, not I*extended_real !
Fix Mul._eval_is_imaginary
Be sure, that obj.is_finite.  Also adapt bessel.py
after this change.
Cleanup & fix Mul._eval_is_positive
Be more careful for zero check.  Also, drop
t.is_positive/negative is False cases.
Add Abs._eval_is_finite helper
Validation with Mathematica:
    In[3]:= FullSimplify[Abs[z] < Infinity,
     Assumptions -> z \[Element] Complexes]

    Out[3]= True
Alter Mul._eval_is_antihermitian
Use is_nonzero check instead of "is_zero is False".
Correct Mul._eval_is_extended_real
1) more strict checking for zero (i.e. for imaginary args)
2) change "extended_real is False" case to "is_complex and is_real is False"
Fix Mul._eval_is_hermitian
Drop one_neither case.
Implement asin._eval_is_complex helper
Validation with Mathematica:
    In[1]:= FullSimplify[ArcSin[x] \[Element] Complexes,
     Assumptions -> x \[Element] Reals]

    Out[1]= True

    In[2]:= FullSimplify[ArcSin[x] \[Element] Complexes,
     Assumptions -> x \[Element] Complexes]

    Out[2]= True
Correct Pow._eval_is_extended_real
1) Be more careful for cases when base=0, as 1/0 is zoo.
2) Adapt Pow._eval_expand_power_base to handle cases
   where base = 1/x and x.is_nonnegative.

@skirpichev skirpichev force-pushed the skirpichev:check-assumptions branch from 250e56c to 2cbaa32 Sep 9, 2016

@skirpichev skirpichev merged commit 60a64a2 into diofant:master Sep 9, 2016

3 checks passed

codecov/patch 98% of diff hit (target 90%)
Details
codecov/project 90% (+<1%) compared to b302104
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@skirpichev skirpichev deleted the skirpichev:check-assumptions branch Sep 9, 2016

skirpichev added a commit to skirpichev/diofant that referenced this pull request Nov 2, 2016

Add regression tests & mention closed issues
    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
    close sympy/sympy#9173 (test was added in 5a510ac)
    close sympy/sympy#9808 (fixed in 09e539b)
    close sympy/sympy#9341 (fixed in af98a00)
    close sympy/sympy#9908 (fixed in cc3fa8d)
    close sympy/sympy#6171 (test added in d278031)
    close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
    close sympy/sympy#10201 (fixed in 0d0fc5f)
    close sympy/sympy#9057 (test was added in 8290a0c)
    close sympy/sympy#11159 (test was added in ffb76cb)
    close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
    close sympy/sympy#11081 (see ed01e16 and bb92329)
    close sympy/sympy#10974 (see 73fc425)
    close sympy/sympy#10806 (test in 539929a)
    close sympy/sympy#10801 (test in 2fe3da5)
    close sympy/sympy#9549 (test in 88bdefa)
    close sympy/sympy#4231 (test was added in fb411d5)
    close sympy/sympy#8634 (see 2fcbb58)
    close sympy/sympy#8481 (see 1ef20d3)
    close sympy/sympy#9956 (fixed in a34735f)
    close sympy/sympy#9747 (see e117c60)
    close sympy/sympy#7853 (see 3e4fbed)
    close sympy/sympy#9634 (see 2be03f5)
    close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
    close sympy/sympy#9192 (see 9bf622f)
    close sympy/sympy#7130 (see e068fa3)
    close sympy/sympy#8514 (see b2d543b)
    close sympy/sympy#9334 (see 90de625)
    close sympy/sympy#8229 (see 9755b89)
    close sympy/sympy#8061 (see 7054f06)
    close sympy/sympy#7872 (tested in diofant#6)
    close sympy/sympy#3496 (tested in test_log_symbolic)
    close sympy/sympy#2929 (see da7db7a)
    close sympy/sympy#8203 (oo is not a real, see diofant#36)
    close sympy/sympy#7649 (0 is imaginary since diofant#8)
    close sympy/sympy#7256 (fixed in c0a4549)
    close sympy/sympy#6783 (see cb28d63)
    close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
    close sympy/sympy#5295 (fixed with diofant#354)
    close sympy/sympy#4856 (we now have flake/pep tests)
    close sympy/sympy#4555 (flake8 enabled after diofant#214)
    close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
    close sympy/sympy#5484 (see above)

    Added regression tests:
    from https://groups.google.com/forum/#!topic/sympy/LkTMQKC_BOw
    fixes sympy/sympy#8825 (probably via diofant#209)
    fixes sympy/sympy#8635
    fixes sympy/sympy#8157
    fixes sympy/sympy#7872
    fixes sympy/sympy#7599
    fixes sympy/sympy#6179
    fixes sympy/sympy#5415
    fixes sympy/sympy#2865
    fixes sympy/sympy#5907
    fixes sympy/sympy#11722

    Closes diofant#347

skirpichev added a commit to skirpichev/diofant that referenced this pull request Nov 2, 2016

Add regression tests & mention closed issues
    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
    close sympy/sympy#9173 (test was added in 5a510ac)
    close sympy/sympy#9808 (fixed in 09e539b)
    close sympy/sympy#9341 (fixed in af98a00)
    close sympy/sympy#9908 (fixed in cc3fa8d)
    close sympy/sympy#6171 (test added in d278031)
    close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
    close sympy/sympy#10201 (fixed in 0d0fc5f)
    close sympy/sympy#9057 (test was added in 8290a0c)
    close sympy/sympy#11159 (test was added in ffb76cb)
    close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
    close sympy/sympy#11081 (see ed01e16 and bb92329)
    close sympy/sympy#10974 (see 73fc425)
    close sympy/sympy#10806 (test in 539929a)
    close sympy/sympy#10801 (test in 2fe3da5)
    close sympy/sympy#9549 (test in 88bdefa)
    close sympy/sympy#4231 (test was added in fb411d5)
    close sympy/sympy#8634 (see 2fcbb58)
    close sympy/sympy#8481 (see 1ef20d3)
    close sympy/sympy#9956 (fixed in a34735f)
    close sympy/sympy#9747 (see e117c60)
    close sympy/sympy#7853 (see 3e4fbed)
    close sympy/sympy#9634 (see 2be03f5)
    close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
    close sympy/sympy#9192 (see 9bf622f)
    close sympy/sympy#7130 (see e068fa3)
    close sympy/sympy#8514 (see b2d543b)
    close sympy/sympy#9334 (see 90de625)
    close sympy/sympy#8229 (see 9755b89)
    close sympy/sympy#8061 (see 7054f06)
    close sympy/sympy#7872 (tested in diofant#6)
    close sympy/sympy#3496 (tested in test_log_symbolic)
    close sympy/sympy#2929 (see da7db7a)
    close sympy/sympy#8203 (oo is not a real, see diofant#36)
    close sympy/sympy#7649 (0 is imaginary since diofant#8)
    close sympy/sympy#7256 (fixed in c0a4549)
    close sympy/sympy#6783 (see cb28d63)
    close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
    close sympy/sympy#5295 (fixed with diofant#354)
    close sympy/sympy#4856 (we now have flake/pep tests)
    close sympy/sympy#4555 (flake8 enabled after diofant#214)
    close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
    close sympy/sympy#5484 (see above)

    Added regression tests:
    from https://groups.google.com/forum/#!topic/sympy/LkTMQKC_BOw
    fixes sympy/sympy#8825 (probably via diofant#209)
    fixes sympy/sympy#8635
    fixes sympy/sympy#8157
    fixes sympy/sympy#7872
    fixes sympy/sympy#7599
    fixes sympy/sympy#6179
    fixes sympy/sympy#5415
    fixes sympy/sympy#2865
    fixes sympy/sympy#5907
    fixes sympy/sympy#11722

    Closes diofant#347

skirpichev added a commit to skirpichev/diofant that referenced this pull request Nov 1, 2017

Validate is_polar assumption helpers
Now we have more conservative Mul/Pow helpers.  Still, positive
does not imply polar.

Closes diofant#332

N.B. this pr finalizes diofant#316

skirpichev added a commit to skirpichev/diofant that referenced this pull request Nov 1, 2017

Validate is_polar assumption helpers
Now we have more conservative Mul/Pow helpers.  Still, positive
does not imply polar.

Closes diofant#332

N.B. This pr finalizes diofant#316.  Assumption itself
was added in sympy/sympy#504, see 152fc0c.

skirpichev added a commit to skirpichev/diofant that referenced this pull request Nov 1, 2017

Validate is_polar assumption helpers
Now we have more conservative Mul/Pow helpers.  Still, positive
does not imply polar.

Closes diofant#332

N.B. This pr finalizes diofant#316.  Assumption itself
was added in sympy/sympy#504, see 152fc0c.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment