Skip to main content
15 events
when toggle format what by license comment
Aug 14, 2019 at 16:48 history edited Wile E. CC BY-SA 4.0
added 22 characters in body
Aug 14, 2019 at 14:16 history edited Wile E. CC BY-SA 4.0
added 1 character in body
Aug 14, 2019 at 11:15 history edited Wile E. CC BY-SA 4.0
added 2368 characters in body
Aug 7, 2019 at 13:52 answer added Carl Woll timeline score: 1
Aug 5, 2019 at 15:08 comment added Wile E. Many thanks again. I've just realized that I cannot use NumberForm (nor ScientificForm). Everything must be written in the InputForm as the output file (generated by Put) will later be given to the Get function (in another macro).
Aug 5, 2019 at 12:31 comment added Alx Maybe this is what you need: ClearAll[f]; f[x_Real] := NumberForm[Chop[x], {\[Infinity], 7}]; f[x_Complex /; FractionalPart /@ ReIm[x] != {0, 0}] := NumberForm[Chop[x], {\[Infinity], 7}]; f[x_] := x. So, I defined a function which works only with Real numbers (with decimal point) and Complex numbers with "decimals" in there. Other parts are not affected.
Aug 5, 2019 at 11:21 comment added Wile E. I think I would need a way to modify the "format string" for the lowest level routine which writes numeric floating point values in the InputForm (used by the Put function).
Aug 5, 2019 at 10:57 history edited Wile E. CC BY-SA 4.0
added 192 characters in body
Aug 5, 2019 at 10:47 comment added Wile E. Thanks again. It still doesn't work, sorry (I added an example of my "someList" above and, as one can see, I would need a solution which automatically deals with nested lists of different kinds of elements). Another problem with NumberForm is that it always outputs all "requested" digits, including the trailing zeros (e.g. one gets 0.0000000 instead of simply 0.).
Aug 5, 2019 at 10:42 history edited Wile E. CC BY-SA 4.0
added 181 characters in body
Aug 5, 2019 at 10:15 comment added Alx Yu may use Export function: Export["somefile",Map[NumberForm[Chop[#], {\[Infinity], 7}] &,Table[{x, x^2, Sin[x]}, {x, 0, \[Pi], 0.1}],{2}],"Table"]. I used generated table here to show exporting to file with 3 columns of numbers of desired form.
Aug 5, 2019 at 9:46 comment added Wile E. Thanks. I tried Put[NumberForm[Chop[someList], {\[Infinity],7}], "someFile"]; but, in the file, it simply saves "NumberForm[originalText, {\[Infinity],7}]".
Aug 5, 2019 at 9:19 comment added Alx NumberForm[#,{\[Infinity],7}] or the same with DecimalForm, which gives only decimal form without scientific notation.
Aug 5, 2019 at 8:58 history edited Wile E. CC BY-SA 4.0
added 8 characters in body
Aug 5, 2019 at 8:44 history asked Wile E. CC BY-SA 4.0