MathGroup Archive 2011

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

Search the Archive

Re: how to get string in sci. notation to a number?

On Tue, 29 Nov 2011 12:56:07 -0000, Oleksandr Rasputinov  
<oleksandr_rasputinov at> wrote:

> In place of "e", Mathematica uses "*^". When reading output from a Python
> program into Mathematica for analysis, I have used StringReplace to
> convert to valid Mathematica syntax followed by ToExpression; this can be
> faster and more convenient than Import in certain cases.

Actually that approach might be convenient here too, and definitely faster  
than ImportString on each element for large tables of values...

  (* StringReplace doesn't like nested lists... *)
  StringReplace[Flatten[lst], "e" -> "*^"],

{{4.99887, 9.56445*10^-6},
  {5.63045, 9.19438*10^-6},
  {6.11328, 8.13417*10^-6}}

  • Prev by Date: Re: How to simplify ArcSin formula
  • Next by Date: Problems with a first order differential equation
  • Previous by thread: Re: how to get string in sci. notation to a number?
  • Next by thread: Laplace equation with gradient boundary conditions