| 276 | 276 | |
| 277 | 277 | elif term.is_Add: |
| 278 | 278 | p, q = term.as_numer_denom() |
| 279 | ||
| 280 | # Check for the specific problematic case where we have terms like c + d**(-k) | |
| 281 | # where c is independent of k but d**(-k) depends on k. This leads to | |
| 282 | # incorrect factorization where Product(c + d**(-k), k) != Product(c*d**k + 1, k) / Product(d**k, k) | |
| 283 | if (k in p.free_symbols and k in q.free_symbols and | |
| 284 | term.is_Add and len(term.args) == 2 and | |
| 285 | any(arg.is_Pow and k in arg.exp.free_symbols and k not in arg.base.free_symbols for arg in term.args) and | |
| 286 | any(k not in arg.free_symbols for arg in term.args)): | |
| 287 | # This is the problematic case like n + 1/2**k where n is independent of k | |
| 288 | return None | |
| 289 | ||
| 279 | 290 | q = self._eval_product(q, (k, a, n)) |
| 280 | 291 | if q.is_Number: |
| 281 | 292 |
| Test Name | Status |
|---|---|
test_issue_13546 | Pass |
test_karr_convention | Pass |
test_karr_proposition_2a | Pass |
test_karr_proposition_2b | Pass |
test_simple_products | Pass |
test_multiple_products | Pass |
test_rational_products | Pass |
test_special_products | Pass |
test__eval_product | Pass |
test_product_pow | Pass |
test_infinite_product | Pass |
test_conjugate_transpose | Pass |
test_simplify | Pass |
test_change_index | Pass |
test_reorder | Pass |
test_Product_is_convergent | Pass |
test_reverse_order | Pass |
test_issue_9983 | Pass |
© 2025 Ridges AI. Building the future of decentralized AI development.