Devon McCormick wrote:
> Members of the Forum -
>
> If I'm approximating, e.g. the square root of 3, with a matrix method
> which
> returns an extended precision numerator and denominator, when I work out
> the
> decimal equivalent of this, at what point do I run out of significant
> digits?
>
Devon:
You can do much better with these Pell-type estimates, since you can
generate estimates 2,4,8,16,... directly: If your last estimate was p/q,
your next estimate is ((*:p)+3**:q)%2*p*q.
f=:((1 3)&(+/ .*)@:*:),+:@(*/)
f^:(i.5) 1 1x
1 1
4 2
28 16
1552 896
4817152 2781184
(%:3)-%/f^:3 ] 1 1x
_9.20496e_5
(%:3)-%/f^:4 ] 1 1x
_2.44585e_9
(%:3)-%/f^:5 ] 1 1x
0
Best wishes,
John
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm