Re: Accuracy for irrationals (was: what am i doing wrong here)

new topic     » topic index » view thread      » older message » newer message

> From: "Hayden McKay" <hmck1 at dodo.com.au>
> Subject: Re: what am i doing wrong here.
> 
> 
> I found another way to get the any root of a number to 100% accuracy.
> (below)
> 
> -- atom = root(atom digit, integer factor)
> -- Calculate the root of a digit.
> -- Returns the desired root.
> global function root(atom a,integer n)
>   a = power(a,(1/n))
>   return a
> end function

	You'll never get 100% accuracy for any number which is not a fraction with 
some product of powers of 2 as the denominator, because the hardware is wired 
that way.
	However, there are some routes to go to get many irrationals with ANY desired 
accuracy:
- fractions have a periodic pattern, so you can do some computations using 
that pattern. However, it is generally better to represent them exactly as 
{numerator,denominator} and perform calculations on the pir (doesn't work for 
roots).
- algebraic numbers of degree 2, which means numbers like a+/-sqrt(b), where a 
and b are fractions, have periodic continued fractions. Computing with these 
is definitely trickier, but you may get any absolute accuracy you need. This 
is quite handy for square roots.
- algebraic numbers of any degree, which means numbers that are roots of some 
polynomial with integer coefficients, can be reached through continued 
fractions or power series expansions. As long as you have an algorithm to 
compute any desired term in these, any accuracy can be reached, and there's no 
  periodicity any longer, plus some other problems as you have to choose among 
several roots most of the time.
- transcendent numbers, ie real numbers which are not algebraic, like PI, can 
sometimes be reached through power series expansions. Same remark as above, 
but there's no longer a finite sequence of integers on which you can perform 
some computations.

	By the way, do you need arbitrary precision computing? It costs both CPU time 
and RAM.

CChris

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu