Ask Your Question
3

simplify() does not work?

asked 2011-05-04 03:35:34 -0500

ryszard314159 gravatar image

updated 2011-05-04 04:46:43 -0500

kcrisman gravatar image

I enter:

sage: a, b = var('a, b'); simplify((a + b)^2 - a^2 - 2*a*b - b^2)

and I would expect 0 (i.e. zero) as a result from simplify(), but instead I get back unmodified:

(a + b)^2 - a^2 - 2*a*b - b^2

Am I missing anything? I just started using it and it looks very promissing...

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
5

answered 2011-05-04 04:27:48 -0500

There are different simplify functions. Try this:

sage: var('a b')
(a, b)
sage: f = ((a + b)^2 - a^2 - 2*a*b - b^2)
sage: f.simplify()  # as you had
(a + b)^2 - a^2 - 2*a*b - b^2
sage: f.simplify_full()
0
edit flag offensive delete link more

Comments

To the original poster - note the 'dot' notation in this case, where f.simplify() does the same things as simplify(f).

kcrisman gravatar imagekcrisman ( 2011-05-04 04:46:55 -0500 )edit

Also note that you can type "f.simplify<tab>" to get a list of functions whose names start with "simplify". Once you've found one, like "f.simplify()" or "f.simplify_full()", I would recommend typing "f.simplify?" or "f.simplify_full?" to read the documentation.

John Palmieri gravatar imageJohn Palmieri ( 2011-05-04 06:13:26 -0500 )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

Stats

Asked: 2011-05-04 03:35:34 -0500

Seen: 309 times

Last updated: May 04 '11