Ondrej Certik wrote:
> Hi Alan,
>
> a very good question, thanks for raising it.
>
> On Sun, Jan 11, 2009 at 9:33 AM, Alan Bromborsky <[email protected]> wrote:
>
>> What do we mean when we say a expression is simplified.
>>
>
> I think the docstring of simplify() answers this one.
>
> In [1]: simplify?
> Type: function
> Base Class: <type 'function'>
> String Form: <function simplify at 0x8afdae4>
> Namespace: Interactive
> File: /home/ondra/repos/sympy/sympy/simplify/simplify.py
> Definition: simplify(expr)
> Docstring:
> Naively simplifies the given expression.
>
> Simplification is not a well defined term and the exact strategies
> this function tries can change in the future versions of SymPy. If
> your algorithm relies on "simplification" (whatever it is), try to
> determine what you need exactly - is it powsimp(), or radsimp(),
> or together(), or something else? And use this particular function
> directly, because those are well defined and thus your algorithm
> will be robust.
>
>
>
>> Should we
>> define some kind of metric that says one expression is more simplified
>>
>
> Yes, that occured to me as well, we can do something more sophisticated.
>
>
>> than another. My dumb suggestion would be the simplification of an
>> expression would be the string that contains the fewest characters.
>>
>
> Either that, but it depends on how long the function (or symbol) names
> are, so a better suggestion may be the number of atomic operations in
> the expression:
>
> In [1]: a = x**2+3
>
> In [3]: len(a.atoms())
> Out[3]: 3
>
>
>
>> Could simplification methods be defined in some kind of multidimensional
>> space that could be searched for the simplest final expression. The
>>
>
> That'd be a nice addition. From the engineering point of view, sympy
> should have both ways, e.g. the constructive direct way (e.g. the
> current simplify) and then the new way.
>
>
>> main problem I have with computer algebra is that in simplifying an
>> express It is obvious to my brain what should be done, but the program
>> requires step by step instructions and the instructions are usually
>> different for each expression.
>>
>
> Exactly.
>
>
>> What is the current standard for
>> automatic simplification of finite algebraic/trigonometric/hyperbolic
>> expressions and how is it implemented?
>>
>
> There is no standard. Currently we just do our best in functions like
> trigsimp(), trim(), etc.
>
> I don't know if Mathematica (or any other CAS) has something more rigorous.
>
> Ondrej
>
> >
>
>
Here is a simple function that uses trigsimp, but seems to work better than
simply using trigsimp alone. Of course it takes longer. How difficult
would it
be to have a hypersimp for hyperbolic identities to go along with trigsimp?
def TrigSimp(f):
"""
Recursive application of sympy.trigsimp(). Works in many applications
where simple application of sympy.trigsimp() does not.
"""
(w,g) = sympy.cse(f)
g = sympy.trigsimp(g[0])
for sub in reversed(w):
g = g.subs(sub[0],sub[1])
g = sympy.trigsimp(g)
return(g)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy" 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?hl=en
-~----------~----~----~----~------~----~------~--~---