Download or view solveTest2.frink in plain text format
// This is a test for some nasty cases of pattern-matching that
// require that backtracking goes right.
symbolicMode[true]
showApproximations[false]
// Cubic equation solver.
solve[_a _x^3 + _b _x^2 + _c _x === _d, _x] <-> [solve[_x === -1 _b (3 _a)^-1 + -1 (3 _a)^-1 (1/2 (2 _b^3 + -9 _a _b _c + -27 _a^2 _d + ((2 _b^3 + -9 _a _b _c + -27 _a^2 _d)^2 + -4 (_b^2 + -3 _a _c)^3)^(1/2)))^(1/3) + -1 (3 _a)^-1 (1/2 (2 _b^3 + -9 _a _b _c + -27 _a^2 _d + -1 ((2 _b^3 + -9 _a _b _c + -27 _a^2 _d)^2 + -4 (_b^2 + -3 _a _c)^3)^(1/2)))^(1/3), _x], solve[_x === -1 _b (3 _a)^-1 + (1 + 1.4422495703074083 i) (6 _a)^-1 (1/2 (2 _b^3 + -9 _a _b _c + -27 _a^2 _d + ((2 _b^3 + -9 _a _b _c + -27 _a^2 _d)^2 + -4 (_b^2 + -3 _a _c)^3)^(1/2)))^(1/3) + (1 + -1.4422495703074083 i) (6 _a)^-1 (1/2 (2 _b^3 + -9 _a _b _c + -27 _a^2 _d + -1 ((2 _b^3 + -9 _a _b _c + -27 _a^2 _d)^2 + -4 (_b^2 + -3 _a _c)^3)^(1/2)))^(1/3), _x], solve[_x === -1 _b (3 _a)^-1 + (1 + -1.4422495703074083 i) (6 _a)^-1 (1/2 (2 _b^3 + -9 _a _b _c + -27 _a^2 _d + ((2 _b^3 + -9 _a _b _c + -27 _a^2 _d)^2 + -4 (_b^2 + -3 _a _c)^3)^(1/2)))^(1/3) + (1 + 1.4422495703074083 i) (6 _a)^-1 (1/2 (2 _b^3 + -9 _a _b _c + -27 _a^2 _d + -1 ((2 _b^3 + -9 _a _b _c + -27 _a^2 _d)^2 + -4 (_b^2 + -3 _a _c)^3)^(1/2)))^(1/3), _x]]
println[join["\n",transformExpressionDebug[noEval[solve[-1 m + -2 m phi + 2 m theta === -1 (2 phi + -2 d2 phi + -4 d3 phi + -4 d4 phi + -1 theta + d2 theta + 2 d3 theta + 2 d4 theta), m]]]]]
println[]
Download or view solveTest2.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen was born 20145 days, 19 hours, 19 minutes ago.