Talk:Continued fraction/Arithmetic

From Rosetta Code

External references

Is there a reference to this construction with NG and G in somewhere like Wikipedia or Mathworld? It would be nice to link to the wider world. –Donal Fellows 09:22, 7 February 2013 (UTC)

7 years too late: The task was written by Nigel Galloway, NG stands for NigelGalloway and G stands for Galloway. NG is a simple matrix that allows arbitrary maths, eg a "baby matrix" of {{a,b},{c,d}} just means calculate (a*x+b)/(c*x+d). Since any (but not all) of a/b/c/d can be zero we can easily write an NG that performs a simple operation such as x+1/2, or 1/x, etc. G(baby,x) is just the function that applies some NG to some x. The "full matrix" just extends that idea to a 2x4 matrix {{a,b,c,d},{e,f,g,h}} such that G(full,x,y) yeilds a result (often with several terms of 0) of (axy + bx + cy + d)/(exy + fx + gy + d). It would be equivalent but much more effort to have G accept a string expression as the first argument, eg G("(x+1)/y",x,y), whereas G({{0,1,0,1},{0,0,1,0}},x,y) gets the same result but without any complex parsing/precedence/invalid expression handling. --Pete Lomax (talk) 14:13, 27 August 2020 (UTC)