Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: SourceForge.net <noreply@so...>  20071227 02:38:45

Bugs item #580721, was opened at 20020712 19:38 Message generated for change (Comment added) made by rswarbrick You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=580721&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core  Trigonometry Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Raymond Toy (rtoy) Assigned to: Nobody/Anonymous (nobody) Summary: trigexpand bug Initial Comment: Consider this: (C1) display2d:false; (D1) FALSE (C2) tan(%pi/2+x); (D2) COT(x) (C3) tan(%pi/2+%pi*x); (D3) TAN(%PI*x+%PI/2) (C4) %,trigexpand; Division by 0  an error. Quitting. To debug this try DEBUGMODE(TRUE);) d3 should have been expanded into cot(%pi*x) instead of getting a division by zero error.  Comment By: Rupert Swarbrick (rswarbrick) Date: 20071227 02:38 Message: Logged In: YES user_id=1673565 Originator: NO So the first thing that's wrong is that %piargstan/cot shouldn't return nonnil for stuff like tan(pi/2) as they aren't defined, let alone simplifiable. Here's an amended and reformatted version with variables renamed and a possible bug due to reuse of variable names eliminated too (I think) (defun %piargstan/cot (x) (displa x) (let ((coeff (linearize (coefficient x '$%pi 1))) (zlrem (coefficient x '$%pi 0)) (sinofcoeffpi) (cosofcoeffpi)) (cond ((and (zerop1 zlrem) (setq sinofcoeffpi (%piargs coeff nil)) (not (zerop1 (setq cosofcoeffpi (%piargs (cons (car coeff) (rplus 1//2 (cdr coeff))) nil))))) ;; sinofcoeffpi and cosofcoeffpi are only nonnil if they ;; are constants that %piargsoffset could compute, and we just ;; checked that cosofcoeffpi was nonzero. Thus we can just ;; return their quotient. (div sinofcoeffpi cosofcoeffpi)) ((not (mevenp (car coeff))) nil) ((integerp (setq x (mmod (cdr coeff) 2))) (consexp '%tan zlrem)) ((or (alike1 1//2 x) (alike1 '((rat) 3 2) x)) (neg (consexp '%cot zlrem))))))  Comment By: Rupert Swarbrick (rswarbrick) Date: 20071227 02:29 Message: Logged In: YES user_id=1673565 Originator: NO Ah. Of course tan(pi/2) = infinity ...  Comment By: Rupert Swarbrick (rswarbrick) Date: 20071226 01:10 Message: Logged In: YES user_id=1673565 Originator: NO Hi, a bit more information: the error's caused by a (div 1 0) which gets returned in %piargstan/cot, called by simp%tan. You can reproduce more simply by just calling tan(%pi/2), trigexpand; I'm trying to work out what the functions are _supposed_ to do. Maybe then I'll be able to fix it!  Comment By: Robert Dodier (robert_dodier) Date: 20060327 00:40 Message: Logged In: YES user_id=501686 For the record, same problem observed in maxima 5.9.3.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=580721&group_id=4933 