MathGroup Archive 2001

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

Search the Archive

Re: Fw: FORTRAN style, not OK?

  • To: mathgroup at
  • Subject: [mg26890] Re: [mg26806] Fw: FORTRAN style, not OK?
  • From: BobHanlon at
  • Date: Fri, 26 Jan 2001 01:27:33 -0500 (EST)
  • Sender: owner-wri-mathgroup at

There is only a problem if v is not assigned a value prior to using it in a 
recursive looking assignment. It is the lack of an initial assignment that 
causes it to go looking forever.


v = v - c

5 - c

v = a;

v = v - c

a - c


(v = 0; Table[v -= c, {5}])

{-c, -2*c, -3*c, -4*c, -5*c}


(v = 0; Table[v += c, {5}])

{c, 2*c, 3*c, 4*c, 5*c}


(v = 1; Table[v *= c, {5}])

{c, c^2, c^3, c^4, c^5}


(v = 1; Table[v /= c, {5}])

{c^(-1), c^(-2), c^(-3), c^(-4), c^(-5)}


Table[v[i,j,k] = 0, {i, 2}, {j,2},{k,2}];

Table[v[i,j,k] = v[i,j,k] - va[j], {i, 2}, {j,2},{k,2}]

{{{-va[1], -va[1]}, {-va[2], -va[2]}}, 
 {{-va[1], -va[1]}, {-va[2], -va[2]}}}

Bob Hanlon

In a message dated 2001/1/24 5:24:18 AM, meshii at writes:

>I found out a case in which I cannot directly use FORTRAN statement in
>Mathematica programming.
>Here is the case good in FORTRAN.
>However in Mathematica, it seems that I have to use a trick like this.
>Is there more smart way for doing the above?
>Please let me know.
>The final goal for me is to do the following.
> Do[
>      v[i][j][k] = v[i][j][k] - va[j]
>      ,{j, 3}]
>    ,{k, 100}];

  • Prev by Date: Re: Rewriting of Trigonometric Functions
  • Next by Date: Re: triangles in circles
  • Previous by thread: Re: FORTRAN style, not OK?
  • Next by thread: Re: Fw: FORTRAN style, not OK?