My calculations are running terribly slow (for a larger number of variables than in the given code). I can't compile the function correctly. Can anyone help me?
De[e_,h_,v_]:=((e h^3)/(12 (1-v^2)))
Alf[a_]:=((m Pi)/a)
Bet[b_]:=((n Pi)/b)
q[p1_,p2_,a_,b_,x0_,y0_]:=
(
((4 p1)/(a b)) Sin[Alf[a] x0] Sin[Bet[b] y0]+
((4 p2)/(a b)) Sin[Alf[a] (x0+2.021)] Sin[Bet[b] (y0+0.065)]+
((4 p1)/(a b)) Sin[Alf[a] x0] Sin[Bet[b] (y0+1.050)]+
((4 p2)/(a b)) Sin[Alf[a] (x0+2.021)] Sin[Bet[b] (y0+0.985)]
)
Delt[e_,h_,v_,a_,b_,k_]:=(De[e,h,v] (Alf[a]^2+Bet[b]^2)^2+k)
w[p1_,p2_,a_,b_,x0_,y0_,e_,h_,v_,k_]:=q[p1,p2,a,b,x0,y0]/Delt[e,h,v,a,b,k]
Mx[e_,h_,v_,a_,b_,p1_,p2_,k_,x0_,y0_,x_/;0<x<6,y_/;0<y<6]:=De[e,h,v]*Sum[Sum[((Alf[a]^2+v Bet[b]^2) w[p1,p2,a,b,x0,y0,e,h,v,k]) Sin[Alf[a] x] Sin[Bet[b] y],{n,1,20}],{m,1,20}]
k={4.846825833322111`*^6,5.238931521109236`*^6,5.077350158653542`*^6,4.536267905643828`*^6,4.375764694611544`*^6,4.564669230813377`*^6,5.839164643396563`*^6,5.2185564799462985`*^6,4.3317022672116915`*^6,4.595977212066057`*^6,4.394030477319662`*^6,4.662831240535733`*^6}
pairs={{5.200301369200046`,3.164827201205645`},{4.163004893697675`,1.7409758270465447`},{5.695791313032204`,1.0023134075279154`},{0.8082870663144348`,4.173725169069691`},{3.6129799469236428`,3.6510371020047483`},{5.050196700105754`,5.042860219651104`}}
Mx[27000000000,0.2,0.2,6,6,45597,5793,#1,Sequence@@#2,Sequence@@#2]&@@@Tuples[{k,pairs}]
De
are undefined, hence symbolic. That makes compilation pointless. Please provide all relevant data (and only that). $\endgroup$ – Henrik Schumacher Dec 15 '19 at 23:25m
andn
are used implicitly inAlf
andBet
, but they are the running variables in the double sum. That leaves me to say that I just cannot tell what you want. $\endgroup$ – Henrik Schumacher Dec 15 '19 at 23:28m
andn
persists. Maybe you wantAlf
to be function ofa
andm
? (andBet
to be a function ofb
andn
?) $\endgroup$ – Henrik Schumacher Dec 16 '19 at 7:16