| 908 | ) { |
| 909 | const F = engine.expr(['Integrate', integrand, 'x']).evaluate(); |
| 910 | expect(F.has('Integrate')).toBe(false); |
| 911 | const dF = engine.expr(['D', F.json as any, 'x']).evaluate(); |
| 912 | const f = engine.expr(integrand); |
| 913 | for (const pt of points) { |
| 914 | const got = dF.subs(pt).N().re; |
| 915 | const want = f.subs(pt).N().re; |
| 916 | expect(Math.abs(got - want)).toBeLessThanOrEqual( |
| 917 | 1e-7 * (1 + Math.abs(want)) |
| 918 | ); |
| 919 | } |
| 920 | } |
| 921 | |
| 922 | test('∫(a + b·x⁴)/x⁶ does not drop the a-term', () => |
| 923 | checkAntiderivative( |
| 924 | [ |
| 925 | 'Divide', |
| 926 | ['Add', 'a', ['Multiply', 'b', ['Power', 'x', 4]]], |
| 927 | ['Power', 'x', 6], |
| 928 | ], |