Re: Help Formatting Outputs?
- To: mathgroup at smc.vnet.net
- Subject: [mg17011] Re: [mg16966] Help Formatting Outputs?
- From: BobHanlon at aol.com
- Date: Sat, 10 Apr 1999 02:13:40 -0400
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 4/8/99 6:53:41 AM, gutierrez_fam at geocities.com writes: >I've been experimenting with formatting results to a desired number >of significant figures. For the most part, I've found PrintPrecision >(in the "Option Inspector" window) quite useful. However, I have a >couple of related questions... > >1) How can I display Trailing Zeros? >ex: (253/11.2)*(1/0.62137)*(1/3.8754) = 9.60374 (displaying 6 >significant >figures using PrintPrecision). If I change this value to 3, the output >is 9.6 (when in fact I'd like to see 9.60). I've even tried N[%, 3] but >still get 9.6 as a result. > >2) Is there a way to display a result in scientific notation WITHOUT >using ScientificForm[expr]? Perhaps using a similar feature in the >"Option Inspector" window? ex: (150/2.2046)*6 = 408.237 (again, >displaying 6 significant figures using PrintPrecision). I would like to >get the same result as ScientificForm[%,1] or 4.x10^2 (in scientific >notation with 1 significant figure). But it would be nice if I could do >it "in the background" so to speak (like changing the number of >significant figures using PrintPrecision). > Daly, I get a different result than the one in your message (253/11.2)*(1/0.62137)*(1/3.8754) 9.38071 x = 9.60374 9.60374 You can get the desired result with NumberForm NumberForm[x, {3, 2}, NumberPadding -> {"", "0"}] "9.60" If you want this format applied to all of your results $Post = NumberForm[#, {3,2}, NumberPadding -> {"", "0"}]& Slot("1.00")& x "9.60" To reset $Post $Post =. Likewise for ScientificForm x = (150/2.2046)*6 408.237 $Post = ScientificForm[#, 1]& Slot("1")& x \!\(\*FormBox[ TagBox[ InterpretationBox[\("4."\[Times]10\^"2"\), 408.2373219631679, AutoDelete->True], (ScientificForm[ #, 1]&)], TraditionalForm]\) $Post =. Bob Hanlon