Limit applyed to a very long expression




On Tue, 25 Aug 2009, Stefano Ferri wrote:

< > Why not just stick to tlimit?  Tlimit uses taylor, which uses rational
< > representation (CRE), a good form for manipulating polynomial-like objects.
< > Limit uses general representation, which can be much slower.
< > By the way, on my machine (which is not especially fast -- 2 Ghz 3Gb
< > Windows GCL Maxima 5.17.1), the tlimit time is only 0.75 sec, so I'm
< > surprised it takes 5 sec on your machine.
< 
< I was only to do a further improvement, if possible, but I can use tlimit with 
< no problem :-)
< The fact your execution time is only 0.75 s is a good news. My machine is not 
< that fast, it is a notebook with an athlon-xp 2800+ and 512 mb RAM 5 years 
< old, and Maxima is compiled with CLISP (which seems to be slower than other 
< Lisp  implementations).
< Thank you for explaining me something about tlimit.
< 
< Stefano
< 
< >
< > By the way, on my machine (which is not especially fast -- 2 Ghz 3Gb
< > Windows GCL Maxima 5.17.1), the tlimit time is only 0.75 sec, so I'm
< > surprised it takes 5 sec on your machine.
 
Stefano,
If your expressions are *always* rational functions of the parameter, you
can easily outperform maxima's built-in routines by using some
elementary calculus:

ratlimit(f,x,l) := block([d:denom(f),n:denom(1/f),dd],
  dd : hipow(d,x),
  d : tlimit(x^(-dd)*d,x,l),
  n : tlimit(x^(-dd)*n,x,l),
  n/d)$

(%i28) tlimit(u,_bk,inf);
Evaluation took 5.2300 seconds (5.2300 elapsed) using 116.604 MB.
(%o28) -l^3*q/(24*E*I)
(%i29) ratlimit(u,_bk,inf);
Evaluation took 0.1800 seconds (0.1800 elapsed) using 2.770 MB.
(%o29) -l^3*q/(24*E*I)

Leo



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.