MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / split

Function split

test/compute-engine/differential-equations.test.ts:688–717  ·  view source on GitHub ↗
(
      t: Expr
    )

Source from the content-addressed store, hash-verified

686 });
687
688 test('keeps irrational characteristic roots exact when possible', () => {
689 const equation = [
690 'Equal',
691 [
692 'Add',
693 ['D', ['D', ['y', 'x'], 'x'], 'x'],
694 ['Negate', ['D', ['y', 'x'], 'x']],
695 ['Negate', ['y', 'x']],
696 ],
697 0,
698 ];
699 const solution = dsolve(equation);
700
701 expect(solution.toString()).toMatchInlineSnapshot(
702 `[y(x) == ArbitraryConstant(1) * e^(1/2 * x * (1 + sqrt(5))) + ArbitraryConstant(2) * e^(1/2 * x * (1 - sqrt(5)))]`
703 );
704 expect(
705 verifyEquationSolution(equation, solution, { c_1: 2, c_2: 3, x: 0.75 })
706 ).toBe(true);
707 });
708
709 test('solves second-order homogeneous equation with complex roots', () => {
710 const equation = [
711 'Equal',
712 ['Add', ['D', ['D', ['y', 'x'], 'x'], 'x'], ['y', 'x']],
713 0,
714 ];
715 const solution = dsolve(equation);
716
717 expect(solution.toString()).toMatchInlineSnapshot(
718 `[y(x) == sin(x) * ArbitraryConstant(2) + cos(x) * ArbitraryConstant(1)]`
719 );
720 expect(

Callers

nothing calls this directly

Calls 3

trigSquareFunction · 0.70
negMethod · 0.65
functionMethod · 0.65

Tested by

no test coverage detected