Regression in integration



Looks good -- except that askequal should probably accept the same inputs
as askinteger (except possibly unknown/uk):

askinteger(a);
Is "a" an "integer"? 0;
Acceptable answers are: yes, y, Y, no, n, N, unknown, uk       <<<<



On Thu, May 23, 2013 at 12:36 PM, Barton Willis <willisb at unk.edu> wrote:

> After  fixing my code, it runs the testsuite OK with just a few problems.
>  In rtest_integrate, seven integrals differ in
> (I think) insignificant ways to the expected,  and the assumptions for two
> integrals  would need need to be changed to allow
> the testsuite to run--the assumption changes are due to weaknesses in sign.
>
> I know that asksign isn't loved by all. Nevertheless if there is support
> for the askequal & related change to the
> integrate defprop for mexpt, let me know.
>
> --Barton
>
> (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)
>            (tdpn (sub b a))
>            answer)
>           ((eq answer '$yes)
>            (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)
>   (setq n-is-minus-one ($askequal n -1))
>   (cond ((eq '$yes n-is-minus-one)
>          (logmabs x)) ; that's log(abs(x)) when logabs is true, and log(x)
> otherwise.
>         (t
>          (setq n (add n 1))
>          (div (take '(mexpt) x n) n))))
>
> (putprop 'mexpt `((x n) ,(lambda (x n) (integrate-mexpt x n))) 'integral)
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>