Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I type

f1[x_] := 12 x^5 - 975 x^4 + 28000 x^3 - 345000 x^2 + 1800000 x
N[f1[15.5], 15]

and obtain 3.74112*10^6

BUT It´s not true!!! the result is larger than this solution, I think... BACAUSE...

 RealDigits[f1[15.5]]

gives me, the result {{3, 7, 4, 1, 1, 2, 0, 6, 8, 7, 5, 0, 0, 0, 0, 0}, 7}

So,... I can´t understand that I tell Mathematica that I want to view 15 significative digits, and Mathematica DON´T show me 15 sgnificative digits!!!, only 6!!

How I can obtain more digits???? with N[...] or with //N ???


I can´t understand any differneces in precision with Mathematica

m1 = {15, 4, 8, 23, 10, 9, 5, 18, 30, 21}
m2 = {15`9, 4`9, 8`9, 23`9, 10`9, 9`9, 5`9, 18`9, 30`9, 21`9}
f1[x_] := 12 x^5 - 975 x^4 + 28000 x^3 - 345000 x^2 + 1800000 x
x0 = f1[m1]
x1 = N[f1[m1], 9]
x2 = N[f1[m2], 9]

In the last element of x_ you can see diferrences, and... I don´t know what is the best way to obtain an an result with a concrete number os significative digits.

In x2, I tell Mathematica that I want 9 significative digits but the result is different from the last element of x1 and x0

and

I don´t know what result is the correct!

What´s the best way to obtain the good result with a given precision??, in this concrete situation?

If you replace in the las line of code in x2 9 for 12 or 15, you obtain the same result!! I can´t understand the behaivour!!

share|improve this question

closed as off-topic by m_goldberg, Michael E2, rasher, Yves Klett, Artes Mar 17 at 10:40

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Michael E2, rasher, Yves Klett, Artes
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Simple way: N[f1[15 + 1/2], 15]. See e.g., here (and references cited) for why: mathematica.stackexchange.com/questions/43714/… –  rasher Mar 16 at 22:07
    
@rasher I´m gratefull to you for the link. But... I think that is a simple question that is not simply explained in the documentation. Almost, for me. I have read about that issue and... the only solution I encoutered is use a higeher number in precsion but still can´t understand the behaivour of Mathematica in this sense. I supose that the precision is use in all the process of calculations so... I reach after trying examples that I still must read a message about a red box rounded a result with text "No significantiv.." and still trying to understand. But... Thank you reasher for the link –  Mika Ike Mar 18 at 11:14

1 Answer 1

up vote 4 down vote accepted

The problem lies with your 15.5 which has a small precision. Mathematica won't try to add digits beyond machine precision for this. Mathematica by default only displays 6 digits of precision unless otherwise specified. To view all the digits, wrap the output in InputForm.

To specify your precision, try this:

N[f1[15.5`15],15]

Or even this:

N[f1[Rationalize[15.5]],15]

Compare the differences in these three inputs:

Precision[15.5]

Precision[15.5`15]

Precision[Rationalize[15.5](*or 31/2*)]
share|improve this answer
    
Ok, for 15 works well, but... N[f1[15.54], 4] dont give me 4 significantive digits! ONLY 2! and N[f1[15.55], 5] ONLY 3 digits! –  Mika Ike Mar 17 at 5:23
    
$f1[Rationalize[123.456789]]=\frac{41327339867286004045456962819021417698847}{25‌​0000000000000000000000000000}$ –  Claude Leibovici Mar 17 at 8:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.