Hi,

On 23 June 2012 08:55, Aaron Meurer <[email protected]> wrote:

> On Jun 22, 2012, at 10:13 PM, Mateusz Paprocki <[email protected]> wrote:
>
> Hi,
>
> On 23 June 2012 01:25, [email protected] <
> [email protected]> wrote:
>
>> > simplify() is kind of a "catch all" simplification function, so
>> > perhaps it should include refine() as well. refine() is still
>> > relatively new, so I don't think it's been fleshed out beyond
>> > "assumptions based simplification".
>>
>> Can we make this statement "the official rule"? I mean can we promise
>> that:
>>
>> - "simplify() makes only general simplifications without checking
>> assumptions"
>> - "refine() makes only assumptions based simplifications"
>>
>
> We had this discussion with Ondrej some time ago and the conclusion, as
> far I remember, is as follows. refine() takes an expression and rewrites it
> to a new form wrt assumptions. This usually means that the new expression
> will be shorter than the old one but refine() doesn't measure that, nor
> takes any measures to optimize the size. simplify() can also take
> assumptions into account (or actually output from refine()), but it is an
> optimization function which (should, but it's not entirely true right now)
> find the shortest equivalent output form. It means it can't blindly apply
> math formulas as refine() can. simplify() isn't that smart currently, but
> this is how it should work. Summing up:
>
> - simplify() finds the shortest possible output form considering
> assumptions and measures of complexity
> - refine() applies assumptions to obtain specialized form of input
> expression
>
>
> +1. Can you give an example of where refine() might actually make an
> expression bigger, though?
>

Currently refine() doesn't support very many classes of expressions, so I
can't provide a working example, but I imagine this could work:

refine(norm(x), Element(x, EuclideanSpace(3))) -> sqrt(component(x, 1)**2 +
component(x, 2)**2 + component(x, 3)**2)

The output form is longer than the input form, however the output form also
can be considered simpler in the sense that it involves only elementary
operations (sqrt, ** and component(x, i) (or x[i])).


> Aaron Meurer
>
>
>
>>
>> And consider different behavior a bug.
>>
>> Also "when and only when some kwarg with assumptions is provided to
>> simplify() it will call refine()".
>>
>> --
>> 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.
>>
>>
> Mateusz
>
> --
> 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.
>
>  --
> 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.
>

Mateusz

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

Reply via email to