I've dusted off my symbolic math package and improved it. Although I don't expect to get rich from this software, it is more than a toy example like the other programs on this website, and I do not give the source code here. I would like to find a way to share this program that makes sense, but I'm not ready to let the general public download it without my permission. If you think you might have use for this software, and would like to be a ``beta site,'' please contact me, describing a possible application.
The software uses Forth-like syntax. It can do simple algebra and calculus; it can calculate and manipulate the cyclic-index polynomials of permutation groups; and it can take multiple definite integrals of some spline functions, a tedious task that arises in many problems.
Obviously Mathematica from Wolfram Research can do much more, but I think this software may do some (relatively easy) tasks better or more simply. I have used it myself, effectively, to solve a few real problems, but the only way it will ever have real value is if I develop a base of users and improve the package according to their suggestions.
I've included a sample input program which illustrates some of the features of MathSolver, along with the output from that program. Another webpage gives a brief MathSolver user's manual.
Here's the sample input.
// This is a sample input file for MathSolver // It comprises 4 simple examples. "Example 1: Manipulate the cyclic-index poly of a permutation group\n" 1 Varnamemode 6 Permsize // These three rotations are a basis for all 24 of the cube rotations 0 1 4 5 3 2 Permu Pbasis 5 4 2 3 0 1 Permu Pbasis 3 2 0 1 4 5 Permu Pbasis // Uncomment next to allow the 24 reflections // 0 1 3 2 4 5 Permu Pbasis // Compute the cyclic polynomial Cycix Dup :perm // Compute and divide by the group's size 1 :n { n &a_1 substit n &a_2 substit n &a_3 substit n &a_4 substit n &a_5 substit n &a_6 substit } :subsub perm dup subsub / dup :perm // Print it "The cube's cyclic polynomial is " Print "\n" // Many interesting facts can be derived from the cyclic poly // Just print some of the most trivial { dup :n "Number of combinations with " Print "colors = " perm subsub print "\n" } :sub2 1 sub2 2 sub2 3 sub2 4 sub2 5 sub2 6 sub2 7 sub2 "In a 3-coloring of a cube, here's how many distinct cases there are\n" "with 2 black, 1 cyan (b^2c), 2 black, 2 cyan (b^2c^2) etc.\n" perm (b+c+1) &a_1 substit (b^2+c^2+1) &a_2 substit (b^3+c^3+1) &a_3 substit (b^4+c^4+1) &a_4 substit (b^5+c^5+1) &a_5 substit (b^6+c^6+1) &a_6 substit dup print "\nCheck that these add to the number (57) given above:\n" 1 &b substit 1 &c substit print 0 Varnamemode "\nExample 2: Print Pascal's Triangle\n" 0 :a { a :b 11 a - :c { " " c 1 - dup :c } untilneg { a b dup 1 - :b bincoef print b } untilneg "\n" 11 a 1 + dup :a - } untilneg // Example 3 --- Solve the system of equations which // are the 16-point 2D analog of Key's 4-point 1D // system. Briefly, the task is to construct a compact // symmetric 2-D spline which is differentiable everywhere. "\nExample 3: Solve a system of simple differential equations\n" // We need more than the default number of variables here, // so we start by increasing that. 130 Maxvar // Three schema for the output spline (a_1x^3y^3 + b_1x^3y^2 + c_1x^3y + d_1x^3) (e_1x^2y^3 + f_1x^2y^2 + g_1x^2y + h_1x^2) (m_1xy^3 + n_1xy^2 + p_1xy + q_1x) (r_1y^3 + s_1y^2 + t_1y + u_1) + + + :P1 (a_2x^3y^3 + b_2x^3y^2 + c_2x^3y + d_2x^3) (e_2x^2y^3 + f_2x^2y^2 + g_2x^2y + h_2x^2) (m_2xy^3 + n_2xy^2 + p_2xy + q_2x) (r_2y^3 + s_2y^2 + t_2y + u_2) + + + :P2 (a_3x^3y^3 + b_3x^3y^2 + c_3x^3y + d_3x^3) (e_3x^2y^3 + f_3x^2y^2 + g_3x^2y + h_3x^2) (m_3xy^3 + n_3xy^2 + p_3xy + q_3x) (r_3y^3 + s_3y^2 + t_3y + u_3) + + + :P3 // Rename the solve-in-terms-of variables P2 &d_4 &d_2 Substit :P2 P3 &b_4 &b_3 Substit :P3 P3 &f_4 &f_3 Substit :P3 // Form the various constraints // When both x and y are stripped from an equation // it can be sent directly to the linear-solver // with "Equal". // Otherwise we will generate multiple (x,y)-free // constraints from it with a local macro, "Eqresolve." P1 &z &x Substit &x &y Substit &y &z Substit P1 - :Eq1 P3 &z &x Substit &x &y Substit &y &z Substit P3 - :Eq2 P3 0 &x Substit 0 &y Substit 1 Equal // Eq3 P3 1 &x Substit 0 &y Substit 0 Equal // Eq4 P3 1 &x Substit 1 &y Substit 0 Equal // Eq5 P2 2 &x Substit :Eq6 P1 2 &x Substit :Eq7 P1 1 &y Substit P2 1 &y Substit - :Eq8 P3 1 &x Substit P2 1 &x Substit - :Eq9 // Here's a more readable form of these equations I prepared // for a LaTex paper. (This was a real problem.) // Eq1 P_1(x, y) & = & P_1(y, x) // Eq2 P_3(x, y) & = & P_3(y, x) // Eq3 P_3(0, 0) & = & 1 // Eq4 P_3(1, 0) & = & 0 // Eq5 P_3(1, 1) & = & 0 // Eq6 P_2(2, y) & = & 0 // Eq7 P_1(2, y) & = & 0 // Eq8 P_2(x, 1) & = & P_1(x, 1) // Eq9 P_3(1, y) & = & P_2(1, y) // I've not yet ported the term-matching routines // to this Forth-like version, because // there's a simple brute-force replacement: { dup 0 &x Substit 0 &y Substit 0 Equal dup 0 &x Substit 1 &y Substit 0 Equal dup 0 &x Substit 2 &y Substit 0 Equal dup 0 &x Substit 3 &y Substit 0 Equal dup 1 &x Substit 0 &y Substit 0 Equal dup 1 &x Substit 1 &y Substit 0 Equal dup 1 &x Substit 2 &y Substit 0 Equal dup 1 &x Substit 3 &y Substit 0 Equal dup 2 &x Substit 0 &y Substit 0 Equal dup 2 &x Substit 1 &y Substit 0 Equal dup 2 &x Substit 2 &y Substit 0 Equal dup 2 &x Substit 3 &y Substit 0 Equal dup 3 &x Substit 0 &y Substit 0 Equal dup 3 &x Substit 1 &y Substit 0 Equal dup 3 &x Substit 2 &y Substit 0 Equal dup 3 &x Substit 3 &y Substit 0 Equal pop } :Eqresolve Eq1 Eqresolve Eq2 Eqresolve { dup 0 &y Substit 0 Equal dup 1 &y Substit 0 Equal dup 2 &y Substit 0 Equal dup 3 &y Substit 0 Equal pop } :Eqresolve Eq6 Eqresolve Eq7 Eqresolve Eq8 &y &x Substit Eqresolve Eq9 Eqresolve // Now generate the derivatives, and the derivative-based constraints P1 &y Deriv :DyP1 P2 &y Deriv :DyP2 P3 &y Deriv :DyP3 P1 &x Deriv :DxP1 P2 &x Deriv :DxP2 P3 &x Deriv :DxP3 DyP2 0 &y Substit :Eq10 DyP3 0 &y Substit :Eq11 DxP1 2 &x Substit :Eq12 DxP2 2 &x Substit :Eq13 DxP2 1 &x Substit DxP3 1 &x Substit - :Eq14 DyP2 1 &y Substit DyP1 1 &y Substit - :Eq15 // Eq10 D_y P_2(x,y)_{(y\!=\!0)} & = & 0 // Eq11 D_y P_3(x,y)_{(y\!=\!0)} & = & 0 // Eq12 D_x P_1(x,y)_{(x\!=\!2)} & = & 0 // Eq13 D_x P_2(x,y)_{(x\!=\!2)} & = & 0 // Eq14 D_x P_2(x,y)_{(x\!=\!1)} & = & // D_x P_3(x,y)_{(x\!=\!1)} // Eq15 D_y P_2(x,y)_{(y\!=\!1)} & = & // D_y P_1(x,y)_{(y\!=\!1)} Eq10 &y &x Substit Eqresolve Eq11 &y &x Substit Eqresolve Eq12 Eqresolve Eq13 Eqresolve Eq14 Eqresolve Eq15 &y &x Substit Eqresolve // The next command solves the system of linear equations Linsolve // Re-initialize the solver in case we want to solve // another system in this program. Linclear // Example 4 --- Compute the probability that N uniform // variables x_i, |x_i| < 1, have a sum s, |s| < 1. "\nExample 4: Integrate a multi-dimensional spline\n" 1 BBVheuristic // This example is the only one that requires much compute time. // We drop Maxvar down to speed things up (actually Maxvar=2 would // be enough, but they'd have to be a,b and y,z seem more approp.) 26 Maxvar // Construct a 4-spline of triangular shape (-2-y) (0) (-y) (2+y) (2-y) (2-y) (0) Condi Condi Condi (1/2) Times 8 dup :bound 1 - :cntr // A print subroutine { "Chance that a" bound cntr - Print "-sum rounds properly = " Dup Print " = " (1.0) Times Print "\n" } :Jshow // A subroutine to take a definite integral { &y Substit Dup (-1) 1 &z Defint :Jkeep 0 &y Substit 0 &z Substit Jshow Jkeep (1/2) Times } :Jsub // A loop { (y+z) Jsub cntr 1 - dup :cntr } untilneg // Terminate this demonstration of MathSolver Exit
Here's the output from the sample input.
Example 1: Manipulate the cyclic-index poly of a permutation group The cube's cyclic polynomial is (1/24 a_1^6 + 1/8 a_1^2 a_2^2 + 1/4 a_1^2 a_4 + 1/4 a_2^3 + 1/3 a_3^2) Number of combinations with 1colors = (1) Number of combinations with 2colors = (10) Number of combinations with 3colors = (57) Number of combinations with 4colors = (240) Number of combinations with 5colors = (800) Number of combinations with 6colors = (2226) Number of combinations with 7colors = (5390) In a 3-coloring of a cube, here's how many distinct cases there are with 2 black, 1 cyan (b^2c), 2 black, 2 cyan (b^2c^2) etc. (1 b^6 + 1 b^5 c + 1 b^5 + 2 b^4 c^2 + 2 b^4 c + 2 b^4 + 2 b^3 c^3 + 3 b^3 c^2 + 3 b^3 c + 2 b^3 + 2 b^2 c^4 + 3 b^2 c^3 + 6 b^2 c^2 + 3 b^2 c + 2 b^2 + 1 b c^5 + 2 b c^4 + 3 b c^3 + 3 b c^2 + 2 b c + 1 b + 1 c^6 + 1 c^5 + 2 c^4 + 2 c^3 + 2 c^2 + 1 c + 1) Check that these add to the number (57) given above: (57) Example 2: Print Pascal's Triangle 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 1 7 21 35 35 21 7 1 1 8 28 56 70 56 28 8 1 1 9 36 84 126 126 84 36 9 1 1 10 45 120 210 252 210 120 45 10 1 1 11 55 165 330 462 462 330 165 55 11 1 Example 3: Solve a system of simple differential equations Solution to system of linear equations: u_3 = (1) d_3 = (1 d_4 + 2) a_3 = (-2 b_4 + -1 f_4 + 1) d_1 = (36 b_4 + -12 d_4 + 32 f_4 + -72) h_1 = (-176 b_4 + 56 d_4 + -156 f_4 + 348) q_1 = (272 b_4 + -80 d_4 + 240 f_4 + -528) b_1 = (49 b_4 + -19 d_4 + 44 f_4 + -102) c_1 = (-76 b_4 + 28 d_4 + -68 f_4 + 156) g_1 = (372 b_4 + -132 d_4 + 332 f_4 + -756) r_3 = (1 d_4 + 2) h_3 = (-1 d_4 + -3) q_3 = (0) c_3 = (0) e_3 = (1 b_4) g_3 = (0) h_2 = (-5 d_4) a_2 = (-6 b_4 + 2 d_4 + -5 f_4 + 9) b_2 = (5 b_4 + -2 d_4 + 4 f_4 + -6) c_2 = (0) r_1 = (36 b_4 + -12 d_4 + 32 f_4 + -72) a_1 = (-10 b_4 + 4 d_4 + -9 f_4 + 21) e_1 = (49 b_4 + -19 d_4 + 44 f_4 + -102) m_1 = (-76 b_4 + 28 d_4 + -68 f_4 + 156) s_1 = (-176 b_4 + 56 d_4 + -156 f_4 + 348) f_1 = (-240 b_4 + 90 d_4 + -215 f_4 + 495) n_1 = (372 b_4 + -132 d_4 + 332 f_4 + -756) q_2 = (8 d_4) e_2 = (29 b_4 + -9 d_4 + 24 f_4 + -42) f_2 = (-24 b_4 + 9 d_4 + -19 f_4 + 27) g_2 = (0) t_2 = (0) m_3 = (0) p_2 = (0) t_3 = (0) n_3 = (0) p_3 = (0) t_1 = (272 b_4 + -80 d_4 + 240 f_4 + -528) m_2 = (-44 b_4 + 12 d_4 + -36 f_4 + 60) p_1 = (-576 b_4 + 192 d_4 + -512 f_4 + 1152) u_2 = (-4 d_4) n_2 = (36 b_4 + -12 d_4 + 28 f_4 + -36) s_3 = (-1 d_4 + -3) r_2 = (20 b_4 + -4 d_4 + 16 f_4 + -24) s_2 = (-16 b_4 + 4 d_4 + -12 f_4 + 12) u_1 = (-128 b_4 + 32 d_4 + -112 f_4 + 240) Example 4: Integrate a multi-dimensional spline Chance that a (1)-sum rounds properly = (1) = (1.000000) Chance that a (2)-sum rounds properly = (3/4) = (0.750000) Chance that a (3)-sum rounds properly = (2/3) = (0.666667) Chance that a (4)-sum rounds properly = (115/192) = (0.598958) Chance that a (5)-sum rounds properly = (11/20) = (0.550000) Chance that a (6)-sum rounds properly = (5887/11520) = (0.511024) Chance that a (7)-sum rounds properly = (151/315) = (0.479365) Chance that a (8)-sum rounds properly = (259723/573440) = (0.452921) Terminated by Exit command