Ask Your Question
1

How to simplify with Sage?

asked 2014-11-14 21:00:32 +0100

anonymous user

Anonymous

updated 2014-11-15 05:16:11 +0100

vdelecroix gravatar image

Does Sage have a function to simplify symbolic expressions in a similar way to how the other major CAS do it? I.e. use heuristics to try to come up with a form which is likely to seem simpler to humans, which is certainly subjective and cannot be done perfectly, but it's also certainly very useful.

simplify doesn't do this, and the documentation is a bit confusing: it says that f = I + x - x; simplify(f) gives I, but so does just printing f. So what's the point of simplify?

I'm sure there must be a function that does this, as I beieve Sage includes several good CAS, I just can't find it.

Some examples to try:

(sqrt(2) - 1)*(sqrt(2)+1)

1/(3*(1 + x)) - (2*x - 1)/(6*(x^2 - x + 1)) + 2/(3*(1 + ((2*x - 1)^2)/3))

(Second one taken from Mathematica documentation.)

I know I can play with expand and factor but is there a less manual way?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2014-11-15 16:19:31 +0100

tmonteil gravatar image

To complement @ndomes answer, a good way to know what can be done with an object is to give it a name:

sage: a = (sqrt(2) - 1)*(sqrt(2)+1)

then, you can access all possible methods that available for this particular object by typing a. and then the TAB key:

sage: a.<TAB>

You will see a lot of things, in particular the .full_simplify() is pretty self explanatory:

sage: a.full_simplify()
1

This will also work for the the other expression:

sage: b = 1/(3*(1 + x)) - (2*x - 1)/(6*(x^2 - x + 1)) + 2/(3*(1 + ((2*x - 1)^2)/3))
sage: b.full_simplify()
1/(x^3 + 1)
edit flag offensive delete link more
1

answered 2014-11-17 16:20:34 +0100

kcrisman gravatar image
edit flag offensive delete link more
0

answered 2014-11-14 23:01:37 +0100

ndomes gravatar image

updated 2014-11-14 23:03:13 +0100

sage: a = (sqrt(2) - 1)*(sqrt(2)+1)
sage: a.simplify_full() 
1
edit flag offensive delete link more

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: 2014-11-14 21:00:32 +0100

Seen: 27,006 times

Last updated: Nov 17 '14