Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Precision in Mathematica' topicStudent Support Forum > General > Archives > "Precision in Mathematica"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
MF
11/14/08 07:37am

Hi Ali,

I thought Mathematica had a built-in function to print 'd' decimals after the decimal point '.' but I have not found any function that does it the way I want it to, so I guess one should write his/her own function:

(*) RoundToDecimals[n_, d_] :=
NumberForm[n, {Round[$MachinePrecision], d}];

Try the above function. Now, if you are dealing with numbers that have more decimals than $MachinePrecision (not just the ones to the right of '.') you will have to change (*) a bit..

I have learned, when using NumberForm, that the output produced cannot be used as input to one of the Plot functions, for instance - it will simply produce an empty plot.

URL: ,

Subject (listing for 'Precision in Mathematica')
Author Date Posted
Precision in Mathematica Ali Imtiaz 10/29/08 02:04am
Re: Precision in Mathematica MF 11/14/08 07:37am
Re: Precision in Mathematica Kaveh 11/15/08 10:31am
Re: Precision in Mathematica Kyle 11/16/08 00:01am
Re: Precision in Mathematica Ali Imtiaz 11/18/08 7:36pm
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic