(
latex: string,
options?: { variable?: string }
)
| 657 | ): { initial: string; result: string; steps: string[] } { |
| 658 | const ex = ce.parse(latex).explain('D', options); |
| 659 | return { |
| 660 | initial: ex.initial.toString(), |
| 661 | result: ex.result.toString(), |
| 662 | steps: ex.steps.map((s) => `${s.id}: ${s.value.toString()}`), |
| 663 | }; |
| 664 | } |
| 665 | |
| 666 | describe('explain: golden D explanations', () => { |
| 667 | test('x sin(x): product rule + known derivative', () => { |
| 668 | const ex = ce.parse('x \\sin x').explain('D'); |
| 669 | expect(ex.steps.some((s) => s.id === 'derivative.product-rule')).toBe(true); |
| 670 | expect(ex.steps.some((s) => s.id === 'derivative.known-derivative')).toBe( |
| 671 | true |
| 672 | ); |
no test coverage detected