Remove some questions in trig integration



Am Montag, den 28.12.2009, 21:54 +0100 schrieb Andrej Vodopivec:
> There is a thread at the sage-support forum about questions asked when
> integrating trig functions:
> 
> http://groups.google.com/group/sage-support/browse_frm/thread/c60c50a50c3b6ea5#
> 
> It is about questions in the integrations
> 
> (%i1) integrate(sec(t)*tan(t),t,0,%pi/3);
> Is  cos(t)  positive, negative, or zero?pos;
> (%o1) 1
> (%i2) integrate(csc(x)*cot(x),x,%pi/3,%pi/2);
> Is  sin(x)  positive, negative, or zero?pos;
> Is  sin(x+%pi/3)  positive, negative, or zero?pos;
> (%o2) 2/sqrt(3)-1
> 
> The questions come from sin-cos-intsubs1 in src/defint.lisp:
> 
> (defun sin-cos-intsubs1 (exp)
>   (let* ((rat-exp ($rat exp))
> 	 (num (pdis (cadr rat-exp)))
> 	 (denom (pdis (cddr rat-exp))))
>     (cond ((not (equal (intsubs num ll ul) 0.))
> 	   (intsubs exp ll ul))
> 	  ;; Why do we want to return zero when the denom is not zero?
> 	  ;; That doesn't seem to make sense to me (rtoy).  Checking
> 	  ;; for a zero denominator makes sense, but what we should
> 	  ;; return in that case?  0 seems like a bad choice.  $inf or
> 	  ;; $undefined seem like better choices.  Or maybe just
> 	  ;; signaling an error?
> 	  #+nil
> 	  ((not (equal ($asksign denom) '$zero))
> 	   0)
> 	  ((equal ($asksign denom) '$zero)
> 	   '$undefined)
> 	  (t (intsubs exp ll ul)))))
> 
> sin-cos-intsubs1 substitutes the limits of integration into the
> antiderivative. If the antiderivative is f(x)/g(x) and f(ll)=f(ul) it
> does a special check to see if the denominator is zero and returns
> undefined if it is.
> 
> I think there is no real reason for this check, so I propose we remove
> it. Or at least change $asksign to csign.

I have tried your suggested change and I have got no problems with the
testsuite. Furthermore I have put in a Maxima error for a zero
denominator. In the testsuite we have no example which triggers this
piece of code.

So a csign or a $csign (which does not generate an error when a complex
expressions has to be tested) might be more save.

Dieter Kaiser