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
transcendental equation solver for solveset: transolve #14736
Changes from 1 commit
059b5ae
f7c38cb
885923b
fd0a4f6
f8bc1ad
9dfaf58
a2305da
d2f067c
217b11f
c38ea87
197355d
5be292f
ffef477
a7574b0
648da0e
f8597b5
a45df5c
3e0972c
2309ce7
5e89449
f2e6ab0
89ce4c9
e2f12ac
154ee3b
8345107
c0bc441
6ddc927
de66d1e
cca2d14
e49647e
e329518
90efc7a
e51734a
254f45f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -987,14 +987,25 @@ def _solveset(f, symbol, domain, _check=False): | |
|
||
def term_factors(f): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please make it private |
||
""" | ||
Returns a list of the factors of all terms present in the | ||
expression. | ||
An iterator that returns the factors of all terms | ||
present in the expression. | ||
|
||
Examples | ||
======== | ||
|
||
>>> from sympy import symbols | ||
>>> from sympy.solvers.solveset import term_factors | ||
>>> x = symbols('x') | ||
>>> term_factors_obj = term_factors(x**2 - 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
>>> for term in term_factors_obj: | ||
... print(term) | ||
-1 | ||
x**2 | ||
""" | ||
args = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed anymore |
||
for add_arg in Add.make_args(f): | ||
for mul_arg in Mul.make_args(add_arg): | ||
args.append(mul_arg) | ||
return args | ||
yield mul_arg | ||
|
||
|
||
def _solve_expo(f, symbol): | ||
|
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.
What do you think about making this an iterator? So instead of returning all, yield one at a time. That could be used like
uniq(term_factors(foo))
to give the unique term factors of an expression in an efficient manner.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.
Sounds good @smichr. I will make changes.