# Revision history [back]

You must have forgotten the multiplication sign *. Quite obviously, $(c^2+d^2)$ was substituted for $a$ in the expression, thus you got $(c^2+d^2)^2 + b^2$. If you are using a recent version of Sage, you must have gotten a warning when evaluating the expression, saying that the correct form for expression substitution is

(a^2 + b^2)(a=(c^2 + d^2))


In Sage 6.4.1

sage: var('a,b')
(a, b)
sage: (a+b)(a+b)
/home/dfl/sage/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py:2883: DeprecationWarning:
Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future
release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)
See http://trac.sagemath.org/5930 for details.
exec(code_obj, self.user_global_ns, self.user_ns)
a + 2*b
sage: (a+b)*(a+b)
(a + b)^2