(
latex: string,
options?: { variable?: string }
)
| 458 | ): { initial: string; result: string; steps: string[] } { |
| 459 | const ex = ce.parse(latex).explain('solve', options); |
| 460 | return { |
| 461 | initial: ex.initial.toString(), |
| 462 | result: ex.result.toString(), |
| 463 | steps: ex.steps.map((s) => `${s.id}: ${s.value.toString()}`), |
| 464 | }; |
| 465 | } |
| 466 | |
| 467 | describe('explain: golden solve explanations', () => { |
| 468 | test('2x+1=5: linear isolation', () => { |
| 469 | expect(serializeSolve('2x+1=5')).toMatchSnapshot(); |
| 470 | }); |
| 471 | |
| 472 | test('x^2=4: quadratic (two roots)', () => { |
| 473 | expect(serializeSolve('x^2=4')).toMatchSnapshot(); |
no test coverage detected