I am also trying to use Sage's built in 'taylor' command and it is also very slow.
On Tuesday, 11 June 2013 16:30:29 UTC+9:30, Asad Akhlaq wrote: > > Hi William, > > Thanks for your reply. Actually I have exponential function f(u) in > 8-dimensions and I am using the general formula for Taylor series at > available at http://en.wikipedia.org/wiki/Taylor_series (Taylor series in > several variables). I want to expand summations in this equations for up to > 6 or even more as I am using this expansion to calculate the bit error rate > for the E8 lattice. The exponential function f(u) is of the following form. > > $$ f(u) = e^{(-(3.15987540437407e-36)*(99446621081482098*u1 + > 99446621081482098*u2 + 99446621081482098*u3 + 49723310540741049*u4 + > 99446621081482098*u5 + 165744368469136820*u6 + 198893242162964181*u7 > +298339863244446264)^2 - (3.15987540437407e-38)*(1790039179466677674*u1 - > 2983398632444462490*u2 - 2983398632444462490*u3 - 1491699316222231245*u4 - > 2983398632444462490*u5 - 2320421158567915270*u6 - 1988932421629641660*u7 - > 994466210814820830)^2 - (3.15987540437407e-38)*(1790039179466677674*u1 + > 2983398632444462715*u2 + 2320421158567915470*u3 - 1491699316222231245*u4 - > 2983398632444462490*u5 - 2320421158567915270*u6 + 1988932421629641810*u7 - > 994466210814820830)^2 - (3.15987540437407e-38)*(1790039179466677674*u1 + > 2983398632444462715*u2 + 2320421158567915470*u3 - 1491699316222231245*u4 + > 4972331054074104450*u5 - 2320421158567915270*u6 + 1988932421629641810*u7 - > 994466210814820830)^2 - (3.15987540437407e-38)*(1790039179466677674*u1 + > 2983398632444462715*u2 + 2320421158567915470*u3 + 4475097948666693960*u4 + > 4972331054074104450*u5 + 5635308527950651670*u6 + 1988932421629641810*u7 - > 994466210814820830)^2 - (3.15987540437407e-38)*(1790039179466677674*u1 + > 2983398632444462715*u2 + 4972331054074104450*u3 + 4475097948666693960*u4 + > 4972331054074104450*u5 + 5635308527950651670*u6 + 1988932421629641810*u7 - > 994466210814820830)^2 - (3.15987540437407e-36)*(99446621081482098*u1 + > 99446621081482098*u2 + 99446621081482098*u3 + 49723310540741049*u4 + > 99446621081482098*u5 + 165744368469136820*u6 - 198893242162964166*u7 - > 397786484325928347*u8 + 298339863244446264)^2 - > (3.15987540437407e-36)*(99446621081482098*u1 + 99446621081482098*u2 + > 99446621081482098*u3 + 49723310540741049*u4 + 99446621081482098*u5 + > 165744368469136820*u6 + 198893242162964181*u7 + 397786484325928347*u8 + > 298339863244446264)^2)}$$ > > I also tried to use simplify_full() command in sage to simplify it which > gives me a simplified form. My code for taylor expansion is as follows: > > PLM = f(u) > Taylor_Expansion = [] > #Taylor series is expanded at the origin i.e. (0,0,0,0,0,0,0,0) > b1=0;b2=0;b3=0;b4=0;b5=0;b6=0;b7=0;b8=0; > > for n1 in [0..sum_limit]: > for n2 in [0..sum_limit]: > for n3 in [0..sum_limit]: > for n4 in [0..sum_limit]: > for n5 in [0..sum_limit]: > for n6 in [0..sum_limit]: > for n7 in [0..sum_limit]: > for n8 in [0..sum_limit]: > > #const1 is the part of the Taylor series > without partial derivatives term > const1 = ((u1 - > b1)^n1*(u2-b2)^n2*(u3-b3)^n3*(u4-b4)^n4*(u5-b5)^n5*(u6-b6)^n6*(u7-b7)^n7*(u8-b8)^n8)/(factorial(n1)* > > factorial(n2)*factorial(n3)*factorial(n4)*factorial(n5)*factorial(n6)*factorial(n7)*factorial(n8)) > > f = PLM.full_simplify() > > if n8>0: > for dif8 in [1..n8]: > f = derivative(f,u8) > if n7>0: > for dif7 in [1..n7]: > f = derivative(f,u7) > if n6>0: > for dif6 in [1..n6]: > f = derivative(f,u6) > if n5>0: > for dif5 in [1..n5]: > f = derivative(f,u5) > if n4>0: > for dif4 in [1..n4]: > f = derivative(f,u4) > if n3>0: > for dif3 in [1..n3]: > f = derivative(f,u3) > if n2>0: > for dif2 in [1..n2]: > f = derivative(f,u2) > if n1>0: > for dif1 in [1..n1]: > f = derivative(f,u1) > > > ff = f > #const2 is the term with partial derivatives and after evaluation at point > (0,0,0,0,0,0,0,0) > const2 = > ff.substitute(u1=b1,u2=b2,u3=b3,u4=b4,u5=b5,u6=b6,u7=b7,u8=b8) > eqn = const1*const2 > Taylor_Expansion.append(eqn) > > The problem is that if I set sum_limit = 2, it takes hours and still no > result. For sum_limit =0,1 it is good enough to give me the results. But I > need more terms for Taylor expansion (may be sum_limit = 6 or 8). Also it > is not only one function that I have to expand. I have to find Taylor > expansion for 232 such function for one SNR value. Now if I want to > calculate BER for an SNR range 0 to 20 with a step of 2 I need an expansion > of about (232 x 10 = 2320 functions), and now it will take months and may > be a year :). After this Taylor expansion, I am integration the expansion > in 8-dim to get the BER. I also tried it in MATLAB but it is also very > slow. Is it possible to modify my code to make it fast ??? > > I hope to hear from you soon again. > Thanks > Assad > > > > On Tuesday, 11 June 2013 09:26:04 UTC+9:30, Asad Akhlaq wrote: >> >> Hi, >> >> I am expanding the Taylor series for an 8-dimensional exponential >> function and Sage is taking too much time as the the number of terms are >> increased. I am using Sage in notebook through VirtualBox. If I use Sage >> through terminal on my own PC, will it faster its execution? Any other >> suggestion to improve speed? >> >> Thanks >> Assad >> > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support?hl=en. For more options, visit https://groups.google.com/groups/opt_out.