Re: Scientific notation
- To: mathgroup at smc.vnet.net
- Subject: [mg41361] Re: Scientific notation
- From: "Dana DeLouis" <delouis at bellsouth.net>
- Date: Fri, 16 May 2003 06:42:17 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello. I have been trying to do something similar. I have been trying to
come up with a few "standard" listable functions for me in NumberForm,
ScientificForm, and EngineeringForm.
I have placed a few of these functions in my Init startup file.
However, I do not think I have it quite the way I want it yet. Here are a
few ideas I have been working on.
Here, sf3 is ScientificForm, with 3 digits of precision.
I have kept some of the options here even though items like DigitBlock would
not apply with 3 digits of precision. This is mostly a copy from my
NumberForm attempt where I want the thousand separator on large numbers.
SetAttributes[{sf3}, Listable]
sf3[x_Integer] := ScientificForm[N[x, 3], {1, 2}, DigitBlock -> 3,
NumberPadding -> {"", "0"}, NumberPoint -> ".", NumberSeparator -> {",",
""},
ExponentFunction -> Identity]
sf3[x_Rational] := ScientificForm[N[x, 3], {1, 2}, DigitBlock -> 3,
NumberPadding -> {"", "0"}, NumberPoint -> ".", NumberSeparator -> {",",
""},
ExponentFunction -> Identity]
sf3[x_] := ScientificForm[x, 3, DigitBlock -> 3, NumberPadding -> {"", "0"},
NumberPoint -> ".", NumberSeparator -> {",", ""}, ExponentFunction ->
Identity]
data = {1, 1., 30.43, 1*^-3, 3000, 3/4}
data//sf3
One problem I have is the number 3/4.
I get 8.00 x 10^-1
I am hoping someone can jump in and offer a better solution along this
idea.