Updates:
Labels: -Priority-Medium Priority-High
Comment #5 on issue 1172 by ondrej.certik: example: curve sketching
http://code.google.com/p/sympy/issues/detail?id=1172
Bisecting on the following code:
from sympy import *
var("x y a")
f = 4*x*(1 - a*x**(S(1)/2))
print solve(f, x)
reveals:
$ git bisect good
367cfe447239ba50ece25af604ddc42588f4f949 is first bad commit
commit 367cfe447239ba50ece25af604ddc42588f4f949
Author: Fabian Seoane <[email protected]>
Date: Sun Nov 16 20:35:45 2008 +0100
Support for more types of expressions in solve
For this, a guess_solve_strategy method was added
Before of this, solve() parsed the expression searching for a polynomial
and if this parse failed, it just called tsolve.
Now the expression is parsed, and while parsing the best algorithm is
selected for that particular expression, i.e. not only it is
conceptually
clearer and easier to extend, but there is no need to parse the entire
expression to decide what strategy to use.
New features
============
- Support for more expressions, mostly expressions that can
be transformed to polynomial expressions using simple changes of
variables. These incluide:
- x**(p1/q1) + x**Rational(p2/q2) + ...
- x**-n1 + x**-n2 + ...
- P(x)/Q(x) (rational functions)
- tsolve now returns a tuple of expressions instead only one
expression.
- It is easy to add new types of functions. See docstring of
solve and guess_solve_strategy for more info
- Test for all new types of supported expressions
Performace
==========
- If it is a polynomial, it will partially parse the expression
twice,
since it will parse the polynomial inside guess_solve_strategy to
determine the solve strategy and then it will be parsed again in
solve.
- In other cases, it can be faster or it can be slower. For
trascebdental
functions it will generally be faster, since there is no need to
parse the expression completely
Random notes
============
- The change of variable could be computed during the parse of
guess_solve_strategy, and so we could avoid to partially parse
the expression twice. I didn't implement this because it would
make the code more complex, it is nice right now that functions
guess_solve_strategy and solve have a clear separate entity.
Plus, parsing the expression twice is not a bit issue since
the parsing is fast, O(n) typically, where n is the number of
arguments
for the expression, and most of the time is spended in simplify
and in subs
:040000 040000 9f8665b2c5e1f248df3990f97f7c5dcc6d17e26f
890094e2118fefc73b88624f79487cbcdc95c760 M sympy
But previously it returned:
$ python t.py
[0]
which is not the only solution. So it's wrong, isn't it?
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---