Metallic ratios: Difference between revisions

m
Clarify that the task is using a variant of a Lucas sequence, not exactly a Lucas sequence.
m (→‎{{header|Sidef}}: renamed function)
m (Clarify that the task is using a variant of a Lucas sequence, not exactly a Lucas sequence.)
Line 85:
is through '''successive approximations of Lucas sequences'''.
 
A traditional '''Lucas sequence''' is of the form:
A Lucas sequence has the form '''xₙ = b * xₙ₋₁ + c * xₙ₋₂'''. The metallic ratios use
Lucas sequences where '''c = 1''' and where the first two terms are always '''1, 1'''.
 
xₙ = P * xₙ₋₁ - Q * xₙ₋₂.
So for the Lucas sequence when '''b = 1''':
 
and starts with the first 2 values '''0, 1'''.
 
For our purposes in this task, to find the metallic ratios we'll use the form:
 
A Lucas sequence has the form '''xₙ = b * xₙ₋₁ + c * xₙ₋₂'''. The metallic ratios use
 
( '''P''' is set to '''b''' and '''Q''' is set to '''-1'''. ) To avoid "divide by zero" issues we'll start the sequence with the first two terms '''1, 1'''. The initial starting value has very little effect on the final ratio or convergence rate. ''Perhaps it would be more accurate to call it a Lucas-like sequence.''
 
At any rate, when '''b = 1''' we get:
 
xₙ = 1 * xₙ₋₁ + xₙ₋₂.
Line 131 ⟶ 140:
For each of the first '''10 Metallic ratios'''; '''b''' = '''0''' through '''9''':
 
* Generate the corresponding "Lucas" sequence.
* Show here, on this page, at least the first '''15''' elements of the "Lucas" sequence.
* Using successive approximations, calculate the value of the ratio accurate to '''32''' decimal places.
* Show the '''value''' of the '''approximation''' at the required accuracy.
Line 140 ⟶ 149:
 
You may assume that the approximation has been reached when the next iteration does not cause the value (to the desired places) to change.
 
 
;See also
10,333

edits