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 the following as the first step to a sequence.

x = 2 - GoldenRatio;
Ceiling[x + x^(1/2)]

It gets a precision exception. The value is correct, but I would like to prevent the exception. (If we subtract 0.000001 from x, everything is fine.)

Is there a way to limit the precision? For one step only?

Edit: the sequence where 2-GoldenRatio is the seed.

x = 2 - GoldenRatio; t = Table[(x = Ceiling[x + x^(1/2)]), {2000}];

If ceiling is removed the first step works fine. However, I need the ceiling for alternate steps.

Edit2: $0 < x \leq 2-\phi$ where $\phi$ is the golden ratio. $\textit{When x = 2 - $\phi$, the first step equals $1$}$.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Does this get you what you need:

x = N[2 - GoldenRatio]
Ceiling[x + x^(1/2)]

0.381966
1

This doesn't get a precision exception.

This as per the update of your question also works without getting an error.

x = N[2 - GoldenRatio];
t = Table[(x = Ceiling[x + x^(1/2)]), {2000}];
share|improve this answer
    
That's the ticket! –  Fred Kline Jul 10 '12 at 3:03
add comment

Perhaps you could make a value inexact:

x = 2` - GoldenRatio;
x + x^(1/2)
1.

Or use FullSimplify:

x = 2 - GoldenRatio;
x + x^(1/2) // FullSimplify
1
share|improve this answer
add comment

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.