Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is that what you assume to be "Simple" and what MMA assumes to be simple are two different things. Taking a look at <a href="http://reference.wolfram.com/mathematica/ref/ComplexityFunction.html" rel="nofollow">ComplexityFunction</a> indicates that MMA primarily looks at "LeafCount". Applying LeafCount gives:</p> <pre><code>In[3]:= Abs[q + I w] // LeafCount Out[3]= 8 In[4]:= Sqrt[q^2 + w^2] // LeafCount Out[4]= 11 </code></pre> <p>So, MMA considers the <code>Abs</code> form to be better. (One can visually explore the simplicity using either TreeForm or FullForm). What we need to do is tell MMA to treat MMA as more expensive. To do this, we take the example from <a href="http://reference.wolfram.com/mathematica/ref/ComplexityFunction.html" rel="nofollow">ComplexityFunction</a> and write:</p> <pre><code>In[7]:= f[e_] := 100 Count[e, _Abs, {0, Infinity}] + LeafCount[e] FullSimplify[Abs[q + I w], Element[{q, w}, Reals], ComplexityFunction -&gt; f] Out[8]= Sqrt[q^2 + w^2] </code></pre> <p>As requested. Basically, we are telling MMA through <code>f[e]</code> that the count of all parts of the form <code>Abs</code> should count as 100 leaves. </p> <p><strong>EDIT:</strong> As mentioned by Brett, you can also make it more general, and use <code>_Complex</code> as the rule to look for: </p> <pre><code>In[20]:= f[e_] := 100 Count[e, _Complex, {0, Infinity}] + LeafCount[e] FullSimplify[Abs[q + I w], Element[{q, w}, Reals], ComplexityFunction -&gt; f] Out[21]= Sqrt[q^2 + w^2] </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload