On Jan. 21, 2012, Raymond Toy wrote
---------------------------
>You didn't take enough samples. I plotted r1(x) - r2(x) for x from %pi
>to 5. and the plot is not zero. It is zero for x from 1 to %pi.
---------------------------------------------------------------
You are right, I did not sample far enough. The two
expressions agree up to %pi, and r2(x) is undefined
for x > %pi (while r1(x) = 0 for x > %pi).
-----------------------------------------------------------
(%i1) r1(x):= realpart(1/sqrt(sin(x)))$
(%i2) r2(x) := 1/realpart(sqrt(sin(x)))$
(%i3) r1(5);
(%o3) 0
(%i4) r2(5);
expt: undefined: 0 to a negative exponent.
#0: r2(x=5)
-- an error. To debug this try: debugmode(true);
(%i5) r1(u);
(%o5) cos(atan2(0,sin(u))/2)/sqrt(abs(sin(u)))
(%i6) r2(u);
(%o6) 1/(cos(atan2(0,sin(u))/2)*sqrt(abs(sin(u))))
(%i7) r1(3);
(%o7) 1/sqrt(sin(3))
(%i8) r2(3);
(%o8) 1/sqrt(sin(3))
-------------------------
>So I guess realpart is buggy in this case, although ratsimp(r1(x)-r2(x))
>is zero.
----------------------------------
realpart looks unreliable here, but how do you get ratsimp to
give zero?
------------------------------------------------
(%i9) ratsimp(r1(u) - r2(u));
(%o9)
(cos(atan2(0,sin(u))/2)^2-1)/(cos(atan2(0,sin(u))/2)*sqrt(abs(sin(u))))
------------------------------------------
Ted