|
From: Barton W. <wi...@un...> - 2025-10-21 19:10:51
|
(%i2) timer(?simpprod); (%o2) [simpprod] (%i3) xxx : product(f(i),i,1,inf)$ (%i4) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i5) timer_info(); (%o5) matrix( [function, time\/call, calls, runtime, gctime], [simpprod, 1.4972326095270472*10^-4*sec, 47066, 7.046875*sec, 0], [total, 1.4972326095270472*10^-4*sec, 47066, 7.046875*sec, 0] ) Over 47,000 calls to simpprod is crazy. Let's try this again, but define infsimp to be the identity fumction: (%i1) timer(?simpprod); (%o1) [simpprod] (%i2) :lisp(defun infsimp (e) e); INFSIMP (%i2) xxx : product(f(i),i,1,inf)$ (%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i4) timer_info(); (%o4) matrix( [function, time\/call, calls, runtime, gctime], [simpprod, 4.222972972972973*10^-4*sec, 74, 0.03125*sec, 0], [total, 4.222972972972973*10^-4*sec, 74, 0.03125*sec, 0] ) Now only 74 calls to simpprod—that's too many, I think, but it's better than 47,000. ________________________________ From: Barton Willis via Maxima-discuss <max...@li...> Sent: Monday, October 20, 2025 9:21 AM To: <max...@li...> <max...@li...> Subject: [Maxima-discuss] modest calculation that calls infsimp 2.4 million times Caution: Non-NU Email If you all are looking for a puzzle that is possibly more fun than Sudoko or Queens, figure out why infsimp is called over 2.4 million times to do the following modest calculation: (%i1) timer(?infsimp)$ (%i2) xxx : product(f(i),i,1,inf)$ (%i3) xxx : subst(f(i) = product(g(k),k,1,inf), xxx)$ (%i4) xxx : subst(g(k) = product(w(m),m,1,inf), xxx)$ (%i5) timer_info(); (%o5) matrix( [function, time\/call, calls, runtime, gctime], [infsimp, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0], [total, 6.329070747905959*10^-5*sec, 2400382, 151.921875*sec, 0] ) I haven't tried to figure this out. --Barton |