Skip to content

swatteau/rnrt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About rnrt

rnrt stands for rational nth root. It is an experimental program used to compute a rational approximation to the nth root of any rational number.

The algorithm is simply based on a search in the Stern-Brocot tree and is currently written in Haskell. Implementations in other programming languages may come later.

This work was inspired by Norman Wildberger’s MathFoundations video series.

Example usage

To get a rational approximation to the cubic root of 2 with an error less than 1/1000:

$ runhaskell Main.hs 3 2%1 1%1000
Rational approximation: 63 % 50
Decimal approximation: 1.26
Control: 2.000376

Note that the error is measured between the original number and the computed solution raised to the nth power. In the above example, the error is (2.000376 - 2.0) = 0.000376, which is less than 1/1000.

License

Copyright 2016 Sébastien Watteau

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

A rational nth root calculator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published