MathGroup Archive 2010

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

Search the Archive

Re: exponential format

  • To: mathgroup at
  • Subject: [mg114039] Re: exponential format
  • From: Maxim <m.r at>
  • Date: Mon, 22 Nov 2010 07:34:32 -0500 (EST)
  • References: <ic34m8$5jt$>

On Nov 18, 6:03 am, Magdalena Moczydlowska
<magdamoczydlow... at> wrote:
> Hi,
> Maybe my question is silly but I can not find any answer in the net ?
> How to change in Mathematica a normal number format to exponential
> notation. I mean for example 0.25->6.25e-02.
> Thank you for any suggestion,
> Magdalena

You can play with the options of NumberForm or use the Java format()

NumberForm[0.0625, NumberFormat -> (Row[{#, "e", #3}]&),
 ExponentFunction -> (#&)]

sprintf[fs_String, s__] := Module[
  {vararg, n = Length@ {s}},
  Quiet@ JavaBlock[
    vararg = JavaNew["[Ljava.lang.Object;", n];
       vararg, # - 1, MakeJavaObject@ {s}[[#]]
     ]& /@ Range@ n;
    java`lang`String`format[fs, vararg]]]

sprintf["%.2e", .0625]

Maxim Rytin
m.r at

  • Prev by Date: Re: Mathematica 8
  • Next by Date: Re: Combining VectorPlot3D and ParametricPlot3D
  • Previous by thread: Re: exponential format
  • Next by thread: How to Clear All Variables in Current Cell