-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
[GSoC]Refactored series code and added aseries suppport for lambertw #26961
base: master
Are you sure you want to change the base?
Conversation
✅ Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.14. Click here to see the pull request description that was parsed.
|
Benchmark results from GitHub Actions Lower numbers are good, higher numbers are bad. A ratio less than 1 Significantly changed benchmark results (PR vs master) Significantly changed benchmark results (master vs previous release) Full benchmark results can be found as artifacts in GitHub Actions |
|
||
return s + Order(x**n, x) | ||
if lte.is_positive: | ||
if ceiling(n/lte) >= 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test like if ceiling(n/lte) >= 1
can fail if lte
is a symbol:
In [1]: x = Symbol('x', positive=True)
In [2]: x.is_positive
Out[2]: True
In [3]: x >= 1
Out[3]: x ≥ 1
In [4]: if x >= 1:
...: print('something')
...:
---------------------------------------------------------------------------
TypeError
also ping @anutosh491 for reviews |
if lte.is_positive: | ||
if (ceiling(n/lte) - 1).is_nonnegative is not False: | ||
s = Add(*[(-S.One)**(k - 1)*Integer(k)**(k - 2)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing is_nonnegative is not False
means that we go down this branch when is_nonnegative is None
.
It is possible to use inequalities here but it needs to be like:
if (ceiling(n / lte) >= 1) is S.true:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it is necessary to evaluate range(1, ceiling(n/lte))
, ceiling(n/lte)
must be a positive integer.
x = symbols('x', positive=True)
if (ceiling(x) >= 1) is S.true:
range(1, ceiling(x)) # error
Therefore, we need to check if it is a positive integer as follows:
c = ceiling(n/lte)
if c.is_Integer and c >= 1:
...
5aebc90
to
f65ed3f
Compare
ping for further reviews. |
I haven't checked whether anything is mathematically correct but otherwise it looks okay. |
from sympy.functions.combinatorial.numbers import stirling | ||
if len(self.args) == 1: | ||
point = args0[0] | ||
if point is S.Infinity: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
result
is not defined when point
is not S.Infinity
. To avoid mistakes, I think it's better to use an early return.
if len(self.args) != 1:
return super()._eval_aseries(n, args0, x, logx)
if args0[0] is not S.Infinity:
return None
...
#test aseries | ||
assert LambertW(x).aseries(x, n = 2) == -log(log(x))/log(x)**2 + log(log(x))/log(x) - \ | ||
log(log(x)) + log(x) + O(x**(-2), (x, oo)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear whether the issue has been resolved. I would like to add a test.
ping for further reviews. |
6dd7b87
to
7248031
Compare
Signed-off-by: arnabnandikgp <arnabnandi2002@gmail.com>
7248031
to
22d3ae9
Compare
References to other Issues or PRs
Fixes #26105
Brief description of what is fixed or changed
Other comments
Release Notes
_eval_as_leading_term
and_eval_nseries
methods of lambertw._eval_aseries
method for lambertw function.