Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:17:40+00:00 2026-05-31T01:17:40+00:00

Using code FullSimplify[Abs[q + I*w], Element[{q, w}, Reals]] results in Abs[q + I w]

  • 0

Using code FullSimplify[Abs[q + I*w], Element[{q, w}, Reals]] results in

Abs[q + I w]

and not

Sqrt[q^2 + w^2]

What am I missing?

P.S. Assuming[{q \[Element] Reals, w \[Element] Reals},
Abs[q + I*w]]
does not work either.
Note: Simplify[Abs[w]^2, Element[{q, w}, Reals]] and Simplify[Abs[I*q]^2, Element[{q, w}, Reals]] work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:17:42+00:00Added an answer on May 31, 2026 at 1:17 am

    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 ComplexityFunction indicates that MMA primarily looks at “LeafCount”. Applying LeafCount gives:

    In[3]:= Abs[q + I w] // LeafCount
    Out[3]= 8
    
    In[4]:= Sqrt[q^2 + w^2] // LeafCount    
    Out[4]= 11
    

    So, MMA considers the Abs 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 ComplexityFunction and write:

    In[7]:= f[e_] := 100 Count[e, _Abs, {0, Infinity}] + LeafCount[e]
    FullSimplify[Abs[q + I w], Element[{q, w}, Reals], 
     ComplexityFunction -> f]
    
    Out[8]= Sqrt[q^2 + w^2]
    

    As requested. Basically, we are telling MMA through f[e] that the count of all parts of the form Abs should count as 100 leaves.

    EDIT: As mentioned by Brett, you can also make it more general, and use _Complex as the rule to look for:

    In[20]:= f[e_] := 100 Count[e, _Complex, {0, Infinity}] + LeafCount[e]
    FullSimplify[Abs[q + I w], Element[{q, w}, Reals], 
     ComplexityFunction -> f]
    
    Out[21]= Sqrt[q^2 + w^2]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using code, I can set a UI element's background property to its default value
I'm using code that I found on the CodeProject.com for a low-level keyboard hook
I've recently started using code coverage tools (particularily Emma and EclEmma), and I really
I have been using code similar to this MessageDlg('', mtWarning, [mbOK], 0); throughout my
I'm using code that takes a bitmap and converts it to 24 BPP so
I'm using code in the Application_BeingRequest() handler of my Global.asax to do some very
How do I close (using code) the last created CView in my MDI app.
My main solution is using code from a utility class library, that I wrote
I am currently using code similar to this: try { // IE ONLY var
I'm newly using CODE::BLOCKS+mingw compiler If I don't type return 0 at the end

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.