12.07.2015 Views

2.7.5 Output Formats for Numbers

2.7.5 Output Formats for Numbers

2.7.5 Output Formats for Numbers

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.7 Textual <strong>Output</strong> 409option namedefault valueDigitBlock Infinity maximum length of blocks of digits between breaksNumberSeparator {",", " "} strings to insert at breaks between blocks of digits totheleftandrightofadecimalpointNumberPoint "." string to use <strong>for</strong> a decimal pointNumberSigns {"-", ""} strings to use <strong>for</strong> signs of negative and positivenumbersNumberPadding {"", ""} strings to use <strong>for</strong> padding on the left and rightSignPadding False whether to insert padding after the signNumberFormat Automatic function to generate final <strong>for</strong>mat of numberExponentFunction Automatic function to determine the exponent to useOptions <strong>for</strong> number <strong>for</strong>matting.All the options in the table except the last one apply to both integers and approximate real numbers.All the options can be used in any of the functions NumberForm, ScientificForm, EngineeringFormand AccountingForm. In fact, you can in principle reproduce the behavior of any one of these functionssimply by giving appropriate options settings in one of the others. The default option settingslisted in the table are those <strong>for</strong> NumberForm.Setting DigitBlock->n breaks digitsinto blocks of length n.You can specify any string to use as aseparator between blocks of digits.This gives an explicit plus sign <strong>for</strong>positive numbers, and uses | in place ofa decimal point.In[8]:= NumberForm[30!, DigitBlock->3]Out[8]//NumberForm= 265,252,859,812,191,058,636,308,480,000,000In[9]:= NumberForm[30!, DigitBlock->5, NumberSeparator->" "]Out[9]//NumberForm= 265 25285 98121 91058 63630 84800 00000In[10]:= NumberForm[{4.5, -6.8}, NumberSigns->{"-", "+"},NumberPoint->"|"]Out[10]//NumberForm= {+4|5, -6|8}When Mathematica prints an approximate real number, it has to choose whether scientific notationshould be used, and if so, how many digits should appear to the left of the decimal point. What Mathematicadoes is first to find out what the exponent would be if scientific notation were used, and onedigit were given to the left of the decimal point. Then it takes this exponent, and applies any functiongiven as the setting <strong>for</strong> the option ExponentFunction. This function should return the actual exponentto be used, or Null if scientific notation should not be used.The default is to use scientific notation<strong>for</strong> all numbers with exponents outsidethe range -5 to 5.In[11]:= {8.^5, 11.^7, 13.^9}7 10Out[11]= {32768., 1.94872 10 , 1.06045 10 }Web sample page from The Mathematica Book, Second Edition, by Stephen Wolfram, published by Addison-Wesley Publishing Company (hardcoverISBN 0-201-51502-4; softcover ISBN 0-201-51507-5). To order Mathematica or this book contact Wolfram Research: info@wolfram.com;http://www.wolfram.com/; 1-800-441-6284.© 1991 Wolfram Research, Inc. Permission is hereby granted <strong>for</strong> web users to make one paper copy of this page <strong>for</strong> their personal use. Further reproduction,or any copying of machine-readable files (including this one) to any server computer, is strictly prohibited.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!