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

m
 
(2 intermediate revisions by one other user not shown)
Line 33:
 
: Have added some links to the C++ entry, since no-one else was ever going to. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 19:37, 17 August 2020 (UTC)
 
:The main thing is that G, NG, matrixNG, N1, N2, NG4, and NG8 are quite ridiculous names, it would actually be better or at least less misleading if they were changed to Galloway, NigelGalloway, matrixNigelGalloway, Nigel1, Nigel2, NigelGalloway4 and NigelGalloway8. (Ha-Bloody-Ha). And Yes, that would also include moving things to two new pages names of<br>
:Continued_fraction/Arithmetic/Galloway(matrix_NigelGalloway,_Contined_Fraction_Nigel), and<br>
:Continued_fraction/Arithmetic/Galloway(matrix_NigelGalloway,_Contined_Fraction_Nigel1,_Contined_Fraction_Nigel2)
 
:Hopefully my latest Phix entry will help clarify/suggest better names for things.
 
:As noted, the scatterbox over several (inadequately linked) pages issue also needs addressing. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 14:18, 18 August 2020 (UTC)
 
==Rename/rewrite Suggestion==
The above two tasks should be renamed as simply "Continued_fraction/Arithmetic/Unary" and "Continued_fraction/Arithmetic/Binary", and
read more like this (for "Binary"):
 
Perform arbitrary mathethatical operations on two continued fractions, such as +, -, *, and /.
 
The suggested approach is to write a function/class/method apply_full_matrix(ctrl,cf1,cf2) which takes a 2x4 control array and two continued fractions, and yields a continued fraction result. Assume ctrl is eight plain integers of the form
{{ a12, a1, a2, a },
{ b12, b1, b2, b }}
 
Then the result of apply_full_matrix(ctrl,cf1,cf2) would be
 
(a12*cf1*cf2 + a1*cf1 + a2*cf2 + a)
-----------------------------------
(b12*cf1*cf2 + b1*cf1 + b2*cf2 + b)
 
For instance:
{{ 0, 1, 1, 0}, calculates cf1 + cf2
{ 0, 0, 0, 1}} (divided by 1)
 
{{ 0, 1,-1, 0}, calculates cf1 - cf2
{ 0, 0, 0, 1}} (divided by 1)
 
{{ 1, 0, 0, 0}, calculates cf1 * cf2
{ 0, 0, 0, 1}} (divided by 1)
 
{{ 0, 1, 0, 0}, calculates cf1
{ 0, 0, 1, 0}} divided by cf2
 
If a12,a1,b12,b1 are all 0 then cf1 is not required/referenced and apply_fm() could accept some form of dummy/null value for it.<br>
If a12,a2,b12,b2 are all 0 then cf2 is not required/referenced and apply_fm() could accept some form of dummy/null value for it.<br>
Such cases are covered by a "baby" 2x2 control matrix in <nowiki>[["Continued_fraction/Arithmetic/Unary"]]</nowiki>
(currently named/located as [[Continued_fraction/Arithmetic/G(matrix_NG,_Contined_Fraction_N)]])
and it should (in theory) be perfectly possible to use this full form to replicate those results.
 
If b12,b1,b2,b are all zero we are done (presumably if that was initial state we end up with no terms, corresponding to undefined/error/divide by zero).<br>
If a12,a1,a2,a are initially all zero the result should be zero.<br>
If a12,a1,a2,b12,b1,b2 are all zero then neither cf1 nor cf2 are required and the result is the constant fraction a/b (but in
continued fraction format). In effect we define apply_fm() as operations on ctrl which (eventually) make a12..b2 zero so that we
can then simply read the (rest of the) result from a and b.
 
At that point I ran out of steam... Maybe this can be finished(/tweaked here) in small steps? --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 14:18, 18 August 2020 (UTC)
10,327

edits