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

  • SEARCH
  • Home
  • 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 8652061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:13:11+00:00 2026-06-12T14:13:11+00:00

Sympy does not seem to be able to simplify an expression where the square

  • 0

Sympy does not seem to be able to simplify an expression where the square root of a square of a variable is involved:

In [28]: a = x**2
In [29]: b = a**(1/2)
In [30]: b
Out[30]: 
    0.5
⎛ 2⎞   
⎝x ⎠   
In [31]: b.simplify()
Out[31]: 
    0.5
⎛ 2⎞   
⎝x ⎠   

I do not get this to work with other variants of simplify, in particular I would have thought that b.powsimp() should work.

In [32]: b.powsimp()
Out[32]: 
    0.5
⎛ 2⎞   
⎝x ⎠   

Does anyone know why this does not work, or what I am doing wrong?

  • 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-06-12T14:13:12+00:00Added an answer on June 12, 2026 at 2:13 pm

    There are two problems with your example.

    First sqrt(x**2)==x only for positive real numbers.

    Second, for SymPy 1/2 and 0.5 are not the same things. The first is a Rational instance, the second is a float instance.

    Finally, an example:

    >>> x = Symbol('x', real=True)
    >>> (x**2)**(1./2)
    ∣x∣**1.0
    >>> (x**2)**(S(1)/2) # S() is short for sympify()
    ∣x∣
    

    sympify transforms python objects to more adequate SymPy objects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how to simplify exponents in equations in sympy from sympy import symbols a,b,c,d,e,f=symbols('abcdef') j=(a**b**5)**(b**10)
I've found this Fiddle which does exactly what I'm after: http://jsfiddle.net/SYwpy/56/ with the exception
I did this code: from scitools.std import * from sympy import * x=Symbol('x') #Integral
For the life of me, I cannot get the SqlProfileProvider to work in an
Python: How to export Sympy image to png? Who has any idea with this?
sympy.solve() seems to give me a wrong result. There are known problems with inequalities,
As i've read in the sympy docs, the solve() command expects an equation to
Ok, I am making a program using SymPy. I use sympy.Eq, sympy.solve, and sympy.Symbol.
working on a pretty large library of controls the generic.xaml gets simpy out of
When I run yacc -d parser.y on the following file I get the following

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.