Regression in integration



Rupert,

I tried the tdzero / tdpn route.  Are you sure the tdpn mechanism works? I get an infinite loop with
 integrate(a^(p*x) * b^(q*x) * c^(r*x),x).

OK:

(%i2) integrate(a^(p*x) * b^(q*x),x);
Is log(b)*q/(log(a)*p) equal to -1?
no;

No OK:

(%o2) (a^(p*x))^(log(b)*q/(log(a)*p)+1)/(log(a)*p*(log(b)*q/(log(a)*p)+1))
(%i3) integrate(a^(p*x) * b^(q*x) * c^(r*x),x);

Is log(c)*r/(log(a)*p)+log(b)*q/(log(a)*p) equal to -1?
no;

Is log(c)*r/(log(a)*p)+log(b)*q/(log(a)*p) equal to -1?
no;

Is log(c)*r/(log(a)*p)+log(b)*q/(log(a)*p) equal to -1?
no;

/* Give up and answer yes: */

Is log(c)*r/(log(a)*p)+log(b)*q/(log(a)*p) equal to -1?
yes;

(%o3) x

--Barton

My code
(defun $askequal (a b)
  (let ((answer (meqp a b))) ; presumably handles mbags and extended reals.
    (setq answer
	  (cond ((eq answer t) '$yes)
		((eq answer nil) '$no)
		(t (retrieve `((mtext) "Is " ,a " equal to " ,b "?") nil))))
    
    (cond ((eq answer '$no)
	   (print "no branch")
	   (tdpn (sub a b))
	   answer)
	  ((eq answer '$yes)
	   (print "yes branch")
	   (tdzero (sub a b))
	   answer)
	  (t  
	   (mtell "Please answer either yes or no.")
	   ($askequal a b)))))
 
;; integrate(x^n,x) = if n # -1 then x^(n+1)/(n+1) else logmabs(x).

(defun integrate-mexpt (x n n-is-minus-one)
  (cond ((or (eq '$yes n-is-minus-one) (eq t (meqp n -1)))
	 (logmabs x)) ; that's log(abs(x)) when logabs is true, and log(x) otherwise.
	((eq (eq '$no n-is-minus-one) (mnqp n -1))
	 (setq n (add n 1))
	 (div (take '(mexpt) x n) n))
	(t (integrate-mexpt x n ($askequal n -1)))))


________________________________________


Just because this is still in my head: This behaves rather differently
>From $asksign, since it doesn't remember what it's been told. I guess
you also want a call to tdzero or tdpn with the difference between the
two terms?

Rupert

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima