Talk:Continued fraction/Arithmetic/G(matrix ng, continued fraction n)

From Rosetta Code
Revision as of 14:00, 7 November 2020 by Thundergnat (talk | contribs) (Thundergnat moved page Talk:Continued fraction/Arithmetic/G(matrix NG, Contined Fraction N) to Talk:Continued fraction/Arithmetic/G(matrix ng, continued fraction n): Follow normal task title capitalization policy)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Latest comment: 8 years ago by Rdm in topic How to build?

Note that [1;5,2] is rc2f(13,11) and [3;7] is rc2f(22,7).--Nigel Galloway 12:30, 7 February 2013 (UTC)

How to build?

I can't get the c++ entry to compile. How is that done? --Rdm (talk) 14:05, 8 July 2015 (UTC)Reply[reply]

Answer:
* Replace reference to NG_8 with NG_4
* Take the first body of code and save it as ng.hpp - adding these lines at the top <lang c++>#include <iostream>
  1. include <cmath>
  2. include "r2cf.hpp"</lang>
* populate r2cf.hpp with the first block of code at Continued_fraction/Arithmetic/Construct_from_rational_number#C.2B.2B
Each main block gets an #include "ng.hpp" header and gets compiled as c++11
I think the implementation should be fixed up so it works, but I'll leave that to someone else... --Rdm (talk) 04:32, 10 July 2015 (UTC)Reply[reply]

Marking as "draft"

I am marking this task as "draft". It should have started out in draft status, but has never been in draft status.

Also, currently:

  • The task description uses the notation "+ 1/2" which apparently corresponds to an "NG matrix" with a1=2, a=1, b1=0, b=2 and the notation "divided by 4" which apparently corresponds to an "NG matrix" with a1=1, a=0, b1=0, b=4. There is probably a good reason for this, but that should also be documented. Some implementations also use other "NG Matrices" but why?
  • It's not at all clear how we would compute an arithmetic geometric mean in this task. We would need to be able to compute the square root of an arbitrary value, but most square root algorithms (including continued fraction expansion) would require we be able to multiply two continued fractions if we are to compute the square root of a number represented as a continued fraction. The best we can do here is find a fixed precision rational value for use in an NG4 matrix and combine that with a continued fraction. But if we are going to do that, we might as well stick with rational approximations for the entire algorithm.

Anyways... this draft has potential, but it also needs some work. --Rdm (talk) 10:25, 9 July 2015 (UTC)Reply[reply]