On Wednesday, July 2, 2014 6:32:56 AM UTC-7, Harsh Gupta wrote: > > The last meeting with Matthew implanted a really cool idea about solving > equations. Suppose we have an equation f(x) which has finitely many > solution > a1, a2, a3, ... an. Then we can say that the solutions of equation f(x) = > 0 are > equivalent to the solutions of the equation `(x - a1)*(x - a2) ... (x - an) > = 0`. Where it is trivial to extract the set {a1, a2, ... , an} from the > final > equation. > I don't see that this buys you anything more powerful than a structure that says the solution set is x=a1 OR x=a2 or x=a3.... ... another kind of equation and if you get to an infinite set, having a notation (Not a product...) for a set {n*pi | n in integers} would be more generally useful..
This heuristic stuff really can be replaced by patterns for different classes of problems, and the strategy of top-down recursive decomposition enables you to do whatever you are likely to come across as a method. For many people the interesting parts of solving are those which have to do with algorithms that can be done more or less efficiently when the obvious way is very inefficient. The ideas is to see equation solving techniques as transformation on > equations > which takes an equation as input and produces a *simpler* equation which > has > the same solutions as the input. Since both the input and output of the > transformations is a function we can run one transformation on top or > another or > recursively on in many other ways, until we get a equation which can be > trivially solved. > > There are three parts of this method: > - Transformation techniques > - Search method that will that decide the order of transformations and > produce > the trivial equation. > - A Trivial equation solver. > > > Transformation Techniques > ------------------------- > > Some solving techniques can be, I have given a two letter acronym to each > technique: > - Polynomial technique (PT): > f((g(x)) => (g(x) - a1)*(g(x) - a2)*(g(x) - a3) > where f is a polynomial > - Inversion of function (IF): > f(x) - a => x - finv(a) > - factor (FT): > a(x) + b(x) => f(x)*g(x) > - powsimp (PS): > a b (a + b) > x * x => x > - trigsimp (TS): > sin(x) + cos(x) => sqrt(2)*sin(x + pi/4) > - Write as tan (WT): > 2⎛x⎞ ⎛x⎞ > - tan ⎜─⎟ + 1 2⋅tan⎜─⎟ > ⎝2⎠ ⎝2⎠ > sin(x) + cos(x) => ───────────── + ─────────── > 2⎛x⎞ 2⎛x⎞ > tan ⎜─⎟ + 1 tan ⎜─⎟ + 1 > ⎝2⎠ ⎝2⎠ > > - Write as exp (WE): > > ⎛ ⅈ⋅x -ⅈ⋅x⎞ ⅈ⋅x -ⅈ⋅x > ⅈ⋅⎝ℯ - ℯ ⎠ ℯ ℯ > sin(x) + cos(x) => - ──────────────── + ──── + ───── > 2 2 2 > > > Search Method > ------------- > > Here we can emulate our current method of solving. > > ``` > def solve_univariate(f, x): > """ Returns a trivally solvable equation for f """ > if f.is_function: > f = IF(f) > if is_trigonometric_function: > f = WT(f) > . > . > . > > if is_trivial_equation(f): > # some additional conditions have to be entered here > # to avoid infinite recursion > return solve_univariate(f) > ``` > > > There is another really cool thing we might be able do. If we can assign > values > of equations according their *solvability* we might be able to implement > a search strategy to minimize the value of function, leading us to the > trivial equation. > We can assign the cost function on the basis of: > - number of args of Add, > - no of args of mul, > - depth of composition > - form of solution > The cost function can be designed on the following rules derived from > intuition: > - Mul should be preferred over Add. Ex. (x - 1)*(x - 2) is preferred over > x**2 - 3*x + 2. > - Polynomials are preferred over transcendental functions. Ex. x - 1 is > preferred over exp(x) - E > - instances of a single function are preferred over that of multiple > functions. 1 - cos(x)**2 + cos(x) is preferred over sin(x)**2 + cos(x) > - Composition of function is preferred over Mul or Add. Ex. > sqrt(2)*sin(x + pi/2) is preferred over sin(x)*cos(x) > > > The trivial equation solver > ---------------------------------------- > All of equation of form (x - a1)*(x - a2) ... (x - an)` will be considered > trivial. Which will have a solution {a1, a2, a3, ..., an}. > > > Solving equations with infinitely many solutions > -------------------------------------------------------------------- > The trivial equation corresponding to `tan(x) = 0` is `...(x - pi)*x*(x + > pi) > ...` or ` which has infinitely many terms. We can represent this by the > `Product` class available with us. If the `Product` class works out well > this method will generalize to infinitely many solutions too. > > The opinions and ideas of the community as invited. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/7218a91e-ff03-4597-a52a-27a914cca39e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.