MathGroup Archive 2001

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

Search the Archive

Fw: Compiling a function using Module

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26805] Fw: Compiling a function using Module
  • From: "Toshiyuki \(Toshi\) Meshii" <meshii at mech.fukui-u.ac.jp>
  • Date: Wed, 24 Jan 2001 04:18:44 -0500 (EST)
  • Disposition-notification-to: "Toshiyuki \(Toshi\) Meshii" <meshii@mech.fukui-u.ac.jp>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

1. Please let me know whether I have to specify all the global variables in
compiling a function.

In concrete, I want to compile a function posvel[i] defined as follows.
As f, x and v are globally defined variables, I do not define them as
arguments of function posvel.

posvel[i_]:= Module[ {c1 = t^2/m, c2 = t/m},
                   Do[
                    Do[
                         x[i+1][j][k] = x[i][j][k] + t * v[i][j][k] +c1 *
f[i][j[k];
                         v[i+1][j][k] = v[i][j[k] + c2 * f[i][j][k]
                        ,{j, 3} ]
                      ,{k, 100}]
                        ];

2. By the way, does using Module shorten the executing time?
If not, what is the candidate?

-Toshi





  • Prev by Date: Fw: FORTRAN style, not OK?
  • Next by Date: Re: [?] apply a function to members of a list
  • Previous by thread: Re: FORTRAN style, not OK?
  • Next by thread: Rewriting of Trigonometric Functions