Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
$\begingroup$Restart the kernel. Something is going wrong here; maybe a hanging definition of y or z. Morever xy^2 should probably be x y^2...$\endgroup$
$\begingroup$the most likely explanation is that you defined y=x^2 and z=0 somewhere before. Use Clear[x,y,z] and try your second code again.$\endgroup$
$\begingroup$In addition, as you may already have noticed, xy^2 is the square of the variable xy, rather than xtimes the squared y. You need to either write x*y^2, or x y^2, according to your liking.$\endgroup$
Both of those functions work normally on my computer. As @halirutan has suspected, the reason seems to be that you have made some definitions on y and z, thus giving the wrong result.
y
orz
. Moreverxy^2
should probably bex y^2
... $\endgroup$y=x^2
andz=0
somewhere before. UseClear[x,y,z]
and try your second code again. $\endgroup$xy^2
is the square of the variablexy
, rather thanx
times the squaredy
. You need to either writex*y^2
, orx y^2
, according to your liking. $\endgroup$