2
$\begingroup$

I am trying to evaluate some equations by using Taylor series of expansion (Series[], ExpandAll[], and Normal[] command), and using n equation and n unknown (Solve). Following is not full command (if you need, I would love to provide).

Comands

ser[expr_]:=Normal[Series[expr/.{Ωcp->ε*Ωcp,Ωp->ε*Ωp,Ωcj->ε*Ωcj,Ωj->ε*Ωj},{ε,0,1}]] /.ε->1

"list[0]" is lists equations with variables, and "unkowns" is lists of variable that I want so solve

Just for example, one equations from list[0] looks like,

ξ[1,2]σ[1,2]-1/2*I*Ωcp*σ[1,3]-1/2*I*Ωc2*σ[1,4]+1/2*I*Ω1*σ[3,2]+1/2*I*Ωj*σ[4,2]

and unkowns are σ[1,1],σ[1,2].....σ[4,4]

Do[
 ans[i] = Solve[List[i - 1] == 0, unkonwns[[i]];
 list[i] = ser[ExpandAll[list[i - 1]] /. ans[i]];
 t[i] = AbsoluteTime[];
 , {i, 1, 16}]

I am trying to solve 16 equations, by solving one, and replacing the variable I got from solve. I am using ExpandAll[] because if I do not expand it, it will not do proper Approximation later when I use series (I am not sure why). After that, I approximate the equations by expansion of order of 1, and repeat the process.

Problems

Using some other commands, I can get how much time it is spending, and how big is the equations that I want to solve.

index time {# of terms of a current equation, # of terms of a following equation}
{1th,0.19s,{5,5}}
{2th,0.27s,{5,5}}
{3th,0.32s,{5,5}}
{4th,0.38s,{5,6}}
{5th,0.48s,{6,7}}
{6th,0.64s,{7,8}}
{7th,0.70s,{8,13}}
{8th,0.85s,{13,16}}
{9th,1.0s,{16,30}}
{10th,1.7s,{30,164}}
{11th,35.s,{164,4693}}

First equations was contains only 5 elements, and it shows next elements that I am going to solve 5 elements, and time that MMA spend on the first equation was 0.19s.

I saw that my loop stop at 11th, it evaluated 164 terms in 35s, and next equation have 4693 terms. However, I have been running for two days. Anyone can approximate for me how long it will take to evaluate equations with 4693 terms? Anyway to make it faster? Is time increase linearly or exponentially by number of terms?

$\endgroup$

closed as unclear what you're asking by MarcoB, m_goldberg, user9660, Jens, Öskå Jul 1 '16 at 18:37

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ I did some regression on the times and made a log-log plot here. It looks like the time is increasing with the square of the number of equations used (and perhaps faster than that) $\endgroup$ – costrom Apr 4 '16 at 15:19
  • $\begingroup$ Would you mind giving me more detail? fitting is something like y~ N^2 $\endgroup$ – Saesun Kim Apr 4 '16 at 19:28
  • $\begingroup$ the regression line is more similar to: log(Time) ~ (log(N)^2) $\endgroup$ – costrom Apr 4 '16 at 19:36
  • $\begingroup$ when I extrapolated the time it would take to run the 4693 equations, it ended up being ~ 150,000 seconds (just shy of 2 days), but it likely underpredicts the actual time $\endgroup$ – costrom Apr 4 '16 at 19:37