Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are two points to your question: 1)

cos(x+2)*cos(x)-cos(x+1)*cos(x+1)=-sin(1)^2   #i.e. a constant

(Actually one of the experts should kick in and tell us what to do to make sage simplify your expression to that. I am frequently having problems to force sage to simplify even the most trivial expressions. A tutorial on that would be nice...)

2) sage uses matplotlib to do the plotting of your expression. The automatic selection of a 'proper' y-axis extent of that can cause problems when the actual y-extent of your data is identically zero. So, do something like:

plot(cos(x+2)*cos(x)-cos(x+1)*cos(x+1),(-pi,pi),ymin=-sin(1)^2*1.1,ymax=-sin(1)^2*.9)

and you'll get: ... a nice straight line