MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Integration takes more time:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91504] Integration takes more time:
  • From: Gopinath Venkatesan <gopinathv at ou.edu>
  • Date: Sun, 24 Aug 2008 07:06:42 -0400 (EDT)

Hello Mathematica Friends

This notebook takes more time to evaluate one integral. Any suggestions to improve the speed?

Actually I found the Timing[] for intfactor[1,0.5] which comes to be 7.5 sec. So the integration could take around 7.5*240 sec = 30 min. But it took nearly 50 minutes.

But still I am wondering if we could improve the solution time here, even less than 30 min, as it looked odd for me. May be something wrong here?

Thanks,

Gopinath
University of Oklahoma

(* code starts here *)

mperl = 2303; (* previously was 4000 *)
bs = 3.757;(* previously was same *)
ht = 2.1; (* previously was same *)
len = 30;(* previously was 30 *)
vel = 27.778;(* previously was 21.9558 *)
emod = 2.87*10^9;(* previously was 2.11E11 *)
moi = (bs ht^3)/12;(* previously was 1/12 *)
load = 100000;(* previously was 100000 *)
ag = 9.81;
Tfact = len/vel;

\[Omega][j_] := (j^2 \[Pi]^2)/len^2 Sqrt[(emod moi)/mperl];

\[CapitalOmega][k_] := (k \[Pi])/Tfact;
\[Kappa] = load/(ag mperl len);
\[Alpha] = \[CapitalOmega][1]/\[Omega][1];

deflmid = (load len^3)/(48 emod moi);

m = 7;
n = 24;
nn = 10;
num = 10;
\[Xi]i = Array[xi, m];
\[Tau]j = Array[ti, n];
intrfact = Table[0, {i, 1, num}, {j, 1, n}];
wdeflmass = Table[0, {i, 1, m}, {j, 1, n}];

\[Xi]i = Table[(i - 1)/(m - 1), {i, 1, m}];
\[Tau]j = Table[(1 - Cos[(j - 1)/(n - 1) \[Pi]])/2, {j, 1, n}];
sigfactor[\[Tau]_] := (\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(k = 1\), \(nn\)]
\*FractionBox[\(1\), \(
\*SuperscriptBox[\(\[Omega][k]\), \(2\)] - 
\*SuperscriptBox[\(\[CapitalOmega][k]\), \(2\)]\)]\ \((\(-
\*SuperscriptBox[\(\[CapitalOmega][
           k]\), \(2\)]\)\ Sin[\[CapitalOmega][
           k]\ \[Tau]] + \[CapitalOmega][k]\ \[Omega][
         k]\ Sin[\[Omega][k]\ \[Tau]])\)\ Sin[\[Omega][
        k]\ \[Tau]]\));
Timing[sigfactor[0.5]]
intfact[nmode_, time_] := Re[\!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(time\)]\((\((Sin[\
\[CapitalOmega][
            nmode]\ \[Tau]] - \[Kappa]\ Sin[\[CapitalOmega][
             nmode]\ \[Tau]]\ sigfactor[\[Tau]])\)\ Sin[\[Omega][
          nmode]\ \((time - \[Tau])\)])\) \[DifferentialD]\[Tau]\)];
Print["Passed"];
Timing[Table[
  intrfact[[nmode, t]] = (
    2 \[Kappa] ag)/\[Omega][nmode] intfact[nmode, 
     Tfact \[Tau]j[[t]]], {nmode, 1, num}, {t, 1, n}]]
Print["Over"];

wdeflmass = Table[\!\(
\*UnderoverscriptBox[\(\[Sum]\), \(k = 
      1\), \(num\)]\((Sin[
       k\ \[Pi]\ \[Xi]i[\([\)\(s\)\(]\)]]\ intrfact[\([\)\(k, 
       t\)\(]\)])\)\), {s, 1, m}, {t, 1, n}];
ym = Table[{\[Tau]j[[j]], -wdeflmass[[(m + 1)/2, j]]/deflmid}, {j, 1, 
    n}];
pm = ListPlot[ym, Joined -> True, PlotStyle -> Hue[0.7], 
  InterpolationOrder -> 3] 

(* Code ends here *)


  • Prev by Date: Re: Help to remove equivalent (redundant) solutions from FindRoot[]
  • Next by Date: Re: Help to remove equivalent (redundant) solutions from
  • Previous by thread: Re: Histogram and BoxWhiskers Plot
  • Next by thread: Eliminating intermediate results