Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
2

Can this fraction be simplified ?

asked 6 years ago

Florentin Jaffredo gravatar image

updated 6 years ago

During some calculations, I came across a fraction of this kind :

2+22+1

Which should be equal to 2.

I am surprised to see that Sage can't simplify this fraction with simplify_full :

( (sqrt(2)+2)/(sqrt(2)+1) ).simplify_full()

returns the same. Just to be sure:

bool( (sqrt(2)+2)/(sqrt(2)+1) == sqrt(2) )

returns true

Am I missing a simplification option ? How can I get Sage to simplify this fraction ?

To clarify, the original expression I encountered was this one :

3(x4+43(x2+6)x2+3+24x2+72)3(x5+24x3+72x)+12(x3+6x)x2+3

which is equal to 3x. Sage can show the equality, but cannot simplify the expression (but maybe it's normal, this is not as trivial as the first example...). Substituting x=1 in this formula give something very similar to the expression above.

It can be obtained with:

f = 3*(x^4+4*sqrt(3)*(x^2+6)*sqrt(x^2+3)+24*x^2+72)/(sqrt(3)*(x^5+24*x^3+72*x)+12*(x^3+6*x)*sqrt(x^2+3))
Preview: (hide)

3 Answers

Sort by » oldest newest most voted
3

answered 6 years ago

tmonteil gravatar image

updated 6 years ago

For another perspective : symbolic expression are too wide so that equaity could not be decided, in particular there can not be a consistent simplification procedure.

However, the expression you are dealing with represents an algebraic number. The field of algebraic numbers is a safer place : the problems above become decidable. So, let me suggest the following approach;

sage: a = (sqrt(2)+2)/(sqrt(2)+1)
sage: a.parent()
Symbolic Ring
sage: b = QQbar(a)
sage: b
1.414213562373095?
sage: b.parent()
Algebraic Field
sage: b.radical_expression()
sqrt(2)

Note howewer that the radical_expression method is a bit hackish and does not handle the wohle Galois theory (yet).

Preview: (hide)
link

Comments

In fact the fraction I posted was a simplified version of my expression, which also involved symbolic variables. But I figured I'd have no hope if it didn't even work with integers.

Florentin Jaffredo gravatar imageFlorentin Jaffredo ( 6 years ago )
1

Could you please provide the unsimplified version ?

tmonteil gravatar imagetmonteil ( 6 years ago )
3

answered 6 years ago

eric_g gravatar image

updated 6 years ago

As a side remark, both SymPy and Giac are able to simplify it:

sage: s = (sqrt(2)+2)/(sqrt(2)+1)
sage: s._sympy_().simplify()
sqrt(2)
sage: s._giac_().simplify()
sqrt(2)

EDIT: regarding the large fraction involving the symbolic variable x, only Giac is able to simplify it:

sage: f = 3*(x^4+4*sqrt(3)*(x^2+6)*sqrt(x^2+3)+24*x^2+72)/(sqrt(3)*(x^5+24*x^3+72*x)+12*(x^3+6*x)*sqrt(x^2+3))
sage: f._sympy_().simplify()
(3*x**4 + 72*x**2 + 3*sqrt(3*x**2 + 9)*(4*x**2 + 24) + 216)/(x*(12*sqrt(x**2 + 3)*(x**2 + 6) + sqrt(3)*(x**4 + 24*x**2 + 72)))
sage: f._giac_().simplify()
sqrt(3)/x
Preview: (hide)
link
2

answered 6 years ago

Emmanuel Charpentier gravatar image

Well... The default Sage algorithms aren't always the most efficient.However, one can try :

sage: import sympy
sage: sympy.sympify((sqrt(2)+2)/(sqrt(2)+1)).simplify()._sage_()
sqrt(2)

We also have :

sage: ((sqrt(2)+2)/(sqrt(2)+1)/sqrt(2)).canonicalize_radical()
1

as well as :

sage: from giacpy_sage import *
sage: libgiac.simplify((sqrt(2)+2)/(sqrt(2)+1)).sage()
sqrt(2)

(this one can probably be done more economically...).

HTH...

Preview: (hide)
link

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 6 years ago

Seen: 1,105 times

Last updated: Apr 26 '18