From: Barton W. <wi...@un...> - 2025-04-08 13:49:34
|
I don't that that any simplim%function should return (minf, zerob, zeroa, ind, und, inf, or infinity). And I don't think that a simplifier should have to handle those cases either. Plus I think that zeroa and zerob should be internal to the limit code, not user-level symbols. I didn't try all that much, but I did not discover how Maxima converts elliptic_kc(zeroa) to %pi/2. The testsuite never calls simplim%elliptic_kc. I'm not sure about the option variable preserve-direction, but here is a starting point for a better simplim%elliptic_kc function: (defun simplim%elliptic_kc (expr var val) ;; Look for the limit of the argument (let ((dir) (m (let ((preserve-direction t)) (limit (cadr expr) var val 'think)))) (cond ((onep1 m) (setq dir (behavior (cadr expr) var val)) ;; elliptic_kc(1^(-)) = inf; ellitic(1^(+)) = infinity (if (eql dir -1) '$inf '$infinity)) ;; elliptic_kc(minf) = zeroa ((eq m '$minf) (if preserve-direction '$zeroa 0)) ;; elliptic_kc(inf) = infinity ((eq m '$inf) '$infinity) ;; elliptic_kc(und) = und. Or should this throw an error? ((eq m '$und) '$und) ;; when Maxima can determine that 1 isn't in the range of expr and ;; m = ind, return ind; otherwise return und ((eq m '$ind) (if (eq t (mnqp (cadr expr) 1)) '$ind '$und)) ;; elliptic_kc is continous and nonzero at 0 ((or (eq m '$zerob) (eq m '$zeroa)) (ftake '%elliptic_kc (ridofab m))) (t ;; All other cases are handled by the simplifier of the function. (ftake '%elliptic_kc m))))) ________________________________ From: Raymond Toy <toy...@gm...> Sent: Monday, April 7, 2025 4:40 PM To: Barton Willis <wi...@un...>; max...@li... <max...@li...> Subject: Re: [Maxima-discuss] simplimit function vs simplimit%fun property Caution: Non-NU Email On 4/7/25 10:05 AM, Barton Willis wrote: The CL function ridofab (get rid of zeroa and zerob) substitutes zero for zerob and zeroa ; example: (%i17) limit(elliptic_kc(m), m, 0, 'plus); 1 Call ridofab [elliptic_kc(zeroa)] 1 Return ridofab %pi/2 Yeah, I see that. I guess I’ll have to do some digging to see how ridofab gets called. From my own tracing, it’s called after the simplim for elliptic_kc has returned with a value of elliptic_kc(zeroa). (%o17) %pi/2 Converting simplim%tan to use the symbol property dispatch mechanism should be fairly easy (and to not use the special variables var and val) . Converting all the special cases in simplimit to use the symbol property dispatch would be a larger effort—these functions are not written in in a consistent fashion. Yep. And they use the same simplim function for different functions. I probably won’t convert those for a while. ​ |