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

From Rosetta Code
Content added Content deleted
No edit summary
Line 5: Line 5:


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

: 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>
#include <cmath>
#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 <code>#include "ng.hpp"</code> header and gets compiled as c++11 --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 04:32, 10 July 2015 (UTC)

: I think the implementation should be fixed up so it works, but I'll leave that to someone else... --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 04:32, 10 July 2015 (UTC)


== Marking as "draft" ==
== Marking as "draft" ==
Line 19: Line 30:


* The task mentions the expression <math>\frac{1 + \frac{1}{\sqrt{2}}}{2}</math> but none of the implementations use that expression, nor does a continued fraction expression representing that value (such as 0 1 5 1 4 1 4 1 4 1 4 1...) seem to appear in the current implementations. Some implementations include a continued fraction for <math>\frac{1 + \sqrt{2}}{2}</math> but that's not the same (similar, but different).
* The task mentions the expression <math>\frac{1 + \frac{1}{\sqrt{2}}}{2}</math> but none of the implementations use that expression, nor does a continued fraction expression representing that value (such as 0 1 5 1 4 1 4 1 4 1 4 1...) seem to appear in the current implementations. Some implementations include a continued fraction for <math>\frac{1 + \sqrt{2}}{2}</math> but that's not the same (similar, but different).

* The "canonical entry" [by the task author] has currently obvious errors in it, which means the displayed output does not come from the implementation we see here.


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

Revision as of 04:32, 10 July 2015

r2cf

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)

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 --Rdm (talk) 04:32, 10 July 2015 (UTC)
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)

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 notation [1;3,5] and [3;7] but this notation does not appear in any of the implementations (well, in some as a literal string, but it is not used for computational purposes). This is either a red herring or needs documentation. Perhaps it's a reference into some external manuscript? Or perhaps it has to do with a method for constructing continued fractions? Whatever is going on should be stated more clearly. (There's a comment above which sheds some light on this issue, but not enough.)
  • 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?
  • The task mentions generating an Arithmetic-geometric mean but neglects to mention what this would be a mean of.
  • The task mentions the expression but none of the implementations use that expression, nor does a continued fraction expression representing that value (such as 0 1 5 1 4 1 4 1 4 1 4 1...) seem to appear in the current implementations. Some implementations include a continued fraction for but that's not the same (similar, but different).

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