Arithmetic-geometric mean: Difference between revisions

Add TI SR-56 solution
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(Add TI SR-56 solution)
Line 3,007:
Output:
<pre>0.8472130847939792</pre>
 
=={{header|TI SR-56}}==
{| class="wikitable"
|+ Texas Instruments SR-56 Program Listing for "Arithmetic-geometric mean"
|-
! Display !! Key !! Display !! Key !! Display !! Key !! Display !! Key
|-
| 00 33 || STO || 25 03 || 3 || 50 || || 75 ||
|-
| 01 02 || 2 || 26 12 || INV || 51 || || 76 ||
|-
| 02 32 || x<>t || 27 44 || EE || 52 || || 77 ||
|-
| 03 64 || × || 28 41 || R/S || 53 || || 78 ||
|-
| 04 32 || x<>t || 29 || || 54 || || 79 ||
|-
| 05 94 || = || 30 || || 55 || || 80 ||
|-
| 06 48 || *√x || 31 || || 56 || || 81 ||
|-
| 07 32 || x<>t || 32 || || 57 || || 82 ||
|-
| 08 84 || + || 33 || || 58 || || 83 ||
|-
| 09 34 || RCL || 34 || || 59 || || 84 ||
|-
| 10 02 || 2 || 35 || || 60 || || 85 ||
|-
| 11 94 || = || 36 || || 61 || || 86 ||
|-
| 12 54 || ÷ || 37 || || 62 || || 87 ||
|-
| 13 02 || 2 || 38 || || 63 || || 88 ||
|-
| 14 94 || = || 39 || || 64 || || 89 ||
|-
| 15 33 || STO || 40 || || 65 || || 90 ||
|-
| 16 02 || 2 || 41 || || 66 || || 91 ||
|-
| 17 44 || EE || 42 || || 67 || || 92 ||
|-
| 18 94 || = || 43 || || 68 || || 93 ||
|-
| 19 32 || x<>t || 44 || || 69 || || 94 ||
|-
| 20 44 || EE || 45 || || 70 || || 95 ||
|-
| 21 94 || = || 46 || || 71 || || 96 ||
|-
| 22 12 || INV || 47 || || 72 || || 97 ||
|-
| 23 37 || *x=t || 48 || || 73 || || 98 ||
|-
| 24 00 || 0 || 49 || || 74 || || 99 ||
|}
 
Asterisk denotes 2nd function key.
 
{| class="wikitable"
|+ Register allocation
|-
| 0: Unused || 1: Unused || 2: Term a || 3: Unused || 4: Unused
|-
| 5: Unused || 6: Unused || 7: Unused || 8: Unused || 9: Unused
|}
 
Annotated listing:
<syntaxhighlight lang="text">
STO 2 x<>t // x := term a, t := R2 := term g
× x<>t = √x // Calculate term g'
x<>t + RCL 2 = / 2 = STO 2 // Calculate term a'
EE = x<>t EE = // Round terms to ten digits
INV x=t 0 3 // Loop if unequal
INV EE // Exit scientific notation
R/S // End
</syntaxhighlight>
 
'''Usage:'''
 
Enter term a, press x<>t, then enter term g. Finally, press RST R/S to run the program.
 
{{in}}
 
<pre>
1 x<>t 2 √x 1/x RST R/S
</pre>
 
{{out}}
 
<pre>
.8472130848
</pre>
 
=={{header|TI-83 BASIC}}==
27

edits