Ask Your Question
1

Simplifying a simple rational expression with indeterminate exponent

asked 2022-09-14 03:00:15 +0100

Jun gravatar image

updated 2022-09-14 03:01:36 +0100

((sqrt(x)/(x+1))^n * (x+1)^n).simplify_full () returns the given expression as-is, but evidently it should be simplified to sqrt(x)^n. Sage indeed does this if the x+1 is replaced by x or n by a concrete number like 10 (illustrating that sage isn't worried about division by zero, but it's something else). Is there a way to have sage simplify this?

edit retag flag offensive close merge delete

Comments

1

Try canonicalize_radical:

sage: a = (sqrt(x)/(x+1))^n * (x+1)^n                                           
sage: a.canonicalize_radical()                                                  
x^(1/2*n)
Juanjo gravatar imageJuanjo ( 2022-09-14 03:36:44 +0100 )edit

@Juanjo : you should make an answer of your comment, for the benefit of future ask.sagemath.org perusers.

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2022-09-14 08:21:16 +0100 )edit

@Emmanuel Charpentier: Done. I thought it could exist a better solution than mine.

Juanjo gravatar imageJuanjo ( 2022-09-14 12:12:45 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2022-09-14 12:11:36 +0100

Juanjo gravatar image

You could try canonicalize_radical:

sage: a = (sqrt(x)/(x+1))^n * (x+1)^n                                           
sage: a.canonicalize_radical()                                                  
x^(1/2*n)
edit flag offensive delete link more

Comments

That solves it! Thanks. Makes me wonder why simplify_"full" wouldn't do it for me, though.

Jun gravatar imageJun ( 2022-09-15 01:42:26 +0100 )edit

Because simplify_full applies, in order, the methods simplify_factorial, simplify_rectform, simplify_trig, simplify_rational and expand_sum, neither of which produces the desired effect on the symbolic expression.

Juanjo gravatar imageJuanjo ( 2022-09-15 03:45:46 +0100 )edit

What I'm saying is that I wish something like canonicalize_radical was among that list. I'm sure there are good reasons for its exclusion, but still, having to know specialized simplifiers for such an elementary rewrite is a bit frustrating.

Jun gravatar imageJun ( 2022-09-15 09:09:34 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-09-14 03:00:15 +0100

Seen: 220 times

Last updated: Sep 14 '22