Dear Robert,
Thanks a lot for the quick answer. This should work. However, I think it
would be nice to have a pre-parser that converts all sorts of number
formats into python ones so that mixing different packages for
different tasks would be easier. But I suppose this should be discussed
in another thread (?).
Cheers
Stan
Robert Bradshaw wrote:
> On Jun 5, 2009, at 3:09 AM, Stan Schymanski wrote:
>
>
>> Dear all,
>>
>> In Fortran, numbers can be written in the form of e.g. 1.2d-6 instead
>> of 1.2e-6, but if I import a text file with such numbers into sage
>> using numpy, the 'd' notation does not get recognised and I get an
>> error. Is there a way to import such numbers without too much hassle?
>>
>> Thanks for your help!
>>
>
> That would require changing the preparser, and as Python doesn't
> accept numbers of this format, I don't know that we'd want to depart
> from that.
>
> If your text file is all numbers, you could do a replace.
>
> sage: s = "1d2 1.5d4 3.2d-100"
> sage: s.replace('d', 'e')
> '1e2 1.5e4 3.2e-100'
>
> - Robert
>
>
> >
>
--
________________________________________
Stan Schymanski
Scientist
Max Planck Institute for Biogeochemistry
Postfach 10 01 64
D-07701 Jena
Phone: +49.3641.576264
Fax: +49.3641.577274
WWW: http://www.bgc-jena.mpg.de/~sschym
Biospheric Theory and Modelling Group
http://www.bgc-jena.mpg.de/bgc-theory/
_________________________________________
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---