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.
-s
On Tue, Aug 25, 2009 at 12:40 PM, Stefano Ferri <ferriste at gmail.com> wrote:
> I would like to know if there is a way to speed up the application of a
> limit
> on this expression. It is long, but the limit should be easily found.
>
> This is the expression (all symbols are assumed >0, except _bk, E and I are
> not %e or %i but mechanical constants):
>
> u : ((995328*sqrt(2)*l*q*A^3*E^8-5971968*l^2*q*_bk*A^2*E^7
> +5971968*sqrt(2)*l^3*q*_bk^2*A*E^6
> -3981312*l^4*q*_bk^3*E^5)
> *I^5
> +(82944*sqrt(2)*l^3*q*A^4*E^8-995328*l^4*q*_bk*A^3*E^7
> +995328*sqrt(2)*l^5*q*_bk^2*A^2*E^6
> +663552*l^6*q*_bk^3*A*E^5
> -995328*sqrt(2)*l^7*q*_bk^4*E^4)
> *I^4
> +(-41472*l^6*q*_bk*A^4*E^7+48384*sqrt(2)*l^7*q*_bk^2*A^3*E^6
> +290304*l^8*q*_bk^3*A^2*E^5
> -207360*sqrt(2)*l^9*q*_bk^4*A*E^4
> -193536*l^10*q*_bk^5*E^3)
> *I^3
> +(31104*l^10*q*_bk^3*A^3*E^5-20736*sqrt(2)*l^11*q*_bk^4*A^2*E^4
> -48384*l^12*q*_bk^5*A*E^3
> -9216*sqrt(2)*l^13*q*_bk^6*E^2)
> *I^2
> +(1296*l^12*q*_bk^3*A^4*E^5-1620*sqrt(2)*l^13*q*_bk^4*A^3*E^4
> -4968*l^14*q*_bk^5*A^2*E^3
> -1848*sqrt(2)*l^15*q*_bk^6*A*E^2
> -432*l^16*q*_bk^7*E)
> *I-81*sqrt(2)*l^15*q*_bk^4*A^4*E^4-216*l^16*q*_bk^5*A^3*E^3
> -108*sqrt(2)*l^17*q*_bk^6*A^2*E^2-48*l^18*q*_bk^7*A*E
> -4*sqrt(2)*l^19*q*_bk^8)
> /((1990656*sqrt(2)*A^4*E^9-15925248*l*_bk*A^3*E^8
> +23887872*sqrt(2)*l^2*_bk^2*A^2*E^7
> -31850496*l^3*_bk^3*A*E^6
> +7962624*sqrt(2)*l^4*_bk^4*E^5)
> *I^5
> +(-1990656*l^3*_bk*A^4*E^8+5308416*sqrt(2)*l^4*_bk^2*A^3*E^7
> -7962624*l^5*_bk^3*A^2*E^6
> +2654208*l^7*_bk^5*E^4)
> *I^4
> +(373248*sqrt(2)*l^6*_bk^2*A^4*E^7-995328*l^7*_bk^3*A^3*E^6
> -165888*sqrt(2)*l^8*_bk^4*A^2*E^5
> +663552*l^9*_bk^5*A*E^4
> +165888*sqrt(2)*l^10*_bk^6*E^3)
> *I^3
> +(-62208*l^9*_bk^3*A^4*E^6+82944*l^11*_bk^5*A^2*E^4
> +36864*sqrt(2)*l^12*_bk^6*A*E^3
> +9216*l^13*_bk^7*E^2)
> *I^2
> +(1944*sqrt(2)*l^12*_bk^4*A^4*E^5+5184*l^13*_bk^5*A^3*E^4
> +2592*sqrt(2)*l^14*_bk^6*A^2*E^3
> +1152*l^15*_bk^7*A*E^2
> +96*sqrt(2)*l^16*_bk^8*E)
> *I)$
>
>
>
> Altough it seems complicated, its limit, for _bk -> inf, is very simple:
> -l^3*q/(24*E*I). Also its computation should be simple, it is a polynomial
> and one has ony to do comparison between powers of _bk.
>
> limit is very very slow:
>
> (%i5)limit(u,_bk,inf);
> Evaluation took 440.0515 seconds (521.4141 elapsed) using 5801.038 MB.
> (%o6) -l^3*q/(24*E*I)
>
> with tlimit things go much better:
>
> (%i6) tlimit(u,_bk,inf);
> Evaluation took 5.0483 seconds (5.2660 elapsed) using 100.821 MB.
> (%o6) -l^3*q/(24*E*I)
>
>
> Terms like the one shown (u) come from a linear system resolution and are
> part
> of a vector, and sometimes, but not often, such complicated terms appear in
> my
> code and I have to to a limit on it. Because it is very slow, execution
> time
> of the code can increase from a few seconds to more than a minute.
>
> I am aware that such expression could be too long and complicated to
> handle,
> anyway I would like to know if there are some trick to speed up the
> computation (like special variables to set, or other commands I don't
> know).
> And, just for curiosity, why is tlimit so much faster than limit? How could
> a
> Taylor expansion help with such polynomials?
>
> I thougth I could factor numerator and denominator with respect to the
> powers
> of _bk, could this help the application of limit and tlimit? How could I do
> this?
>
> Thank you in advance
> Stefano
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>