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 have a couple of complicated user-defined functions, one which calls the other, and I wish to control the number of decimal places displayed when I call the "mother" function. I have tried the obvious

N[mother[],n]

but no matter the choice for n I receive only 6 decimal places. But when I write a simple nested function like

f[x_] := Module[{}, x/3];
g[x_] := Module[{}, f[x]];

and then call

N[g[1], 50]

I receive the requested number of digits (so it doesn't seem to be the nesting causing the issue). Unfortunately I cannot post the actual functions I am playing with due to their size. Any ideas would be appreciated...

share|improve this question

1 Answer 1

I believe this question is a combination of these:

Specifically, for your function to work as desired most directly (and correctly) it will need to return a number or expression in arbitrary precision. This is (best) done by using arbitrary precision or exact numbers throughout the computation.

Alternately you can use NumberForm to display your output rather than N.

The result can be forced with SetAccuracy with the understanding that your results are fake. See:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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