Status: Accepted
Owner: ----
Labels: Type-Enhancement Priority-Medium Simplify

New issue 2719 by [email protected]: simplify() should take complexity measure argument
http://code.google.com/p/sympy/issues/detail?id=2719

Simplicity of expressions depends on the complexity measure taken, e.g.:

In [1]: g = sin(x)**2 + cos(y)**2

In [2]: g
Out[2]:
   2         2
sin (x) + cos (y)

In [3]: h = simplify(g)

In [4]: h
Out[4]:
   2         2
sin (x) - sin (y) + 1

In [5]: g.count_ops()
Out[5]: 5

In [6]: h.count_ops()
Out[6]: 6

In [7]: measure = lambda u: len(set([ v.func for v in u.find(Function) ]))

In [8]: measure(g)
Out[8]: 2

In [9]: measure(h)
Out[9]: 1

Here we have to simple complexity measures:

1) the number of operations (.count_ops())
2) the number of distinct functions (measure())

It should be possible to issue:

simplify(g, measure=...)

(or similar) to get expressions in the desired "simple" form.

--
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.

Reply via email to