Ask Your Question

Erlend M. Viggen's profile - activity

2021-12-09 09:40:16 +0200 received badge  Nice Question (source)
2021-12-06 11:28:26 +0200 commented answer Some straightforward square root fractions are not simplified

Thanks! The takeaway message, the way I see it as a Sage beginner, is that it can always be useful to check with Sympy i

2021-12-06 11:25:59 +0200 marked best answer Some straightforward square root fractions are not simplified

I'm a Sage beginner who's trying to apply it to a set of equations I'm working on. In that process, I came across an issue where SageMath 9.4 is not simplifying some very straightforward square root fractions in my expressions. Let me show you a minimal example:

x = var('x')
sqrt(1-x)/(1-x)

$$-\frac{\sqrt{-x + 1}}{x - 1}$$

What I was expecting to get, of course, is $1 / \sqrt{1 - x}$. Calling simplify() or full_simplify() on the expression doesn't make a difference; I still get the same thing out. I experimented with other square root fractions as well to see if this issue recurs:

sqrt(x)/x

$$1/\sqrt{x}$$

sqrt(1+x)/(1+x)

$$1/\sqrt{1+x}$$

sqrt(x-1)/(x-1)

$$1/\sqrt{x-1}$$

So in other words, Sage automatically simplifies all of the other expressions I tried in exactly the way that I would expect. To try out things a bit further, I tried to see if it helps to apply Sympy:

( sqrt(1-x)/(1-x) )._sympy_().simplify()

$$1/\sqrt{1-x}$$

That works. (The simplify() argument is essential here; otherwise, the fraction is not automatically simplified.)

So, is there some subtle finesse here that I'm not understanding, or did I stumble across a bug in Sage's simplification algorithms?

2021-12-06 11:25:59 +0200 received badge  Scholar (source)
2021-12-06 11:25:56 +0200 received badge  Supporter (source)
2021-12-03 18:29:18 +0200 received badge  Student (source)
2021-12-03 18:27:38 +0200 asked a question Some straightforward square root fractions are not simplified

Some straightforward square root fractions are not simplified I'm a Sage beginner who's trying to apply it to a set of e