Re: Fw: FORTRAN style, not OK?
- To: mathgroup at smc.vnet.net
- Subject: [mg26877] Re: Fw: FORTRAN style, not OK?
- From: Albert Retey <albert.retey at visualanalysis.com>
- Date: Fri, 26 Jan 2001 01:27:23 -0500 (EST)
- Organization: Visual Analysis
- References: <94m96g$3nd@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Toshiyuki (Toshi) Meshii" wrote: > > Hello, > > I found out a case in which I cannot directly use FORTRAN statement in > Mathematica programming. > Here is the case good in FORTRAN. > > v=v-c > > However in Mathematica, it seems that I have to use a trick like this. > > temp=v; > v=temp-c > > Is there more smart way for doing the above? > Please let me know. > ___________________________________ > The final goal for me is to do the following. > > Do[ > Do[ > v[i][j][k] = v[i][j][k] - va[j] > ,{j, 3}] > ,{k, 100}]; > > -Toshi One more note: before trying to transfer FORTRAN code to Mathematica you should understand the difference between v[i][j], v[i,j] and v[[i,j]], since the last form might represent much more what you expect a FORTRAN "array" to be. On the other hand, using Mathematica lists is still quite different from FORTRAN arrays, for example when it comes to "initialization" or "declaration" issues. You will have to create a list with the desired number of entries before you can reference to these entries. Probably you should really read some more literature on Mathematica, that will also protect you from harsh dissappointement about execution times... Albert -- Visual Analysis AG Internet: www.visualanalysis.com Neumarkter Str. 87 Telefon: 089 / 431 981 36 D-81673 Muenchen Telefax: 089 / 431 981 1