6 edited tags | link edited Nov 7 '17 at 11:42 J. M. will be back soon♦ 101k1010 gold badges317317 silver badges477477 bronze badges Tweeted twitter.com/StackMma/status/877877146114379776 occurred Jun 22 '17 at 13:13 Post Reopened by Carl Woll, bbgodfrey, Artes, Michael E2, Feyre occurred Jun 20 '17 at 19:56 5 complete code available to check; corrected typo; clarifications code edited Jun 20 '17 at 16:23 sam 2844 bronze badges Here, multPhi_10 is the function I am interested in expanding. cc_mult is an already made table (so no computation time there). ol_mult is some numberNote that isP\[Phi] contains negative powers of $$y$$. That's why, when evaluating the ordercoefficients of this Laurent series, I multiply by the range$$y^{-o}$$, to shift the powers of n and m$$y$$ to be all positive. you may also ignoreOnly then can the TrigtoExpCoefficientList be used.\[CapitalPhi] is the function I am interested in expanding. The rest of the code I hope speaks for itself The twice appearance of series is to have mathematica expand in such a way that it organizes the expression nicely, e.g. $$p(q(y^2+y+...) + q^2 (\text{pol}(y))+ ...)) + p^2(...)$$ I am interested in speeding up the code, as at the moment taking the rangesgetting to order 7 in $$p$$ and expanding to 7th order$$q$$ is taking at least hoursan hour or so. Any help would be much appreciated. Note that the provided piece of code runs up to order 6 in $$p$$ and $$q$$.To expand to higher order, not only should I change the order of Series in the last line, but also the range of $$m,n$$ in the definition of \[CapitalPhi]. Here, multPhi_10 is the function I am interested in expanding. cc_mult is an already made table (so no computation time there). ol_mult is some number that is of the order of the range of n and m. you may also ignore the TrigtoExp. The twice appearance of series is to have mathematica expand in such a way that it organizes the expression nicely, e.g. $$p(q(y^2+y+...) + q^2 (\text{pol}(y))+ ...)) + p^2(...)$$ I am interested in speeding up the code, as at the moment taking the ranges to 7 and expanding to 7th order is taking at least hours. Any help would be much appreciated. Note that P\[Phi] contains negative powers of $$y$$. That's why, when evaluating the coefficients of this Laurent series, I multiply by the $$y^{-o}$$, to shift the powers of $$y$$ to be all positive. Only then can the CoefficientList be used.\[CapitalPhi] is the function I am interested in expanding. The rest of the code I hope speaks for itself The twice appearance of series is to have mathematica expand in such a way that it organizes the expression nicely, e.g. $$p(q(y^2+y+...) + q^2 (\text{pol}(y))+ ...)) + p^2(...)$$ I am interested in speeding up the code, as at the moment taking getting to order 7 in $$p$$ and $$q$$ is taking an hour or so. Any help would be much appreciated. Note that the provided piece of code runs up to order 6 in $$p$$ and $$q$$.To expand to higher order, not only should I change the order of Series in the last line, but also the range of $$m,n$$ in the definition of \[CapitalPhi]. 4 complete code available to check; corrected typo edited Jun 20 '17 at 16:15 sam 2844 bronze badges Phi[p_\[Eta][q_] := q^(1/24)*QPochhammer[q, q]; \[Theta]1[q_, y_] := EllipticTheta[1, (1/(2*I))*Log[y], q^(1/2)]; \[Theta]2[q_, y_] := EllipticTheta[2, (1/(2*I))*Log[y], q^(1/2)]; \[Theta]3[q_, y_] := EllipticTheta[3, (1/(2*I))*Log[y], q^(1/2)]; \[Theta]4[q_, y_] := EllipticTheta[4, (1/(2*I))*Log[y], q^(1/2)]; \[Phi][q_, y_] := 8*((\[Theta]2[q, y]/\[Theta]2[q, 1])^2 + (\[Theta]3[q, y]/\[Theta]3[q, 1])^2 + (\[Theta]4[q, y]/\[Theta]4[q, 1])^2) P\[Phi] = Normal[(Series[#1, {q, 0, 50}, {y, 0, 50}] & )[Assuming[y > 0 && u > 0, Simplify[TrigToExp[Series[\[Phi][q, y], {q, 0, 50}]]]]]]; o = Exponent[P\[Phi], y, Min] cc = CoefficientList[P\[Phi]/y^o, {q, y}]; \[CapitalPhi][p_, q_, y_] := p*q*y*Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l - o + 7]]1]], {m, 1, 6}, {n, 1, 6}, {l, -6, o, 6-o}]*Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l+7]]l - o + 1]], {m, 0, 0}, {n, 1, 6}, {l,-6 o, 6-o}]*Product[]* Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l +7]], - o + 1]], {m, 1, 6}, {n, 0, 0}, {l, -6o,6 -o}]* Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l +7]]- o + 1]], {m, 0, 0}, {n, 0, 0}, {l, -6o,6 -1}]; expmultPhi = Normal[(Series[#1, {p, 0, 6}, {q, 0, 6}, {y, 0, 20}] & )[ Assuming[y[Assuming[y > 0 && u > 0, Simplify[TrigToExp[Series[Phi[p Simplify[TrigToExp[Series[\[CapitalPhi][p, q, y], {p, 0, 6}, {q, 0, 6}]]]]]]  Phi[p_, q_, y_] := p*q*y*Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l + 7]], {m, 1, 6}, {n, 1, 6}, {l, -6, , 6}]*Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l+7]], {m, 0, 0}, {n, 1, 6}, {l,-6, 6}]*Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l +7]], {m, 1, 6}, {n, 0, 0}, {l, -6,6}]* Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l +7]], {m, 0, 0}, {n, 0, 0}, {l, -6,6}]; expmultPhi = Normal[(Series[#1, {p, 0, 6}, {q, 0, 6}, {y, 0, 20}] & )[ Assuming[y > 0 && u > 0, Simplify[TrigToExp[Series[Phi[p, q, y], {p, 0, 6}, {q, 0, 6}]]]]]]  \[Eta][q_] := q^(1/24)*QPochhammer[q, q]; \[Theta]1[q_, y_] := EllipticTheta[1, (1/(2*I))*Log[y], q^(1/2)]; \[Theta]2[q_, y_] := EllipticTheta[2, (1/(2*I))*Log[y], q^(1/2)]; \[Theta]3[q_, y_] := EllipticTheta[3, (1/(2*I))*Log[y], q^(1/2)]; \[Theta]4[q_, y_] := EllipticTheta[4, (1/(2*I))*Log[y], q^(1/2)]; \[Phi][q_, y_] := 8*((\[Theta]2[q, y]/\[Theta]2[q, 1])^2 + (\[Theta]3[q, y]/\[Theta]3[q, 1])^2 + (\[Theta]4[q, y]/\[Theta]4[q, 1])^2) P\[Phi] = Normal[(Series[#1, {q, 0, 50}, {y, 0, 50}] & )[Assuming[y > 0 && u > 0, Simplify[TrigToExp[Series[\[Phi][q, y], {q, 0, 50}]]]]]]; o = Exponent[P\[Phi], y, Min] cc = CoefficientList[P\[Phi]/y^o, {q, y}]; \[CapitalPhi][p_, q_, y_] := p*q*y*Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l - o + 1]], {m, 1, 6}, {n, 1, 6}, {l, o, -o}]*Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l - o + 1]], {m, 0, 0}, {n, 1, 6}, {l, o, -o}]* Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l - o + 1]], {m, 1, 6}, {n, 0, 0}, {l, o, -o}]* Product[(1 - p^m*q^n*y^l)^cc[[m*n + 1,l - o + 1]], {m, 0, 0}, {n, 0, 0}, {l, o, -1}]; Normal[(Series[#1, {p, 0, 6}, {q, 0, 6}, {y, 0, 20}] & )[Assuming[y > 0 && u > 0, Simplify[TrigToExp[Series[\[CapitalPhi][p, q, y], {p, 0, 6}, {q, 0, 6}]]]]]]  Post Closed as "unclear what you're asking" by Daniel Lichtblau, m_goldberg, MarcoB, yohbs, garej occurred Jun 20 '17 at 5:44 3 making code more readable edited Jun 19 '17 at 21:19 sam 2844 bronze badges 2 added 870 characters in body edited Jun 19 '17 at 21:08 sam 2844 bronze badges 1 asked Jun 19 '17 at 19:46 sam 2844 bronze badges