Template:Showfacts set ancestors/convert
From Historical Hastings
Purpose: Given a article name and an ahnentafel number in parens, this stores the pair converted for the generation immediately following. (This function was formerly {{ahn convert}}.)
Parameters:
- 1 = an article with ahnentafel as extracted from the ahnentafel property eg: Gerrit Jan te Kolstee (1758-1797) (4)
- motherside = 1 if the tree is from the mother's side of the family. Default is zero (father's side).
Technical notes[edit]
Change history[edit]
- delimiters refactored: High frequency calls to the ahnentafel number dictated it be placed at the start since it requires a single explode to retrieve it from that position. The other delimiters were added to make it possible to extract data with a minimum of string parser calls. Currently, rpos, and sub are unnecessary. Worst case is the article name and it now requires just two explodes. 2009-10-16
- limit on generations (<65) removed since we can take more time on the sensor subpage. 2009-10-16
- The function had code to detect duplicate values (but it appears non operational since all it did was emit text "duplicate". Presumably, this was for anticipated use of an ahnentafel like system for descendants where there could be duplicate reports from both parents of children. 2009-10-16
How the ahnentafel numbers works in this template[edit]
For folks into math: we use a log function to derive the generation corresponding to the power of 2 base of the ahnentafel number. Upshifting or down shifting a generation is then a trivial operation.
For non math folks: Here is an illustration of how the number conversion works. First, examine the patterns of progression in ahnentafel numbers:
- Gen0 Adam 1
- Gen1 Adam 2; Eve 3; child's ancestors: = 2^1 (+1)
- Gen2 Adam 4; Eve 5; Fred 6; Ethyl 7; Darren 2; Samantha 3 ancestors: take Gen1, father side and add 2, mother side add 4.
- Gen3 Adam 8; eve 9 Fred 10; Ethyl 11; Derwood 4; Samantha 5
- Gen3 (adam on mother's side:) Adam 12 Eve 13 Fred 14 Ethyl 15....
- Generalization of pattern:
- If ahn <4 add 2^1 if male, +2^2 if female
- If ahn <8 add 2^2 if male, +2^3 if female
- If ahn <2^4 add 2^3 if male, +2^4 if female
- Refined: note the centrality of the generation#. The general rule is you always add 2^generation number if the tree is from the father, and add 2^(generation number+1) if from the mother. So how do we derive it. Ok finding the exponent of 2 is a log base 2 transform. #expr has logN (ln), so we can do this. To get log2 from ln, multiply 1/ln(2) times the ln of the ahn# and you have the log base 2. ln(2) is about 1.44 so we just multiply with that and round down to the nearest integer. That's your generation number (exp2base)
- Formulas: exp2base= floor( ln(AHN)*1.44 ) btw- floor means round down to the greatest integer less than x
- ahn=1734, generation = 10
- adding 1734 from a father's tree becomes 2758
- adding 1734 from a mother's tree becomes 3782
- calculation: {{#expr:1734 + 2^(floor( ln(1734)*1.44 )+1)}}
- ahn=1734, generation = 10
- this power of 2 "exp2base" number is just another word for Generation #.
- Formulas: exp2base= floor( ln(AHN)*1.44 ) btw- floor means round down to the greatest integer less than x
| The above documentation is transcluded from Template:Showfacts set ancestors/convert/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |