Repository navigation
Commit 181a42a
authored
CollectLikeTerms failed on the expression its own documentation cites:
(x+1)^2 * (x+1)^2 came back with two x^2 terms side by side.
(2 * x)^2 reduces to 4 * x^2, a product and not a power, so it fell to the
exponent-of-one branch and the 4 was baked into the monomial key instead of
the coefficient. A factor that reduces to a product is now split again, and an
integer power of a product is distributed over its factors.
Only for polynomial-shaped factors. Opening a product is what lets like terms
meet and also what stops one cancelling as a whole: lifting the 1/2 out of
(1/2 * sin(2t))^2 * csc(t)^2 costs the cancellation to cos(t)^2, which
DoubleAngleOverSineTest is there to catch.
Splitting only products that carry a number does not help, since 1/2 is one;
and choosing between the collected and expanded forms by complexity cannot
work, because the payoff of leaving a product intact appears only after passes
that run later.
1 parent 50fc43f commit 181a42a
2 files changed
Lines changed: 76 additions & 2 deletions
File tree
- Sources
- AngouriMath/Functions/Evaluation
- Tests/UnitTests/Common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
242 | 258 | | |
243 | 259 | | |
244 | 260 | | |
| |||
261 | 277 | | |
262 | 278 | | |
263 | 279 | | |
264 | | - | |
| 280 | + | |
| 281 | + | |
265 | 282 | | |
266 | 283 | | |
267 | 284 | | |
268 | | - | |
| 285 | + | |
269 | 286 | | |
270 | 287 | | |
271 | 288 | | |
272 | 289 | | |
273 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
274 | 313 | | |
275 | 314 | | |
276 | 315 | | |
| |||
327 | 366 | | |
328 | 367 | | |
329 | 368 | | |
| 369 | + | |
330 | 370 | | |
331 | 371 | | |
332 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
94 | 128 | | |
95 | 129 | | |
96 | 130 | | |
| |||
0 commit comments