Toady,I have a problem about N
,described as below:
For example
N[1/3, 5]
(* ==> 0.33333*)
and N[1/3, 5]
can make the result keep five significant figures.
data= RandomReal[{0, 2},8]
(* ==> {0.952811, 0.834171, 0.309447, 1.41046, 1.46811, 0.385663,1.50229,1.82034}*)
However,I want to make the data Keep four significant figures,so I use the function N[#, 4]&
N[#, 4]&/@data
(* ==> {0.952811, 0.834171, 0.309447, 1.41046, 1.46811, 0.385663,1.50229,1.82034}*)
Unfortunately,it failed.
My trail:
I copy the result,and paste in a input:
0.9528112485377731`, 0.8341711402854446`, 0.3094468949977962`,
1.410457480346131`, 1.4681075372399688`, 0.38566305213741137`,
1.502289805503937`, 1.820341132427437`
I wipe out the symbol `,and
data1= {0.9528112485377731, 0.8341711402854446, 0.3094468949977962,
1.410457480346131, 1.4681075372399688, 0.38566305213741137,
1.502289805503937, 1.820341132427437};
N[#, 4]&/@data1
==>(Wrong result,still keeping six significant figures )
{0.952811, 0.834171, 0.309447, 1.41046, 1.46811, 0.385663, 1.50229, 1.82034}
So my question is why and how to revise it?
Round[#,0.0001]& /@ data1
, see also here: mathematica.stackexchange.com/q/7871/5485 $\endgroup$N
function cannot work well? $\endgroup$RandomReal[{0, 2}, 8, WorkingPrecision -> 5]
; no need forN[]
! $\endgroup$