Ask Your Question
3

simplify() does not work?

asked 2011-05-04 10:35:34 +0200

ryszard314159 gravatar image

updated 2011-05-04 11:46:43 +0200

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 11:27:48 +0200

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 11:46:55 +0200 )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 13:13:26 +0200 )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 10:35:34 +0200

Seen: 840 times

Last updated: May 04 '11