Question: inconsistent result involving arctan(y,x)

Consider the following expression obtained from the solve command: Note that this uses the two variable arctan function.

p:=arctan((-cos(theta)^3-(1/2)*cos(theta)^2-(1/2)*cos(theta)*((2*cos(theta)+1)*(2*cos(theta)-3)*(cos(theta)+1)^2)^(1/2)+2*cos(theta)-(1/2)*((2*cos(theta)+1)*(2*cos(theta)-3)*(cos(theta)+1)^2)^(1/2)+3/2)^(1/2), -(1/2)*cos(theta)-1/2-(1/2)*((2*cos(theta)+1)*(2*cos(theta)-3)*(cos(theta)+1)^2)^(1/2)):

#ploting the expression shows a non-zero value at theta = Pi,  however if I convert p to a function using


f:=unapply(p,theta):


# then f(Pi);  gives a value of 0

#On the other hand maximize(p,theta=3*Pi/4..5*Pi/4,location); shows a non-zero value of 4*Pi/5 at theta = Pi,  which agrees with the plot of p, namely, it returns:

-arctan((10-2*5^(1/2))^(1/2)/(5^(1/2)+1))+Pi,

{[{theta = Pi}, -arctan((10-2*5^(1/2))^(1/2)/(5^(1/2)+1))+Pi]}

Is this a bug? Or what?

Thanks, 

Edwin

Please Wait...