- To: mathgroup at smc.vnet.net
- Subject: [mg109550] Re: FortranForm
- From: David Reiss <dbreiss at gmail.com>
- Date: Wed, 5 May 2010 06:04:24 -0400 (EDT)
- References: <email@example.com>
I think that the short answer to your questions is that FortranForm is a very old component of Mathematica that I suspect has not been updated since version 1.0 (and toe documentation indicates this). So, for question # 1 the answer is no. For question #2 you need to write a function of your own that searches out exact expressions and substitutes the numerical values with the appropriate precision & c. Hope this helps, David On May 4, 6:30 am, Gideon <gideon.simp... at gmail.com> wrote: > I have two, possibly related, questions on the FortranForm command. > > 1. Is it possible to get Fortran 90/95 style output? In particular, > I'd like to have long lines broken up with the end of line & > character, rather than the sixth column indicator as it is now. > > 2. Is it possible to get it to output decimals where it has whole > numbers? For instance, in some code I have, a factor of sqrt(2) > appears. FortranForm renders this as Sqrt(2). My compiler (gfortran > 4.4) doesn't like this because it sees this as the square root of an > integer. I have been resolving this with find-replace, and suspect I > could also deal with it by compiler flags, but it's annoying.