Assert `Normal(Series(f, x, x0, n))` matches `f` numerically at points near * the pole, within a relative tolerance.
( poly: BoxedExpression, f: (x: number) => number, x0: number, dxs: number[], relTol: number )
| 424 | expect(latex).toBe( |
| 425 | '\\frac{\\pi}{2}-\\frac{1}{x}+\\frac{1}{3x^3}-\\frac{1}{5x^5}+O\\left(\\frac{1}{x^7}\\right)' |
| 426 | ); |
| 427 | }); |
| 428 | |
| 429 | test('a BigO-free sum is unaffected (canonical order preserved)', () => { |
| 430 | // Regression guard: the display-order rule only applies to sums that |
| 431 | // actually contain a `BigO` term. |
| 432 | expect(ce.parse('x^5 - x^3 + x').latex).toBe('x^5-x^3+x'); |
| 433 | }); |
| 434 | |
| 435 | test('AsciiMath uses ascending degree with BigO last', () => { |
| 436 | expect(toAsciiMath(series('\\sin x'))).toBe( |
| 437 | 'x - 1/6 * x^3 + 1/120 * x^5 + BigO(x^7)' |
| 438 | ); |
| 439 | }); |
| 440 | |
| 441 | test('AsciiMath uses descending degree for an expansion at infinity', () => { |
| 442 | expect(toAsciiMath(series('\\arctan x', '+\\infty'))).toBe( |
| 443 | '1/2 * pi - 1 / x + 1/3 * x^(-3) - 1/5 * x^(-5) + BigO(x^(-7))' |