1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025
|
<?xml version="1.0" encoding="utf-8"?>
<QALCULATE version="5.9.0">
<category>
<title>Matrices & Vectors</title>
<builtin_function name="vector">
<title>Construct Vector</title>
<names>r:vector</names>
<description>Returns a vector with listed elements.</description>
<argument index="1">
<!-- Vector/matrix elements -->
<title>Elements</title>
</argument>
</builtin_function>
<builtin_function name="genvector">
<title>Generate Vector</title>
<names>r:genvector</names>
<example>$name(x^2, 1, 5) = [1 4 9 16 25]</example>
<description>Returns a vector generated from a function with a variable (default x) running from min to max. The 4th argument is either the step between each value of the variable, if the 6th argument is 1 or if the value is 1 (default), negative, or not an integer and the 6th argument is -1 (default), or the number of elements.</description>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>Min</title>
</argument>
<argument index="3">
<title>Max</title>
</argument>
<argument index="4">
<title>Dimension / Step size</title>
</argument>
<argument index="5">
<title>Variable</title>
</argument>
<argument index="6">
<title>Use step size</title>
</argument>
</builtin_function>
<builtin_function name="colon">
<title>Colon Function (number sequence vector)</title>
<names>r:colon</names>
<example>$name(1, 0.5, 3) = [1 1.5 2 2.5 3]</example>
<description>Returns a sequence of numbers as a vector.</description>
<argument index="1">
<title>Starting value</title>
</argument>
<argument index="2">
<title>Increment or Ending value</title>
</argument>
<argument index="3">
<title>Ending value</title>
</argument>
</builtin_function>
<builtin_function name="sort">
<title>Sort</title>
<names>r:sort</names>
<description>Returns a sorted vector.</description>
<example>$name([6 1 4]) = [1 4 6]</example>
<argument index="1">
<title>Vector</title>
</argument>
<argument index="2">
<title>Ascending</title>
</argument>
</builtin_function>
<builtin_function name="rank">
<title>Rank</title>
<names>r:rank</names>
<description>Returns a vector with values of elements replaced with their mutual ranks.</description>
<example>$name([6 1 4]) = [3 1 2]</example>
<argument index="1">
<title>Vector</title>
</argument>
<argument index="2">
<title>Ascending</title>
</argument>
</builtin_function>
<builtin_function name="flip">
<title>Flip</title>
<names>r:flip</names>
<description>Reverses the order of elements in a matrix or vector. If dimension is 1, the order of rows is reversed, if 2 column order is changed, and if 0 (default) both are changed.</description>
<example>$name([1 2 3]) = [3 2 1]</example>
<argument index="1">
<title>Matrix/vector</title>
</argument>
<argument index="2">
<title>Dimension</title>
</argument>
</builtin_function>
<builtin_function name="circshift">
<title>Circular Vector Shift</title>
<names>r:circshift</names>
<example>$name([1 2 3], 1) = [3 1 2]</example>
<argument index="1">
<title>Matrix/vector</title>
</argument>
<argument index="2">
<title>Steps</title>
</argument>
<argument index="3">
<title>Dimension</title>
</argument>
</builtin_function>
<builtin_function name="reshape">
<title>Reshape Matrix</title>
<names>r:reshape</names>
<example>$name([1 2 3 4], 2, 2) = [1 3; 2 4]</example>
<argument index="1">
<title>Matrix/vector</title>
</argument>
<argument index="2">
<title>Rows</title>
</argument>
<argument index="3">
<title>Columns</title>
</argument>
</builtin_function>
<builtin_function name="limits">
<title>Vector Part</title>
<names>r:slice,r:limits</names>
<description>Returns a part of a vector between two positions. Negative indexes are counted from the back of the vector. If the second index is beyond the end of the vector, zeroes are appended to the returned vector.</description>
<argument index="1">
<title>Vector</title>
</argument>
<argument index="2">
<title>Index 1</title>
</argument>
<argument index="3">
<title>Index 2</title>
</argument>
</builtin_function>
<builtin_function name="dimension">
<title>Dimension</title>
<names>r:dimension</names>
<description>Returns the number of elements in a vector.</description>
<argument index="1">
<title>Vector</title>
</argument>
</builtin_function>
<builtin_function name="mergevectors">
<title>Combine Vectors</title>
<names>r:combine,r:mergevectors</names>
<description>Returns a vector with the elements from multiple vectors.</description>
<argument index="1">
<title>Vector 1</title>
</argument>
<argument index="2">
<title>Vector 2</title>
</argument>
</builtin_function>
<builtin_function name="matrix">
<title>Construct Matrix</title>
<names>r:matrix</names>
<description>Returns a matrix with specified dimensions and listed elements. Omitted elements are set to zero.</description>
<argument index="1">
<title>Rows</title>
</argument>
<argument index="2">
<title>Columns</title>
</argument>
<argument index="3">
<title>Elements</title>
</argument>
</builtin_function>
<builtin_function name="matrix2vector">
<title>Convert Matrix to Vector</title>
<names>r:matrix2vector</names>
<description>Puts each element of a matrix in vertical order in a vector.</description>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="area">
<title>Matrix Part</title>
<!-- Matrix area -->
<names>r:part,r:area</names>
<description>Returns a part of a matrix.</description>
<argument index="1">
<title>Matrix</title>
</argument>
<argument index="2">
<title>Start row</title>
</argument>
<argument index="3">
<title>Start column</title>
</argument>
<argument index="4">
<title>End row</title>
</argument>
<argument index="5">
<title>End column</title>
</argument>
</builtin_function>
<builtin_function name="replacePart">
<title>Replace Part of Matrix</title>
<names>r:replacePart</names>
<argument index="1">
<title>Matrix</title>
</argument>
<argument index="2">
<title>Replacement</title>
</argument>
<argument index="3">
<title>Start row</title>
</argument>
<argument index="4">
<title>Start column</title>
</argument>
<argument index="5">
<title>End row</title>
</argument>
<argument index="6">
<title>End column</title>
</argument>
</builtin_function>
<builtin_function name="rows">
<title>Rows</title>
<names>r:rows</names>
<description>Returns the number of rows in a matrix.</description>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="columns">
<title>Columns</title>
<names>r:columns</names>
<description>Returns the number of columns in a matrix.</description>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="row">
<title>Extract Row as Vector</title>
<names>r:row</names>
<description>Returns a row in a matrix as a vector.</description>
<argument index="1">
<title>Matrix</title>
</argument>
<argument index="2">
<title>Row</title>
</argument>
</builtin_function>
<builtin_function name="column">
<title>Extract Column as Vector</title>
<names>r:column</names>
<description>Returns a column in a matrix as a vector.</description>
<argument index="1">
<title>Matrix</title>
</argument>
<argument index="2">
<title>Column</title>
</argument>
</builtin_function>
<builtin_function name="elements">
<title>Elements</title>
<names>r:elements</names>
<description>Returns the number of elements in a matrix or vector.</description>
<argument index="1">
<title>Matrix/vector</title>
</argument>
</builtin_function>
<builtin_function name="element">
<!-- Vector/matrix element -->
<title>Element</title>
<names>r:element</names>
<description>Returns the element at specified position in a matrix (row and column) or vector (index).</description>
<argument index="1">
<title>Matrix/vector</title>
</argument>
<argument index="2">
<title>Row/index</title>
</argument>
<argument index="3">
<title>Column</title>
</argument>
</builtin_function>
<builtin_function name="transpose">
<title>Transpose</title>
<names>r:transpose</names>
<description>Returns the transpose of a matrix.</description>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="identity">
<title>Identity</title>
<names>r:identity</names>
<description>Returns the identity matrix of a matrix or with specified number of rows/columns.</description>
<argument index="1">
<title>Matrix or rows/columns</title>
</argument>
</builtin_function>
<builtin_function name="det">
<title>Determinant</title>
<names>r:det</names>
<description>Calculates the determinant of a matrix.</description>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="permanent">
<title>Permanent</title>
<names>r:permanent</names>
<description>Calculates the permanent of a matrix. The permanent differs from a determinant in that all signs in the expansion by minors are taken as positive.</description>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="adj">
<title>Adjugate (Adjoint)</title>
<names>r:adj</names>
<description>Calculates the adjugate or adjoint of a matrix.</description>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="cofactor">
<title>Cofactor</title>
<names>r:cofactor</names>
<description>Calculates the cofactor of the element at specified position.</description>
<argument index="1">
<title>Matrix</title>
</argument>
<argument index="2">
<title>Row</title>
</argument>
<argument index="3">
<title>Column</title>
</argument>
</builtin_function>
<builtin_function name="inv">
<title>Matrix Inverse</title>
<names>r:inv,r:inverse</names>
<description>Calculates the inverse of a matrix. The inverse is the matrix that multiplied by the original matrix equals the identity matrix (AB = BA = I).</description>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="load">
<title>Load CSV File</title>
<names>r:load</names>
<description>Returns a matrix imported from a CSV data file.</description>
<argument index="1">
<title>Filename</title>
</argument>
<argument index="2">
<title>First data row</title>
</argument>
<argument index="3">
<!-- Delimiter -->
<title>Separator</title>
</argument>
</builtin_function>
<builtin_function name="export">
<title>Export To CSV File</title>
<names>r:export</names>
<description>Exports a matrix to a CSV data file.</description>
<argument index="1">
<title>Matrix/vector</title>
</argument>
<argument index="2">
<title>Filename</title>
</argument>
<argument index="3">
<title>Separator</title>
</argument>
</builtin_function>
<builtin_function name="magnitude">
<title>Magnitude</title>
<names>r:magnitude</names>
<description>Calculates the magnitude of a value. This function returns the same value as abs() for all values except vectors.</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="rk">
<title>Matrix Rank</title>
<names>ra:rk</names>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="rref">
<title>Reduced Row Echelon Form</title>
<names>r:rref</names>
<argument index="1">
<title>Matrix</title>
</argument>
</builtin_function>
<builtin_function name="horzcat">
<title>Concatenate Horizontally</title>
<names translatable="no">r:horzcat</names>
<argument index="1">
<title>Matrix 1</title>
</argument>
<argument index="2">
<title>Matrix 2</title>
</argument>
</builtin_function>
<builtin_function name="vertcat">
<title>Concatenate Vertically</title>
<names translatable="no">r:vertcat</names>
<argument index="1">
<title>Matrix 1</title>
</argument>
<argument index="2">
<title>Matrix 2</title>
</argument>
</builtin_function>
<builtin_function name="entrywise">
<title>Entrywise Function</title>
<names>r:entrywise</names>
<description>Calculates a new matrix or vector using each separate element in matrix/vector 1 and the corresponding (in the same row and column) elements in matrix/vector 2. An unlimited number of matrices/vectors can be specified, with each matrix/vector argument followed by the corresponding variable used in the function argument.</description>
<example>$name(x / y, [4 10 12], x, [2 2 4], y) = [2 5 3]</example>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>Matrices/vectors and variables</title>
</argument>
</builtin_function>
<builtin_function name="norm">
<title>Norm (length)</title>
<names>r:norm</names>
<description>Calculates the norm/length of a vector.</description>
<argument index="1">
<title>Vector</title>
</argument>
<argument index="2">
<title>Exponent (p)</title>
</argument>
</builtin_function>
<builtin_function name="dot">
<title>Dot Product</title>
<names>r:dot</names>
<description>Calculates the dot product of two vectors.</description>
<argument index="1">
<title>Vector 1</title>
</argument>
<argument index="2">
<title>Vector 2</title>
</argument>
</builtin_function>
<builtin_function name="times">
<title>Element-wise Multiplication</title>
<names>r:multiply,times,hadamard</names>
<argument index="1">
<title>Factor 1</title>
</argument>
<argument index="2">
<title>Factor 2</title>
</argument>
</builtin_function>
<builtin_function name="rdivide">
<title>Element-wise Right Division</title>
<names>r:divide,rdivide</names>
<argument index="1">
<title>Numerator</title>
</argument>
<argument index="2">
<title>Denominator</title>
</argument>
</builtin_function>
<builtin_function name="pow">
<title>Element-wise Power</title>
<names>r:pow,r:raise,power</names>
<argument index="1">
<title>Base</title>
</argument>
<argument index="2">
<title>Exponent</title>
</argument>
</builtin_function>
<function>
<title>Cross Product</title>
<names>r:cross</names>
<description>Calculates the cross product of two 3-dimensional vectors.</description>
<expression>((element(\x,2)*element(\y,3))-(element(\x,3)*element(\y,2)),(element(\x,3)*element(\y,1))-(element(\x,1)*element(\y,3)),(element(\x,1)*element(\y,2))-(element(\x,2)*element(\y,1)))</expression>
<argument type="vector" index="1">
<title>Vector 1</title>
<condition>dimension(\x)==3</condition>
</argument>
<argument type="vector" index="2">
<title>Vector 2</title>
<condition>dimension(\x)==3</condition>
</argument>
</function>
<function>
<title>Scalar Triple Product</title>
<names>r:triple_product,triple</names>
<description>Calculates the scalar-valued triple product of three 3-dimensional vectors.</description>
<expression>det([\x; \y; \z])</expression>
<argument type="vector" index="1">
<title>Vector 1</title>
<condition>dimension(\x)==3</condition>
</argument>
<argument type="vector" index="2">
<title>Vector 2</title>
<condition>dimension(\x)==3</condition>
</argument>
<argument type="vector" index="3">
<title>Vector 3</title>
<condition>dimension(\x)==3</condition>
</argument>
</function>
<builtin_function name="kron">
<title>Kronecker Product</title>
<names>r:kron</names>
<argument index="1">
<title>Matrix 1</title>
</argument>
<argument index="2">
<title>Matrix 2</title>
</argument>
</builtin_function>
</category>
<category>
<title>Combinatorics</title>
<builtin_function name="factorial">
<title>Factorial</title>
<description>Calculates the factorial of an integer. Multiplies the argument with every lesser positive integer (n(n-1)(n-2)...2*1). Can also be entered as a number followed by one exclamation mark.</description>
<example>$name(5) = 5! = 5 * 4 * 3 * 2 * 1 = 120</example>
<names>r:factorial</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="factorial2">
<title>Double Factorial</title>
<names>r:factorial2</names>
<description>Calculates the double factorial of an integer. Multiplies the argument with every second lesser positive integer (n(n-2)(n-4)...). Can also be entered as a number followed by two exclamation marks.</description>
<example>$name(5) = 5!! = 5 * 3 * 1 = 15</example>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="multifactorial">
<title>Multifactorial</title>
<names>r:multifactorial</names>
<description>Calculates the multifactorial of an integer. Multiplies the argument with every x lesser positive integer (n(n-x)(n-2x)...). Can also be entered as a number followed by three or more exclamation marks.</description>
<example>$name(18, 4) = 18!!!! = 18 * 14 * 10 * 6 * 2 = 30 240</example>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Factorial</title>
</argument>
</builtin_function>
<builtin_function name="binomial">
<title>Binomial Coefficient</title>
<names>r:binomial</names>
<argument index="1">
<title translatable="no">n</title>
</argument>
<argument index="2">
<title translatable="no">k</title>
</argument>
</builtin_function>
<function>
<title>Hyperfactorial</title>
<names>r:hyperfactorial</names>
<expression>product(x^x,1,\x,x)</expression>
<description>Calculates the hyperfactorial of an integer. Multiplies the argument raised by itself with every lesser positive integer raised by themselves (1^1 * 2^2 ... n^n).</description>
<example>$name(3) = (3^3) * (2^2) * (1^1) = 108</example>
<argument type="integer" index="1">
<title>Value</title>
<min>1</min>
</argument>
</function>
<function>
<title>Superfactorial</title>
<names>r:superfactorial</names>
<expression>product(factorial(x),0,\x,x)</expression>
<description>Calculates the superfactorial of an integer. Multiplies the factorial of the argument with the factorial of every lesser positive integer (1! * 2! ... n!).</description>
<example>$name(5) = 5! * 4! * 3! * 2! * 1! = 34 560</example>
<argument type="integer" index="1">
<title>Value</title>
<min>0</min>
</argument>
</function>
<function>
<title>Permutations (Variations)</title>
<names>r:perm,variations</names>
<expression>binomial(\x,\y)*gamma(\y+1)</expression>
<description>Returns the number of possible arrangements of an ordered list with a number of objects to choose from and a list size. If there are three objects (1, 2 and 3) that are put in a list with two positions, the alternatives are [1, 2], [2, 1], [1, 3], [3, 1], [2, 3] and [3, 2], and thus the number of permutations is 6.</description>
<argument type="number" index="1">
<title>Objects</title>
</argument>
<argument type="number" index="2">
<title>Size</title>
</argument>
</function>
<function>
<title>Combinations</title>
<names>r:comb</names>
<expression>binomial(\x,\y)</expression>
<description>Returns the number of possible arrangements of an unordered list with a number of objects to choose from and a list size. If there are three objects (1, 2 and 3) that are put in a list with place for two, the alternatives are [1, 2], [1, 3], and [2, 3], and thus the number of combinations is 3.</description>
<argument type="number" index="1">
<title>Objects</title>
</argument>
<argument type="number" index="2">
<title>Size</title>
</argument>
</function>
<function>
<title>Derangements</title>
<names>r:derangements</names>
<description>Returns the number of possible rearrangements of an ordered list, of a certain size, where none of the objects are in their original positions. If the original list is [1, 2, 3], the possible derangements are [2, 3, 1] and [3, 1, 2], and thus the number of derangements is 2.</description>
<expression>factorial(\x)*sum(((-1)^"i")/factorial("i"),0,\x,"i")</expression>
<argument type="integer" index="1">
<title>Number of elements</title>
<min>1</min>
</argument>
</function>
</category>
<category>
<title>Number Theory</title>
<builtin_function name="abs">
<title>Absolute Value</title>
<names>r:abs</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<category>
<title>Arithmetic</title>
<builtin_function name="sgn">
<title>Signum</title>
<names>r:sgn</names>
<argument index="1">
<!-- A numerical value -->
<title>Number</title>
</argument>
<argument index="2">
<title>Value for zero</title>
</argument>
</builtin_function>
<builtin_function name="numerator">
<title>Numerator</title>
<names>r:numerator</names>
<argument index="1">
<title>Number</title>
</argument>
</builtin_function>
<builtin_function name="denominator">
<title>Denominator</title>
<names>r:denominator</names>
<argument index="1">
<title>Number</title>
</argument>
</builtin_function>
<builtin_function name="rem">
<title>Remainder</title>
<names>r:rem</names>
<argument index="1">
<title>Numerator</title>
</argument>
<argument index="2">
<title>Denominator</title>
</argument>
</builtin_function>
<builtin_function name="mod">
<title>Modulus</title>
<names>r:mod</names>
<argument index="1">
<title>Numerator</title>
</argument>
<argument index="2">
<title>Denominator</title>
</argument>
</builtin_function>
<builtin_function name="powmod">
<title>Modular Exponentiation</title>
<description>Finds the modular inverse for negative exponents, and is otherwise equivalent to mod(a^b, c). For negative exponents the greatest common divisor of the numerator and the denominator must be 1.</description>
<names>r:powmod,power_mod</names>
<argument index="1">
<title>Numerator</title>
</argument>
<argument index="2">
<title>Exponent</title>
</argument>
<argument index="3">
<title>Denominator</title>
</argument>
</builtin_function>
<builtin_function name="parallel">
<title>Parallel Sum</title>
<names>r:parallel</names>
</builtin_function>
<function>
<title>Integer Division</title>
<names>r:div</names>
<expression>trunc(\x/\y)</expression>
<argument type="free" index="1">
<title>Numerator</title>
</argument>
<argument type="free" index="2">
<title>Denominator</title>
</argument>
</function>
<function>
<title>Negate</title>
<names>r:neg</names>
<expression>-\x</expression>
<argument type="free" index="1">
<title>Value</title>
<handle_vector>false</handle_vector>
</argument>
</function>
<function>
<title>Subtract</title>
<names>r:subtract</names>
<expression>element(\x,1)-sum(element(\x,"i"),2,elements(\x))</expression>
<condition>elements(\x)>=2</condition>
<argument type="vector" index="1">
<title>Terms</title>
</argument>
</function>
</category>
<category>
<title>Polynomials</title>
<builtin_function name="coeff">
<title>Coefficient</title>
<names>r:coeff</names>
<argument index="1">
<title>Polynomial</title>
</argument>
<argument index="2">
<title>Number</title>
</argument>
<argument index="3">
<title>Variable</title>
</argument>
</builtin_function>
<builtin_function name="lcoeff">
<title>Leading Coefficient</title>
<names>r:lcoeff</names>
<argument index="1">
<title>Polynomial</title>
</argument>
<argument index="2">
<title>Variable</title>
</argument>
</builtin_function>
<builtin_function name="tcoeff">
<title>Trailing Coefficient</title>
<names>r:tcoeff</names>
<argument index="1">
<title>Polynomial</title>
</argument>
<argument index="2">
<title>Variable</title>
</argument>
</builtin_function>
<builtin_function name="degree">
<title>Polynomial Degree</title>
<names>r:degree</names>
<argument index="1">
<title>Polynomial</title>
</argument>
<argument index="2">
<title>Variable</title>
</argument>
</builtin_function>
<builtin_function name="ldegree">
<title>Lowest Degree (Valuation)</title>
<names>r:ldegree</names>
<argument index="1">
<title>Polynomial</title>
</argument>
<argument index="2">
<title>Variable</title>
</argument>
</builtin_function>
<builtin_function name="pcontent">
<title>Content Part</title>
<names>r:pcontent</names>
<argument index="1">
<title>Polynomial</title>
</argument>
<argument index="2">
<title>Variable</title>
</argument>
</builtin_function>
<builtin_function name="primpart">
<title>Primitive Part</title>
<names>r:primpart</names>
<argument index="1">
<title>Polynomial</title>
</argument>
<argument index="2">
<title>Variable</title>
</argument>
</builtin_function>
<builtin_function name="punit">
<title>Unit Part</title>
<names>r:punit</names>
<argument index="1">
<title>Polynomial</title>
</argument>
<argument index="2">
<title>Variable</title>
</argument>
</builtin_function>
</category>
<category>
<title>Prime Numbers</title>
<builtin_function name="nthprime">
<title>Nth Prime Number</title>
<names>r:nthprime</names>
<argument index="1">
<title>Index (n)</title>
</argument>
</builtin_function>
<builtin_function name="primePi">
<title>Prime Counting Function</title>
<description>Returns the number of prime numbers less than or equal to the specified number.</description>
<names>r:primePi,ou:primeπ,o:prime_pi</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="nextprime">
<title>Next Prime Number</title>
<description>Returns the next prime number greater than or equal to the specified number.</description>
<names>r:nextprime</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="prevprime">
<title>Previous Prime Number</title>
<description>Returns the largest prime number smaller than or equal to the specified number.</description>
<description></description>
<names>r:prevprime</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="isprime">
<title>Is Prime Number</title>
<names>r:isprime</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="primes">
<title>Prime Numbers Less Than or Equal</title>
<description>Returns a vector containing all the prime numbers less than or equal to the specified number.</description>
<names>r:primes</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
</category>
<builtin_function name="gcd">
<title>Greatest Common Divisor</title>
<names>rc:gcd,c:GCD</names>
<argument index="1">
<title>Value 1</title>
</argument>
<argument index="2">
<title>Value 2</title>
</argument>
<argument index="3">
<title>Value 3</title>
</argument>
</builtin_function>
<builtin_function name="lcm">
<title>Least Common Multiple</title>
<names>r:lcm</names>
<argument index="1">
<title>Value 1</title>
</argument>
<argument index="2">
<title>Value 2</title>
</argument>
<argument index="3">
<title>Value 3</title>
</argument>
</builtin_function>
<builtin_function name="divisors">
<title>Divisors</title>
<names>r:divisors</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="factor">
<title>Factors</title>
<names>r:factor</names>
<description>Performs integer or polynomial factorization, and returns the factors in a vector.
Mode determines the return value for integer factorization as follows.
0: all prime factors
1: factors without duplicates
2: factors and exponents in a matrix with two columns
3: the exponent after each factor in vector</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Mode</title>
</argument>
</builtin_function>
<builtin_function name="bernoulli">
<title>Bernoulli Number/Polynomial</title>
<description>Returns the nth Bernoulli number or polynomial (if the second argument is non-zero).</description>
<names>r:bernoulli</names>
<argument index="1">
<title>Index (n)</title>
</argument>
<argument index="2">
<title>Variable</title>
</argument>
</builtin_function>
<builtin_function name="totient">
<title>Euler's Totient Function</title>
<description>Counts the positive integers up to a given integer n that are relatively prime to n.</description>
<names>r:totient,au:φ,phi</names>
<argument index="1">
<title>n</title>
</argument>
</builtin_function>
<function>
<title>Fibonacci Number</title>
<names>r:fibonacci</names>
<description>Returns the n-th term of the Fibonacci sequence.</description>
<subfunction precalculate="true">\x</subfunction>
<expression>if(isInteger(\1),(golden^\1−(1−golden)^\1)/sqrt(5),(golden^\x-cos(\x*pi*rad)*golden^(-\x))/sqrt(5))</expression>
<argument type="number" index="1">
<title>Index (n)</title>
<test>false</test>
</argument>
</function>
<function>
<title>Multiples</title>
<names>r:multiples</names>
<description>Returns all multiples of a value in the specified range.</description>
<example>$name(9, 50, 100) = [54 63 72 81 90 99]</example>
<expression>if(ceil(\y/abs(\x))>floor(\z/abs(\x)),[],genvector("i"*abs(\x),ceil(\y/abs(\x)),floor(\z/abs(\x)),1,"i",1))</expression>
<condition>\y<=\z</condition>
<argument type="number" index="1">
<title>Value</title>
<zero_forbidden>true</zero_forbidden>
</argument>
<argument type="number" index="2">
<title>Min</title>
<test>false</test>
</argument>
<argument type="number" index="3">
<title>Max</title>
<test>false</test>
</argument>
</function>
<category>
<title>Rounding</title>
<title>Rounding</title>
<builtin_function name="round">
<title>Round</title>
<names>r:round</names>
<description>Round to nearest integer or decimal. If the second argument is zero, the value is rounded towards the nearest integer, otherwise the value is rounded to the corresponding number of digits to the right (if positive) or left (if negative) of the decimal point.
Available rounding methods (3rd argument): half away from zero (0), half to even (1), half to odd (2), half toward zero (3), half up (4), half down (5), half random (6), toward zero (7), away from zero (8), up (9), down (10)</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Number of decimals</title>
</argument>
<argument index="3">
<title>Rounding method</title>
</argument>
</builtin_function>
<builtin_function name="floor">
<title>Round Downwards</title>
<names>r:floor</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="ceil">
<title>Round Upwards</title>
<names>r:ceil</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="trunc">
<title>Round Towards Zero</title>
<names>r:trunc</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="int">
<title>Integer Part</title>
<names>r:int</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="frac">
<title>Fractional Part</title>
<names>r:frac</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="integerDigits">
<title>Integer Digits</title>
<names>r:integerDigits</names>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Base</title>
</argument>
<argument index="3">
<title>Length</title>
</argument>
</builtin_function>
<builtin_function name="digitGet">
<title>Get Digit</title>
<names>r:digitGet,numberDigit</names>
<description>Returns digit at specified position (index of first digit left of decimal sign is zero).</description>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Position</title>
</argument>
<argument index="3">
<title>Base</title>
</argument>
</builtin_function>
<builtin_function name="digitSet">
<title>Set Digit</title>
<names>r:digitSet</names>
<description>Sets the digit at specified position (index of first digit left of decimal sign is zero).</description>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Position</title>
</argument>
<argument index="3">
<title>Value</title>
</argument>
<argument index="4">
<title>Base</title>
</argument>
</builtin_function>
<function>
<title>Clip</title>
<names>r:clip</names>
<description>Clips or limits the input value to be between the lower and upper bounds.</description>
<expression>min(max(\x, \Y{-infinity}), \Z{infinity})</expression>
<condition>\y<=\z</condition>
<argument type="free" index="1">
<title>Value</title>
</argument>
<argument type="number" index="2">
<title>Lower bound</title>
<complex_allowed>false</complex_allowed>
</argument>
<argument type="number" index="3">
<title>Upper bound</title>
<complex_allowed>false</complex_allowed>
</argument>
</function>
</category>
<category>
<title>Number Bases</title>
<builtin_function name="base">
<title>Number Base</title>
<names>r:base</names>
<description>Returns a value from an expression using the specified number base (radix). For bases between -62 and 62 full mathematical expressions (including operators and functions) are supported, while for other bases the specified expression is converted to a single number.
Bases ≤ 36 use digits 0-9 and A-Z (case insensitive).
Bases between 37 and 62 uses case sensitive letters (0-9, A-Z, a-z) as digits ('z' equals 61).
Bases over 62 use Unicode characters as digits, with the character code as value (e.g. '0' equals 48). Escaped characters are in this case supported (e.g. '\0' = 0, '\523' = 523, '\x7f' = 127).
Negative bases use the same digits as the corresponding positive bases and the digits used for non-integer bases are determined by rounding the base away from zero. Bases that are not real numbers by default use digits 0-9 and A-Z.
The set of digits used can be selected using the third argument (defaults to 0 for automatic selection). Set it to 1 for digits 0-9 and A-Z, 2 for 0-9, A-Z and a-z, 3 for Unicode digits, and 4 for phonewords (e.g. ABC=2, DEF=3, etc.), or enter a text string with all digits placed in ascending order (e.g. "0123456789") and optionally separated by semicolon (to enable multiple equivalent digits, e.g. "0;aA1;bB2;cC3"). When the set of digits is manually selected, the specified expression is always converted to a single number.</description>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Base</title>
</argument>
<argument index="3">
<title>Set of digits</title>
</argument>
<argument index="4">
<title>Reverse conversion</title>
</argument>
</builtin_function>
<builtin_function name="bin">
<title>Binary</title>
<names>r:bin</names>
<description>Returns a value from a binary expression. If two's complement is true, numbers beginning with '1' are interpreted as negative binary numbers using two's complement.</description>
<argument index="1">
<title>Binary number</title>
</argument>
<argument index="2">
<title>Two's complement</title>
</argument>
<argument index="3">
<title>Reverse conversion</title>
</argument>
</builtin_function>
<builtin_function name="oct">
<title>Octal</title>
<names>r:oct</names>
<description>Returns a value from an octal expression.</description>
<argument index="1">
<title>Octal number</title>
</argument>
<argument index="2">
<title>Reverse conversion</title>
</argument>
</builtin_function>
<builtin_function name="dec">
<title>Decimal</title>
<names>r:dec</names>
<description>Returns a value from a decimal expression.</description>
<argument index="1">
<title>Decimal number</title>
</argument>
<argument index="2">
<title>Reverse conversion</title>
</argument>
</builtin_function>
<builtin_function name="hex">
<title>Hexadecimal</title>
<names>r:hex</names>
<description>Returns a value from a hexadecimal expression. If two's complement is true, numbers beginning with 8 or higher are interpreted as negative hexadecimal numbers using two's complement.</description>
<argument index="1">
<title>Hexadecimal number</title>
</argument>
<argument index="2">
<title>Two's complement</title>
</argument>
<argument index="3">
<title>Reverse conversion</title>
</argument>
</builtin_function>
<builtin_function name="bijective">
<title>Bijective base-26</title>
<names>r:bijective</names>
<description>Returns a value from an expression in bijective base-26. Conversion in the opposite direction is also supported.</description>
<argument index="1">
<title>Bijective base-26 number</title>
</argument>
</builtin_function>
<builtin_function name="bcd">
<title>Binary-Coded Decimal (BCD)</title>
<names>r:bcd</names>
<argument index="1">
<title>Binary-coded decimal number</title>
</argument>
<argument index="2">
<!-- Packed binary-coded decimal -->
<title>Packed</title>
</argument>
</builtin_function>
</category>
<category>
<title>Integers</title>
<builtin_function name="even">
<title>Even</title>
<names>r:even</names>
<argument index="1">
<title>Number</title>
</argument>
</builtin_function>
<builtin_function name="odd">
<title>Odd</title>
<names>r:odd</names>
<argument index="1">
<title>Number</title>
</argument>
</builtin_function>
</category>
</category>
<category>
<title>Special Functions</title>
<builtin_function name="gamma">
<title>Gamma Function</title>
<names>r:gamma</names>
</builtin_function>
<builtin_function name="digamma">
<title>Digamma Function</title>
<names>r:digamma,psi</names>
</builtin_function>
<builtin_function name="beta">
<title>Beta Function</title>
<names>r:beta</names>
</builtin_function>
<builtin_function name="erf">
<title>Error Function</title>
<names>r:erf</names>
</builtin_function>
<builtin_function name="erfc">
<title>Complementary Error Function</title>
<names>r:erfc</names>
</builtin_function>
<builtin_function name="erfi">
<title>Imaginary Error Function</title>
<names>r:erfi</names>
</builtin_function>
<builtin_function name="erfinv">
<title>Inverse Error Function</title>
<names>r:erfinv</names>
</builtin_function>
<builtin_function name="Li">
<title>Polylogarithm</title>
<names>rc:Li,polylog</names>
<argument index="1">
<title>Order</title>
</argument>
<argument index="2">
<title>Argument</title>
</argument>
</builtin_function>
<builtin_function name="airy">
<title>Airy Function</title>
<names>r:airy</names>
</builtin_function>
<builtin_function name="besselj">
<title>Bessel Function of the First Kind</title>
<names>r:besselj</names>
<argument index="1">
<title>Order</title>
</argument>
<argument index="2">
<title>Argument</title>
</argument>
</builtin_function>
<builtin_function name="bessely">
<title>Bessel Function of the Second Kind</title>
<names>r:bessely</names>
<argument index="1">
<title>Order</title>
</argument>
<argument index="2">
<title>Argument</title>
</argument>
</builtin_function>
<builtin_function name="zeta">
<title>Riemann Zeta</title>
<description>Calculates Hurwitz zeta function if the second argument is not 1.</description>
<names>r:zeta</names>
<argument index="1">
<title>Integral point</title>
</argument>
<argument index="2">
<title>Hurwitz zeta argument</title>
</argument>
</builtin_function>
<function>
<title>Kronecker Delta</title>
<names>r:kronecker,kronecker_delta</names>
<description>Returns 0 if i != j and 1 if i = j.</description>
<expression>\x=\Y{0}</expression>
<argument type="number" index="1">
<title>Value 1 (i)</title>
<complex_allowed>false</complex_allowed>
<test>false</test>
</argument>
<argument type="number" index="2">
<title>Value 2 (j)</title>
<complex_allowed>false</complex_allowed>
<test>false</test>
</argument>
</function>
<function>
<title>Logit Transformation</title>
<names>r:logit</names>
<expression>ln(\x/(1-\x))</expression>
<argument type="number" index="1">
<title>Value</title>
</argument>
</function>
<function>
<title>Probit Function</title>
<names>r:probit</names>
<expression>sqrt(2)*erfinv(2\x-1)</expression>
<argument type="number" index="1">
<title>Value</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
</function>
<function>
<title>Sigmoid Function</title>
<names>r:sigmoid</names>
<expression>1/(1+e^(-\x))</expression>
<argument type="number" index="1">
<title>Value</title>
<test>false</test>
</argument>
</function>
<category>
<title>Step Functions</title>
<builtin_function name="heaviside">
<title>Heaviside Step Function</title>
<names>r:heaviside,au:θ</names>
<description>Discontinuous function also known as "unit step function". Returns 0 if x < 0, 1 if x > 0, and 1/2 if x = 0.</description>
</builtin_function>
<builtin_function name="dirac">
<title>Dirac Delta Function</title>
<names>r:dirac,au:δ</names>
<description>Returns 0 if x is non-zero, and infinity if x is zero.</description>
</builtin_function>
<function>
<title>Ramp Function</title>
<names>r:ramp</names>
<expression>(\x+abs(\x))/2</expression>
<argument type="number" index="1">
<title>Value</title>
<complex_allowed>false</complex_allowed>
<test>false</test>
</argument>
</function>
<function>
<title>Rectangular Function</title>
<names>r:rectangular</names>
<expression>heaviside(\x+(1/2))-heaviside(\x-(1/2))</expression>
<argument type="number" index="1">
<title>Value</title>
<complex_allowed>false</complex_allowed>
<test>false</test>
</argument>
</function>
<function>
<title>Triangular Function</title>
<names>r:triangular</names>
<expression>if(abs(\x)<1,1-abs(\x),0)</expression>
<argument type="number" index="1">
<title>Value</title>
<complex_allowed>false</complex_allowed>
<test>false</test>
</argument>
</function>
</category>
</category>
<category>
<title>Complex Numbers</title>
<builtin_function name="re">
<title>Real Part</title>
<names>r:re,au:ℜ</names>
<argument index="1">
<title>Complex number</title>
</argument>
</builtin_function>
<builtin_function name="im">
<title>Imaginary Part</title>
<names>r:im,au:ℑ</names>
<argument index="1">
<title>Complex number</title>
</argument>
</builtin_function>
<builtin_function name="arg">
<title>Principal Argument</title>
<names>r:arg</names>
<argument index="1">
<title>Complex number</title>
</argument>
</builtin_function>
<function>
<title>Complex Conjugate</title>
<names>r:conj</names>
<expression>re(\x)-i*im(\x)</expression>
<argument type="number" index="1">
<title>Complex number</title>
<test>false</test>
</argument>
</function>
</category>
<category>
<title>Exponents & Logarithms</title>
<builtin_function name="sqrt">
<title>Square Root</title>
<names>au:√,r:sqrt</names>
<description>Returns the principal square root (for positive values the positive root is returned).</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="cbrt">
<title>Cube Root</title>
<names>r:cbrt,aou:∛</names>
<description>Returns the third real root.</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="root">
<title>Nth root</title>
<names>r:root</names>
<description>Returns the real root. For negative values the degree must be odd. Complex values are not allowed.</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<!--nth root argument-->
<title>Degree (n)</title>
</argument>
</builtin_function>
<builtin_function name="allroots">
<title>All Roots</title>
<names>r:allroots</names>
<example>$name(4, 2) = [2 -2]</example>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Degree (n)</title>
</argument>
</builtin_function>
<builtin_function name="sq">
<title>Square</title>
<names>r:sq</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="exp">
<title>Exponential (e^x)</title>
<names>r:exp</names>
<argument index="1">
<title>Exponent</title>
</argument>
</builtin_function>
<builtin_function name="ln">
<title>Natural Logarithm</title>
<names>r:ln</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="log">
<title>Base-N Logarithm</title>
<names>r:log</names>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Base</title>
</argument>
</builtin_function>
<builtin_function name="lambertw">
<title>Lambert W Function (Omega Function, Product Log)</title>
<names>r:lambertw,productlog</names>
<description>Returns the inverse function for x*e^x as ln() does for e^x. Only the principal branch and real valued results are currently supported.</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Branch</title>
</argument>
</builtin_function>
<builtin_function name="cis">
<title>Complex Exponential (Cis)</title>
<names>r:cis</names>
<argument index="1">
<title>Exponent</title>
</argument>
</builtin_function>
<builtin_function name="powertower">
<title>Power Tower</title>
<names>r:powertower</names>
<example>$name(2, 4) = 2^(2^(2^2)) = 65 536</example>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Order</title>
</argument>
</builtin_function>
<function>
<title>Base-2 Logarithm</title>
<names>rs:log2,lb,o:log_2</names>
<expression>log(\x,2)</expression>
<argument type="number" index="1">
<title>Value</title>
<test>false</test>
<min include_equals="true">0</min>
</argument>
</function>
<function>
<title>Base-10 Logarithm</title>
<names>rs:log10,lg,o:log_10</names>
<expression>log(\x,10)</expression>
<argument type="number" index="1">
<title>Value</title>
<test>false</test>
<min include_equals="true">0</min>
</argument>
</function>
<function>
<title>2 raised to the power X</title>
<names>rs:exp2</names>
<expression>2^\x</expression>
<argument type="free" index="1">
<title>Exponent</title>
</argument>
</function>
<function>
<title>10 raised to the power X</title>
<names>rs:exp10</names>
<expression>10^\x</expression>
<argument type="free" index="1">
<title>Exponent</title>
</argument>
</function>
<function>
<title>Square root (x * pi)</title>
<names>r:sqrtpi</names>
<description>Returns the non-negative square root of x * pi</description>
<expression>abs((\x*pi)^(1/2))</expression>
<argument type="number" index="1">
<title>Non-negative value</title>
<min include_equals="true">0</min>
</argument>
</function>
</category>
<category>
<title>Trigonometry</title>
<builtin_function name="sin">
<title>Sine</title>
<names>r:sin</names>
<!-- Angle argument for trigonometric functions -->
<argument index="1">
<title>Angle</title>
</argument>
</builtin_function>
<builtin_function name="cos">
<title>Cosine</title>
<names>r:cos</names>
<argument index="1">
<title>Angle</title>
</argument>
</builtin_function>
<builtin_function name="tan">
<title>Tangent</title>
<names>r:tan</names>
<argument index="1">
<title>Angle</title>
</argument>
</builtin_function>
<builtin_function name="asin">
<title>Inverse Sine</title>
<names>r:arcsin, r:asin</names>
</builtin_function>
<builtin_function name="acos">
<title>Inverse Cosine</title>
<names>r:arccos, r:acos</names>
</builtin_function>
<builtin_function name="atan">
<title>Inverse Tangent</title>
<names>r:arctan, r:atan</names>
</builtin_function>
<builtin_function name="sinh">
<title>Hyperbolic Sine</title>
<names>r:sinh</names>
</builtin_function>
<builtin_function name="cosh">
<title>Hyperbolic Cosine</title>
<names>r:cosh</names>
</builtin_function>
<builtin_function name="tanh">
<title>Hyperbolic Tangent</title>
<names>r:tanh</names>
</builtin_function>
<builtin_function name="asinh">
<title>Inverse Hyperbolic Sine</title>
<names>r:arsinh, r:asinh</names>
</builtin_function>
<builtin_function name="acosh">
<title>Inverse Hyperbolic Cosine</title>
<names>r:arcosh, r:acosh</names>
</builtin_function>
<builtin_function name="atanh">
<title>Inverse Hyperbolic Tangent</title>
<names>r:artanh, r:atanh</names>
</builtin_function>
<builtin_function name="atan2">
<title>Four-quadrant Inverse Tangent</title>
<names>r:atan2, arctan2</names>
<description>Computes the principal value of the argument function applied to the complex number x+iy.</description>
<argument index="1">
<title>Y</title>
</argument>
<argument index="2">
<title>X</title>
</argument>
</builtin_function>
<builtin_function name="sinc">
<title>Cardinal Sine (Sinc Function)</title>
<names>r:sinc</names>
</builtin_function>
<builtin_function name="radtodef">
<title>Radians to Default Angle Unit</title>
<names>r:radtodef</names>
<argument index="1">
<title>Radians</title>
</argument>
</builtin_function>
<function>
<title>Default Angle Unit to Radians</title>
<names>r:deftorad</names>
<expression>\x/radtodef(1)</expression>
<argument index="1">
<title>Value</title>
</argument>
</function>
<function>
<title>Secant</title>
<names>r:sec</names>
<expression>1/cos(\x)</expression>
<argument type="angle" index="1">
<title>Angle</title>
<test>false</test>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Cosecant</title>
<names>r:csc</names>
<expression>1/sin(\x)</expression>
<argument type="angle" index="1">
<title>Angle</title>
<test>false</test>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Cotangent</title>
<names>r:cot</names>
<expression>cos(\x)/sin(\x)</expression>
<argument type="angle" index="1">
<title>Angle</title>
<test>false</test>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Hyperbolic Secant</title>
<names>r:sech</names>
<expression>1/cosh(\x)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
<function>
<title>Hyperbolic Cosecant</title>
<names>r:csch</names>
<expression>1/sinh(\x)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
<function>
<title>Hyperbolic Cotangent</title>
<names>r:coth</names>
<expression>cosh(\x)/sinh(\x)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
<function>
<title>Inverse Secant</title>
<names>r:arcsec, r:asec</names>
<expression>acos(1/\x)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
<function>
<title>Inverse Cosecant</title>
<names>r:arccsc, r:acsc</names>
<expression>asin(1/\x)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
<function>
<title>Inverse Cotangent</title>
<names>r:arccot, r:acot</names>
<expression>if(\x=0,radtodef(pi/2),atan(1/\x),1)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
<function>
<title>Inverse Hyperbolic Secant</title>
<names>r:arsech, r:asech</names>
<expression>acosh(1/\x)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
<function>
<title>Inverse Hyperbolic Cosecant</title>
<names>r:arcsch, r:acsch</names>
<expression>if(\x=0,plus_infinity,asinh(1/\x),1)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
<function>
<title>Inverse Hyperbolic Cotangent</title>
<names>r:arcoth, r:acoth</names>
<expression>if(\x=0,pi/2*i,atanh(1/\x),1)</expression>
<argument type="number" index="1">
<test>false</test>
</argument>
</function>
</category>
<category>
<title>Miscellaneous</title>
<builtin_function name="float">
<title>IEEE 754 Floating-Point</title>
<names>r:float</names>
<description>Reads a number in a IEEE 754 floating-point format. The number will be read as a binary number, unless it contains digits other than 1 or 0. If the third argument (exponent bits) is set to zero, the standard number of exponent bits will be used (e.g. 8 for 32-bit format).</description>
<argument index="1">
<title>Floating-point number (binary)</title>
</argument>
<argument index="2">
<title>Number of bits</title>
</argument>
<argument index="3">
<title>Number of exponent bits</title>
</argument>
<argument index="4">
<title>Position of sign bit</title>
</argument>
</builtin_function>
<builtin_function name="floatBits">
<title>IEEE 754 Floating-Point Bits</title>
<names>r:floatBits</names>
<description>Converts a value to a number in a IEEE 754 floating-point format and returns the number corresponding to the binary representation. If the third argument (exponent bits) is set to zero, the standard number of exponent bits will be used (e.g. 8 for 32-bit format).</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Number of bits</title>
</argument>
<argument index="3">
<title>Number of exponent bits</title>
</argument>
<argument index="4">
<title>Position of sign bit</title>
</argument>
</builtin_function>
<builtin_function name="floatError">
<title>IEEE 754 Floating-Point Error</title>
<names>r:floatError</names>
<description>Calculates the error (the difference between the original and the converted value) when converting a value to a IEEE 754 floating-point format. If the third argument (exponent bits) is set to zero, the standard number of exponent bits will be used (e.g. 8 for 32-bit format).</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Number of bits</title>
</argument>
<argument index="3">
<title>Number of exponent bits</title>
</argument>
<argument index="4">
<title>Position of sign bit</title>
</argument>
</builtin_function>
<builtin_function name="floatParts">
<title>IEEE 754 Floating-Point Components</title>
<names>r:floatParts</names>
<description>Converts a value to a number in a IEEE 754 floating-point format and returns sign, exponent, and significand in a vector. If the third argument (exponent bits) is set to zero, the standard number of exponent bits will be used (e.g. 8 for 32-bit format).</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Number of bits</title>
</argument>
<argument index="3">
<title>Number of exponent bits</title>
</argument>
<argument index="4">
<title>Position of sign bit</title>
</argument>
</builtin_function>
<builtin_function name="floatValue">
<title>IEEE 754 Floating-Point Value</title>
<names>r:floatValue</names>
<description>Returns the closest value that can be represented by a IEEE 754 floating-point format. If the third argument (exponent bits) is set to zero, the standard number of exponent bits will be used (e.g. 8 for 32-bit format).</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Number of bits</title>
</argument>
<argument index="3">
<title>Number of exponent bits</title>
</argument>
<argument index="4">
<title>Position of sign bit</title>
</argument>
</builtin_function>
<builtin_function name="roman">
<title>Roman Number</title>
<names>r:roman</names>
<description>Returns the value of a roman number.</description>
<argument index="1">
<title>Roman number</title>
</argument>
</builtin_function>
<builtin_function name="geodistance">
<title>Distance Between GPS Coordinates</title>
<names>r:geodistance,gpsdistance</names>
<description>Calculates the distance between two geodetic coordinates using Vincenty's formulae (with datum WGS 84), or, in case of failure, the Haversine forumla. Each coordinate can be specified using a numerical value (representing decimal degrees), an angle (e.g. with degree unit), or a text string ending with N, S, E, or W (S for negative latitude, W for negative longitude).</description>
<argument index="1">
<title>Latitude 1</title>
</argument>
<argument index="2">
<title>Longitude 1</title>
</argument>
<argument index="3">
<title>Latitude 2</title>
</argument>
<argument index="4">
<title>Longitude 2</title>
</argument>
</builtin_function>
<function>
<title>Convert to/from Q Format (Fixed Point)</title>
<names>r:qFormat</names>
<expression>if((\A{0}=0&&isInteger(\x)),if(\Z{0}=0,\x/2^\y,\x/2^\z),if([\Z{0}==0,abs(\x)>2^\y],[round(\x*2^\y),sgn(\x)*2^(\y+\z)+warning("overflow")],round(\x*2^\z)))</expression>
<condition>\z=0||abs(\x)<=2^(\y+\z)</condition>
<description>Converts to or from fixed point number. Corresponds to Qm.n format where m is the second argument and n is the third argument. m does not include the sign bit. If the value is an integer, and the fourth argument is false, the value is converted from fixed point, otherwise to.</description>
<argument type="number" index="1">
<title>Value</title>
<handle_vector>true</handle_vector>
</argument>
<argument type="integer" index="2">
<title>Bits (integer part)</title>
<min>0</min>
</argument>
<argument type="integer" index="3">
<title>Bits (fraction part)</title>
<min>0</min>
</argument>
<argument type="boolean" index="4">
<title>Always convert to</title>
</argument>
</function>
<function>
<title>Q Format Error (Fixed Point)</title>
<names>r:qError</names>
<expression>abs(\x-qFormat(qFormat(\x,\y,\Z{0},1),\y,\z,0))</expression>
<argument type="number" index="1">
<title>Value</title>
<handle_vector>true</handle_vector>
</argument>
<argument type="integer" index="2">
<title>Bits (integer part)</title>
<min>0</min>
</argument>
<argument type="integer" index="3">
<title>Bits (fraction part)</title>
<min>0</min>
</argument>
</function>
<function>
<title>Body Mass Index (BMI)</title>
<names>r:bmi</names>
<description>Calculates the Body Mass Index. The resulting BMI-value is sometimes interpreted as follows (although varies with age, sex, etc.):
Underweight < 18.5
Normal weight 18.5-25
Overweight 25-30
Obesity > 30
Note that you must use units for weight (ex. 59kg) and length (ex. 174cm).</description>
<example>$name(127 lb, 5ft + 4in) = 21.80</example>
<expression>(\x/(1000g))/(\y/m)^2</expression>
<argument type="free" index="1">
<title>Weight</title>
</argument>
<argument type="free" index="2">
<!-- Length of human (omit "!human!" from translated string) -->
<title>!human!Height</title>
</argument>
</function>
<function>
<title>RAID Space</title>
<names>r:raid</names>
<description>Calculates RAID array disk capacity usable for data storage. If the combination of number of disks and RAID level is invalid, zero is returned. Supported RAID levels are 0, 1, 2, 3, 4, 5, 6, 1+0/10, 0+1, 5+0/50, 6+0/60, and 1+6. Stripes are optional and only used for nested RAID levels (except 1+0).</description>
<example>$name(4, 12, 5) = 12</example>
<expression>if((\x="0",\x="1"||\x="1E",\x="2",\x="3"||\x="4"||\x="5",\x="6",\x="10"||\x="1+0",\x="01"||\x="0+1",\x="1+6",\x="50"||\x="5+0",\x="60"||\x="6+0"),(\z*\y,if(\z>=2,\y,0),if(\z>=3,(\z-log(\z+1,2))*\y,0),if(\z>=3,(\z-1)*\y,0),if(\z>=4,(\z-2)*\y,0),if(\z>=4&&even(\z),\z/2*\y,0),if(\z>=4,\z/\A{2}*\y,0),if(\z>=8,(\A-2)*\y,0),if(\z>=6,(\z-\A)*\y,0),if(\z>=8,(\z-\A*2)*\y,0)),error("Unknown RAID level"),1)</expression>
<argument type="text" index="1">
<title>RAID level</title>
</argument>
<argument type="free" index="2">
<title>Capacity of each disk</title>
</argument>
<argument type="integer" index="3">
<title>Number of disks</title>
<min>1</min>
</argument>
<argument type="integer" index="4">
<title>Stripes</title>
<min>2</min>
</argument>
</function>
<function>
<title>RAM Latency</title>
<names>r:ramlatency</names>
<example>$name(3600, 18) = 10 ns</example>
<expression>(\A{2}*\y+(\Z{1}-1))/if(isNumber(\x),\x*MHz,\x)</expression>
<argument type="free" index="1">
<title>Data Rate</title>
</argument>
<argument type="number" index="2">
<title>CAS Latency</title>
<min include_equals="false">0</min>
</argument>
<argument type="integer" index="3">
<title>Word</title>
<min>1</min>
</argument>
<argument type="integer" index="4">
<title>Transfers per Clock Cycle</title>
<min>1</min>
</argument>
</function>
<function>
<title>Depth of Field</title>
<names>r:dof</names>
<description>Returns the estimated distance between the nearest and the farthest objects that are in acceptably sharp focus in a photo. Enter focal length (e.g. 50 mm) and distance (e.g. 5 m) with units, and f-stop without unit (2.8, 4.0, 5.6, etc.). Specify either a cicle of confusion diameter limit (e.g. 0.05 mm) or the sensor size of the camera - 0="35mm", 1="APS-H", 2="APS-CN" (Nikon, Pentax, Sony), 3="APS-C" (Canon), 4="4/3" (Four Thirds System), or 5='1"' (Nikon 1, Sony RX10, Sony RX100) - for a diameter based on d/1500.</description>
<example>$name(50 mm, 2.8, 2 m, "APS-C") ≈ 161 mm</example>
<expression approximate="true">2*\z^2*\y*if((\A{0}=0||\a="35mm"||\a="35 mm"||\a=35mm,\a=1||\a="APS-H",\a=2||\a="APS-CN",\a=3||\a="APS-C",\a=4||\a="4/3"||\a=4/3,\a=5||\a='1"'||\a="1"||\a=1in||\a=1),(0.029mm,0.023mm,0.019mm,0.018mm,0.015mm,0.011mm),\a,1))/\x^2</expression>
<argument type="free" index="1">
<title>Focal Length</title>
</argument>
<argument type="number" index="2">
<title>F-stop (aperture)</title>
<min>0</min>
</argument>
<argument type="free" index="3">
<title>Distance</title>
</argument>
<argument type="free" index="4">
<title>Circle of confusion or sensor size</title>
</argument>
</function>
<function>
<title>American Wire Gauge Cross-Section Area</title>
<names>r:awg</names>
<description>For gauges larger than 0000 (4/0), please use negative values (00=-1, 000=-2, 0000=-3, 00000=-4, etc). For conversion to AWG, use an equation (e.g. awg(x) = 20 mm^2).</description>
<expression>25*8464^((36-if((\x="0000"||\x="4/0",\x="000"||\x="3/0",\x="00"||\x="2/0",\x="1/0"),(-3,-2,-1,0),dec(\x),1))/39)*cmil</expression>
<argument type="text" index="1">
<title>AWG</title>
</argument>
</function>
<function>
<title>American Wire Gauge Diameter</title>
<names>r:awgd</names>
<description>For gauges larger than 0000 (4/0), please use negative values (00=-1, 000=-2, 0000=-3, 00000=-4, etc). For conversion to AWG, use an equation (e.g. awgd(x) = 5 mm).</description>
<expression>1.27E-4*92^((36-if((\x="0000"||\x="4/0",\x="000"||\x="3/0",\x="00"||\x="2/0",\x="1/0"),(-3,-2,-1,0),dec(\x),1))/39)*m</expression>
<argument type="text" index="1">
<title>AWG</title>
</argument>
</function>
<function>
<title>Drill Bit Size</title>
<names>r:drillbit</names>
<description>Returns drill bit gauge number or letter, if argument is fraction or diameter value with length unit, or drill bit diameter (with length unit), if argument is an integer or an upper-case character (quoted)</description>
<example>$name("A") = 0.234 in; $name(4.4 mm) = 17</example>
<subfunction precalculate="true">if(isNumber(\x),\x,\x/in)</subfunction>
<subfunction precalculate="true">[0.413,0.404,0.397,0.386,0.377,0.368,0.358,0.348,0.339,0.332,0.323,0.316,0.302,0.295,0.290,0.281,0.277,0.272,0.266,0.261,0.257,0.250,0.246,0.242,0.238,0.234,0.228,0.221,0.213,0.209,0.2055,0.204,0.201,0.199,0.196,0.1935,0.191,0.189,0.185,0.182,0.180,0.177,0.173,0.1695,0.166,0.161,0.159,0.157,0.154,0.152,0.1495,0.147,0.144,0.1405,0.136,0.1285,0.120,0.116,0.113,0.111,0.110,0.1065,0.104,0.1015,0.0995,0.098,0.096,0.0935,0.089,0.086,0.082,0.081,0.0785,0.076,0.073,0.070,0.067,0.0635,0.0595,0.055,0.052,0.0465,0.043,0.042,0.041,0.040,0.039,0.038,0.037,0.036,0.035,0.033,0.032,0.031,0.0292,0.028,0.026,0.025,0.024,0.0225,0.021,0.020,0.018,0.016,0.0145,0.0135,0.013,0.0125,0.012,0.0115,0.011,0.0105,0.010,0.0095,0.0091,0.0087,0.0083,0.0079,0.0075,0.0071,0.0067,0.0063,0.0059,0.0055,0.0051,0.0047,0.0043,0.0039,0.0035,0.0031,0.0027,0.0023,0.0019]</subfunction>
<expression>if((isInteger(\x),isNumber(\1),len(\x)=1&&code(\x)<91&&code(\x)>64),(if(\x>107||\x<1,undefined,element(\2,\x+26)*in),if(sum(\1>(element(\2,"i")+element(\2,"i"+1))/2,1,132,"i")>106,char(sum(\1>(element(\2,"i")+element(\2,"i"+1))/2,1,132,"i")-42),107-sum(\1>(element(\2,"i")+element(\2,"i"+1))/2,1,132,"i")),element(\2,26-(code(\x)-65))*in),undefined, 1)</expression>
<argument index="1">
<title>Diameter or Gauge</title>
</argument>
</function>
</category>
<category>
<title>Statistics</title>
<category>
<title>Descriptive Statistics</title>
<builtin_function name="total">
<title>Sum (total)</title>
<names>r:total,r:add</names>
<argument index="1">
<title>Data</title>
</argument>
</builtin_function>
<builtin_function name="percentile">
<title>Percentile</title>
<names>r:percentile</names>
<argument index="1">
<title>Vector</title>
</argument>
<argument index="2">
<title>Percentile (%)</title>
</argument>
<argument index="3">
<title>Quantile algorithm (as in R)</title>
</argument>
</builtin_function>
<builtin_function name="min">
<title>Min</title>
<names>r:min</names>
<description>Returns the lowest value.</description>
<argument index="1">
<title>Vector</title>
</argument>
</builtin_function>
<builtin_function name="max">
<title>Max</title>
<names>r:max</names>
<description>Returns the highest value.</description>
<argument index="1">
<title>Vector</title>
</argument>
</builtin_function>
<builtin_function name="mode">
<!-- Statistical function ("!statistics!" is removed from title) -->
<title>!statistics!Mode</title>
<names>r:mode</names>
<description>Returns the most frequently occurring value.</description>
<argument index="1">
<title>Vector</title>
</argument>
</builtin_function>
<function>
<title>Range</title>
<names>r:range</names>
<description>Calculates the difference between the min and max value.</description>
<expression>max(\x)-min(\x)</expression>
<argument type="vector" index="1">
<title>Data</title>
</argument>
</function>
<function>
<title>Median</title>
<names>r:median</names>
<expression>percentile(\x,50)</expression>
<argument type="vector" index="1">
<title>Data</title>
</argument>
</function>
<function>
<title>Quartile</title>
<names>r:quartile</names>
<expression>percentile(\x,25*\y,\Z{7})</expression>
<argument type="vector" index="1">
<title>Data</title>
</argument>
<argument type="integer" index="2">
<title>Quartile</title>
<min>0</min>
<max>4</max>
</argument>
<argument type="integer" index="3">
<title>Quantile algorithm (as in R)</title>
<min>1</min>
<max>9</max>
</argument>
</function>
<function>
<title>Decile</title>
<names>r:decile</names>
<expression>percentile(\x,10*\y,\Z{7})</expression>
<argument type="vector" index="1">
<title>Data</title>
</argument>
<argument type="integer" index="2">
<title>Decile</title>
<min>0</min>
<max>10</max>
</argument>
<argument type="integer" index="3">
<title>Quantile algorithm (as in R)</title>
<min>1</min>
<max>9</max>
</argument>
</function>
<function>
<title>Interquartile Range</title>
<names>r:iqr</names>
<description>Calculates the difference between the first and third quartile.</description>
<expression>quartile(\x,3,\Y{7})-quartile(\x,1,\Y{7})</expression>
<argument type="vector" index="1">
<title>Data</title>
</argument>
<argument type="integer" index="2">
<title>Quantile algorithm (as in R)</title>
<min>1</min>
<max>9</max>
</argument>
</function>
<function>
<title>Number of Samples</title>
<!-- Number of samples -->
<names>r:number</names>
<description>Returns the number of samples.</description>
<expression>dimension(\x)</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
</category>
<category>
<title>Random Numbers</title>
<builtin_function name="rand">
<title>Random Number</title>
<names>r:rand</names>
<description>Generates uniformly distributed pseudo-random numbers. Returns real numbers between 0 and 1, if ceil is zero (default), or integers between 1 and (including) ceil.</description>
<argument index="1">
<title>Ceil</title>
</argument>
<argument index="2">
<title>Number of values</title>
</argument>
</builtin_function>
<builtin_function name="randnorm">
<title>Normally Distributed Random Number</title>
<names>r:randnorm</names>
<argument index="1">
<title>Mean</title>
</argument>
<argument index="2">
<title>Standard deviation</title>
</argument>
<argument index="3">
<title>Number of values</title>
</argument>
</builtin_function>
<builtin_function name="randpoisson">
<title>Poisson Distributed Random Number</title>
<names>r:randpoisson</names>
<argument index="1">
<title>Rate (λ)</title>
</argument>
<argument index="2">
<title>Number of values</title>
</argument>
</builtin_function>
<function>
<title>Uniformly Distributed Random Number</title>
<names>r:randuniform</names>
<expression>\x+rand(0,\Z{1})*(\y-\x)</expression>
<condition>\x<=\y</condition>
<argument type="number" index="1">
<title>Lower limit</title>
<complex_allowed>false</complex_allowed>
</argument>
<argument type="number" index="2">
<title>Upper limit</title>
<complex_allowed>false</complex_allowed>
</argument>
<argument type="integer" index="3">
<title>Number of values</title>
<min>1</min>
</argument>
</function>
<function>
<title>Random Number Between Limits</title>
<names>r:randbetween</names>
<description>Returns uniformly distributed random integers between (including) bottom and top.</description>
<expression>rand(\y-\x+1,\Z{1})+\x-1</expression>
<condition>\x<=\y</condition>
<argument type="integer" index="1">
<title>Bottom</title>
</argument>
<argument type="integer" index="2">
<title>Top</title>
</argument>
<argument type="integer" index="3">
<title>Number of values</title>
<min>1</min>
</argument>
</function>
<function>
<title>Exponential Random Number</title>
<names>r:randexp</names>
<expression>-ln(rand(0,\Y{1}))/\x</expression>
<argument type="number" index="1">
<title>Rate parameter</title>
<min>0</min>
</argument>
<argument type="integer" index="2">
<title>Number of values</title>
<min>1</min>
</argument>
</function>
<function>
<title>Rayleigh Distributed Random Number</title>
<names>r:randrayleigh</names>
<expression>\x*sqrt(-2*ln(rand(0,\Y{1})))</expression>
<argument type="number" index="1">
<title>Sigma</title>
<min include_equals="true">0</min>
</argument>
<argument type="integer" index="2">
<title>Number of values</title>
<min>1</min>
</argument>
</function>
</category>
<category>
<title>Means</title>
<function>
<title>Mean</title>
<names>r:mean,average,au:x̄</names>
<expression>total(\x)/dimension(\x)</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Harmonic Mean</title>
<names>r:harmmean</names>
<condition>min(\x)>0</condition>
<expression>dimension(\x)/total(\x.^-1)</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Geometric Mean</title>
<names>r:geomean</names>
<condition>min(\x)>0</condition>
<expression>exp(total(ln(\x))/dimension(\x))</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Trimmed Mean</title>
<names>r:trimmean</names>
<expression>mean(limits(sort(\x),round(dimension(\x)/100*\y)+1,round(dimension(\x)/100*(100-\y))))</expression>
<argument type="vector" index="1">
<title>Data</title>
</argument>
<argument type="free" index="2">
<title>Trimmed percentage (at each end)</title>
</argument>
</function>
<function>
<title>Winsorized Mean</title>
<names>r:winsormean</names>
<subfunction precalculate="true">sort(\x)</subfunction>
<subfunction precalculate="true">dimension(\x)</subfunction>
<subfunction precalculate="true">round(dimension(\x)/100*\y)</subfunction>
<expression>(element(\1,\2-\3)*\3+element(\1,\3+1)*\3+total(limits(\1,\3+1,\2-\3)))/\2</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
<argument type="free" index="2">
<title>Winsorized percentage (at each end)</title>
</argument>
</function>
<function>
<title>Weighted Mean</title>
<names>r:weighmean</names>
<condition>dimension(\x)=dimension(\y)</condition>
<expression>total(\x.*\y)/total(\y)</expression>
<argument type="vector" index="1">
<title>Data</title>
</argument>
<argument type="vector" index="2">
<title>Weights</title>
</argument>
</function>
<function>
<title>Quadratic Mean (RMS)</title>
<names>r:rms</names>
<expression>abs((total(\x.^2)/dimension(\x))^(1/2))</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
</category>
<category>
<title>Moments</title>
<function>
<title>Standard Deviation (entire population)</title>
<names>r:stdevp</names>
<expression>abs(varp(\x)^(1/2))</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Standard Deviation (random sampling)</title>
<names>r:stdev</names>
<expression>abs(var(\x)^(1/2))</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Variance (entire population)</title>
<names>r:varp</names>
<subfunction precalculate="true">mean(\x)</subfunction>
<expression>total((\x-\1).^2)/dimension(\x)</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Variance (random sampling)</title>
<names>r:var</names>
<subfunction precalculate="true">mean(\x)</subfunction>
<expression>total((\x-\1).^2)/(dimension(\x)-1)</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Standard Error</title>
<names>r:stderr</names>
<expression>abs((var(\x)/dimension(\x))^(1/2))</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Mean Deviation</title>
<names>r:meandev</names>
<subfunction precalculate="true">mean(\x)</subfunction>
<expression>total(abs(\x-\1))/dimension(\x)</expression>
<argument type="vector" index="1">
<title>Data</title>
<handle_vector>true</handle_vector>
</argument>
</function>
<function>
<title>Covariance</title>
<names>r:cov,r:covar</names>
<subfunction precalculate="true">mean(\x)</subfunction>
<subfunction precalculate="true">mean(\y)</subfunction>
<condition>dimension(\x)=dimension(\y)</condition>
<expression>total((\x-\1).*(\y-\2))/dimension(\x)</expression>
<argument type="vector" index="1">
<title>Data 1</title>
</argument>
<argument type="vector" index="2">
<title>Data 2</title>
</argument>
</function>
<function>
<title>Pooled Variance</title>
<names>r:poolvar</names>
<subfunction precalculate="true">mean(\x)</subfunction>
<subfunction precalculate="true">mean(\y)</subfunction>
<expression>(total((\x-\1).^2)+total((\y-\2).^2))/(dimension(\x)+dimension(\y)-2)</expression>
<argument type="vector" index="1">
<title>Data 1</title>
</argument>
<argument type="vector" index="2">
<title>Data 2</title>
</argument>
</function>
</category>
<category>
<title>Regression</title>
<function>
<title>Simple Linear Fit</title>
<names>r:linearfit</names>
<description>Returns the linear function, for a set of x and y values, estimated using simple linear regression with a single explanatory variable and the ordinary least squares method. If the vector of y values is empty, the first argument is used for sequential y values (with x values 1, 2, ..., n). It is possible to pass both x and y values in a two column matrix as the first argument.</description>
<condition>dimension(\x)>=2 && (dimension(\x)=dimension(\y) || dimension(\y)=0)</condition>
<subfunction precalculate="true">if((dimension(\Y{[]})>0,rows(\x)>1&&columns(\x)=2),(\x,column(\x,1)),genvector("i",1,dimension(\x),1,"i",1))</subfunction>
<subfunction precalculate="true">if((dimension(\y)>0,rows(\x)>1&&columns(\x)=2),(\y,column(\x,2)),\x)</subfunction>
<expression>((covar(\1,\2)/varp(\1))*(x-mean(\1)))+mean(\2)</expression>
<argument type="vector" index="1">
<title>X values</title>
</argument>
<argument type="vector" index="2">
<title>Y values</title>
</argument>
</function>
<function>
<title>Quadratic Fit</title>
<names>r:quadraticfit</names>
<description>Fit data to a polynomial of degree 2, using least-squares method. If the vector of y values is empty, the first argument is used for sequential y values (with x values 1, 2, ..., n). It is possible to pass both x and y values in a two column matrix as the first argument.</description>
<condition>dimension(\x)>=3 && (dimension(\x)=dimension(\y) || dimension(\y)=0)</condition>
<subfunction precalculate="true">if((dimension(\Y{[]})>0,rows(\x)>1&&columns(\x)=2),(\x,column(\x,1)),genvector("i",1,dimension(\x),1,"i",1))</subfunction>
<subfunction precalculate="true">if((dimension(\y)>0,rows(\x)>1&&columns(\x)=2),(\y,column(\x,2)),\x)</subfunction>
<subfunction precalculate="true">multisolve(("a"*total(\1.^4)+"b"*total(\1.^3)+"c"*total(\1.^2)=total((\1.^2).*\2),"a"*total(\1.^3)+"b"*total(\1.^2)+"c"*total(\1)=total(\1.*\2),"a"*total(\1.^2)+"b"*total(\1)+"c"*dimension(\1)=total(\2)),("a","b","c"))</subfunction>
<expression>element(\3,1)*x^2+element(\3,2)*x+element(\3,3)</expression>
<argument type="vector" index="1">
<title>X values</title>
</argument>
<argument type="vector" index="2">
<title>Y values</title>
</argument>
</function>
<function>
<title>Cubic Fit</title>
<names>r:cubicfit</names>
<description>Fit data to a polynomial of degree 3, using least-squares method. If the vector of y values is empty, the first argument is used for sequential y values (with x values 1, 2, ..., n). It is possible to pass both x and y values in a two column matrix as the first argument.</description>
<condition>dimension(\x)>=4 && (dimension(\x)=dimension(\y) || dimension(\y)=0)</condition>
<subfunction precalculate="true">if((dimension(\Y{[]})>0,rows(\x)>1&&columns(\x)=2),(\x,column(\x,1)),genvector("i",1,dimension(\x),1,"i",1))</subfunction>
<subfunction precalculate="true">if((dimension(\y)>0,rows(\x)>1&&columns(\x)=2),(\y,column(\x,2)),\x)</subfunction>
<subfunction precalculate="true">multisolve(("a"*total(\1.^6)+"b"*total(\1.^5)+"c"*total(\1.^4)+"d"*total(\1.^3)=total((\1.^3).*\2),"a"*total(\1.^5)+"b"*total(\1.^4)+"c"*total(\1.^3)+"d"*total(\1.^2)=total((\1.^2).*\2),"a"*total(\1.^4)+"b"*total(\1.^3)+"c"*total(\1.^2)+"d"*total(\1)=total(\1.*\2),"a"*total(\1.^3)+"b"*total(\1.^2)+"c"*total(\1)+"d"*dimension(\1)=total(\2)),("a","b","c","d"))</subfunction>
<expression>element(\3,1)*x^3+element(\3,2)*x^2+element(\3,3)*x+element(\3,4)</expression>
<argument type="vector" index="1">
<title>X values</title>
</argument>
<argument type="vector" index="2">
<title>Y values</title>
</argument>
</function>
</category>
<category>
<title>Correlation</title>
<function>
<title>Pearson's Correlation Coefficient</title>
<names>r:pearson,r:correl,r:cor</names>
<expression>covar(\x,\y)/(stdevp(\x)*stdevp(\y))</expression>
<argument type="vector" index="1">
<title>Data 1</title>
</argument>
<argument type="vector" index="2">
<title>Data 2</title>
</argument>
</function>
<function>
<title>Spearman's Rho</title>
<names>r:spearman</names>
<condition>dimension(\x)=dimension(\y)</condition>
<expression>pearson(rank(\x),rank(\y))</expression>
<argument type="vector" index="1">
<title>Data 1</title>
</argument>
<argument type="vector" index="2">
<title>Data 2</title>
</argument>
</function>
</category>
<category>
<title>Statistical Tests</title>
<function>
<title>Unpaired T-Test</title>
<names>r:ttest</names>
<subfunction precalculate="true">poolvar(\x,\y)</subfunction>
<expression>(mean(\x)-mean(\y))/abs(((\1)/dimension(\x)+(\1)/dimension(\y))^(1/2))</expression>
<argument type="vector" index="1">
<title>Data 1</title>
</argument>
<argument type="vector" index="2">
<title>Data 2</title>
</argument>
</function>
<function>
<title>Paired T-Test</title>
<names>r:pttest</names>
<expression>mean(\x-\y)/stderr(\x-\y)</expression>
<argument type="vector" index="1">
<title>Data 1</title>
</argument>
<argument type="vector" index="2">
<title>Data 2</title>
</argument>
</function>
</category>
<category>
<title>Distribution</title>
<function>
<title>Binomial Distribution</title>
<names>r:binomdist</names>
<description>Returns the probability mass or cumulative distribution function of the binomial distribution.</description>
<expression>if(\A{0},sum(binomial(\y,"i")*\z^"i"*(1-\z)^(\y-"i"),0,\x,"i"),binomial(\y,\x)*\z^\x*(1-\z)^(\y-\x))</expression>
<argument type="integer" index="1">
<title>Number of successes (k)</title>
<min>0</min>
</argument>
<argument type="integer" index="2">
<title>Number of trials (n)</title>
<min>0</min>
</argument>
<argument type="number" index="3">
<title>Probability (p)</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Exponential Distribution</title>
<names>r:expondist</names>
<description>Returns the probability density or cumulative distribution function of the exponential distribution.</description>
<expression>if(\Z{0},1-e^(-\y*\x),\y*e^(-\y*\x))</expression>
<argument type="number" index="1">
<title>X</title>
<min include_equals="true">0</min>
</argument>
<argument type="number" index="2">
<title>Rate (λ)</title>
<min include_equals="false">0</min>
</argument>
<argument type="boolean" index="3">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Exponential Inverse Cumulative Distribution</title>
<names>r:expinv</names>
<expression>-ln(1-\x)/\y</expression>
<argument type="number" index="1">
<title>P</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
<argument type="number" index="2">
<title>Rate (λ)</title>
<min>0</min>
</argument>
</function>
<function>
<title>Logistic Distribution</title>
<names>r:logistic</names>
<description>Returns the probability density or cumulative distribution function of the logistic distribution.</description>
<expression>if(\A{0},1/(1+e^(-(\x-\Z{0})/\y)),e^(-(\x-\z)/\y)/(\y*(1+e^(-(\x-\z)/\y))^2)</expression>
<argument type="free" index="1">
<title>X</title>
</argument>
<argument type="number" index="2">
<title>Scale (s)</title>
<min include_equals="false">0</min>
</argument>
<argument type="number" index="3">
<title>Location (μ)</title>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Normal Distribution</title>
<names>r:normdist</names>
<description>Returns the probability density or cumulative distribution function of the normal distribution.</description>
<expression>if(\A{0},(1+erf((\x-\Y{0})/(\Z{1}*sqrt(2))))/2,1/\Z*1/(sqrt(2pi))*e^(−1/2*((\x−\Y)/\Z)^2))</expression>
<argument type="free" index="1">
<title>X</title>
</argument>
<argument type="free" index="2">
<title>Mean (μ)</title>
</argument>
<argument type="free" index="3">
<title>Standard deviation (σ)</title>
<condition>\x^2>0</condition>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Inverse Normal Cumulative Distribution</title>
<names>r:normdistinv</names>
<expression>probit(\x)*\Z{1}+\Y{0}</expression>
<argument type="number" index="1">
<title>P</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
<argument type="free" index="2">
<title>Mean (μ)</title>
</argument>
<argument type="free" index="3">
<title>Standard deviation (σ)</title>
<condition>\x^2>0</condition>
</argument>
</function>
<function>
<title>Pareto Distribution</title>
<names>r:pareto</names>
<description>Returns the probability density or cumulative distribution function of the Pareto distribution.</description>
<expression>if(\A{0},1-(\z/\x)^\y,\y*\z^\y/\x^(\y+1))</expression>
<condition>\x>=\z</condition>
<argument type="free" index="1">
<title>X</title>
</argument>
<argument type="number" index="2">
<title>Shape (α)</title>
<min include_equals="false">0</min>
</argument>
<argument type="number" index="3">
<title>Scale (x_m)</title>
<min include_equals="false">0</min>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Poisson Distribution</title>
<names>r:poisson</names>
<description>Returns the probability density or cumulative distribution function of the Poisson distribution.</description>
<expression>if(\Z{0},e^(-\y)*sum((\y^"i")/("i"!),0,floor(\x),"i"),(\y^\x*e^(-\y))/(\x!))</expression>
<argument type="integer" index="1">
<title>X</title>
<min>0</min>
</argument>
<argument type="number" index="2">
<title>Rate (λ)</title>
<min include_equals="false">0</min>
</argument>
<argument type="boolean" index="3">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Rayleigh Distribution</title>
<names>r:rayleigh</names>
<description>Returns the probability density or cumulative distribution function of the Rayleigh distribution.</description>
<expression>if(\Z{0},1-e^(-\x^2/(2\y^2)),\x/\y^2*e^(-\x^2/(2\y^2)))</expression>
<argument type="number" index="1">
<title>X</title>
<min include_equals="true">0</min>
</argument>
<argument type="number" index="2">
<title>Scale (σ)</title>
<min include_equals="false">0</min>
</argument>
<argument type="boolean" index="3">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Rayleigh Tail Distribution</title>
<names>r:rayleightail</names>
<description>Returns the probability density p(x) at x for a Rayleigh tail distribution with scale parameter sigma and a lower limit. (from Gnumeric)</description>
<expression>if(\x<\y,0,(\x/\z)/\z*exp(((\y/\z)+(\x/\z))*((\y/\z)-(\x/\z))/2))</expression>
<argument type="free" index="1">
<title>X</title>
</argument>
<argument type="free" index="2">
<title>Lower limit</title>
</argument>
<argument type="number" index="3">
<title>Scale (σ)</title>
<min include_equals="true">0</min>
</argument>
</function>
<function>
<title>Gamma Distribution</title>
<names>r:gammadist</names>
<description>Returns the probability density or cumulative distribution function of the gamma distribution.</description>
<expression>if(\A{0},1-igamma(\y,\x/\z)/gamma(\y),\x^(\y-1)*e^(-\x/\z)/(gamma(\y)*\z^\y))</expression>
<argument type="number" index="1">
<title>X</title>
<min include_equals="true">0</min>
</argument>
<argument type="number" index="2">
<title>Shape (k)</title>
<min include_equals="false">0</min>
</argument>
<argument type="number" index="3">
<title>Scale (θ)</title>
<min include_equals="false">0</min>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Chi-Square Distribution</title>
<names>r:chisqdist</names>
<description>Returns the probability density or cumulative distribution function of the chi-square distribution.</description>
<expression>gammadist(\x,\y/2,2,\Z{0})</expression>
<argument type="number" index="1">
<title>X</title>
<min include_equals="true">0</min>
</argument>
<argument type="integer" index="2">
<title>Degrees of freedom (k)</title>
<min include_equals="true">1</min>
</argument>
<argument type="boolean" index="3">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Inverse of Chi-Square Cumulative Distribution</title>
<names>r:chisqdistinv</names>
<subfunction precalculate="true">(probit(\x)+sqrt(2*\y-1)^2)/2</subfunction>
<expression>if((\x=0,\x=1),(0,plus_infinity),newtonsolve(1-igamma(\y/2,"x"/2)/gamma(\y/2)=\x,if(\1<=0,1e-6,\1),"x"))</expression>
<argument type="number" index="1">
<title>P</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
<argument type="integer" index="2">
<title>Degrees of freedom (k)</title>
<min include_equals="true">1</min>
</argument>
</function>
<function>
<title>Weibull Distribution</title>
<names>r:weibulldist</names>
<description>Returns the probability density or cumulative distribution function of the Weibull distribution.</description>
<expression>if(\A{0},1-e^(-(\x/\y)^\z),\z/\y*(\x/\y)^(\z-1)*e^(-(\x/\y)^\z))</expression>
<argument type="number" index="1">
<title>X</title>
<min include_equals="true">0</min>
</argument>
<argument type="number" index="2">
<title>Scale (λ)</title>
<min include_equals="false">0</min>
</argument>
<argument type="number" index="3">
<title>Shape (k)</title>
<min include_equals="false">0</min>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Weibull Inverse Cumulative Distribution</title>
<names>r:wblinv</names>
<expression>\y(-ln(1-\x))^(1/\z)</expression>
<argument type="number" index="1">
<title>P</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
<argument type="number" index="2">
<title>Scale (λ)</title>
<min include_equals="false">0</min>
</argument>
<argument type="number" index="3">
<title>Shape (k)</title>
<min include_equals="false">0</min>
</argument>
</function>
<function>
<title>Beta Distribution</title>
<names>r:betadist</names>
<description>Returns the probability density or cumulative distribution function of the beta distribution.</description>
<expression>if(\A{0},betainc(\x,\y,\z),\x^(\y-1)*(1-\x)^(\z-1)/beta(\y,\z))</expression>
<argument type="number" index="1">
<title>X</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
<argument type="number" index="2">
<title>Shape (α)</title>
<min include_equals="false">0</min>
</argument>
<argument type="number" index="3">
<title>Shape (β)</title>
<min include_equals="false">0</min>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Student's t-distribution</title>
<names>r:tdist</names>
<description>Returns the probability density or cumulative distribution function of the Student's t distribution.</description>
<expression>if(\Z{0},if(\x<0,betainc(\y/(\x^2+\y),\y/2,1/2)/2,1-betainc(\y/(\x^2+\y),\y/2,1/2)/2),gamma((\y+1)/2)/(sqrt(\y*pi)*gamma(\y/2))*(1+\x^2/\y)^(-(\y+1)/2))</expression>
<argument type="number" index="1">
<title>X</title>
</argument>
<argument type="number" index="2">
<title>Degrees of freedom (v)</title>
<min>1</min>
</argument>
<argument type="boolean" index="3">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Inverse Cumulative Student's t-distribution</title>
<names>r:tdistinv</names>
<subfunction precalculate="true">betaincinv(if(\x<0.5,2*\x,2*(1-\x)),\y/2,1/2)</subfunction>
<expression>if((\x=0,\x=1,\x<0.5),(minus_infinity,plus_infinity,-sqrt((\y-\1*\y)/\1)),sqrt((\y-\1*\y)/\1))</expression>
<argument type="number" index="1">
<title>P</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
<argument type="number" index="2">
<title>Degrees of freedom (v)</title>
<min>1</min>
</argument>
</function>
<function>
<title>F-distribution</title>
<names>r:fdist</names>
<description>Returns the probability density or cumulative distribution function of the F-distribution.</description>
<expression>if(\A{0},betainc(\y*\x/(\y*\x+\z),\y/2,\z/2),sqrt((\y*\x)^\y*\z^\z/(\y*\x+\z)^(\y+\z))/(\x*beta(\y/2,\z/2)))</expression>
<argument type="number" index="1">
<title>X</title>
<min include_equals="true">0</min>
</argument>
<argument type="integer" index="2">
<title>Degrees of freedom (numerator)</title>
<min>1</min>
</argument>
<argument type="integer" index="3">
<title>Degrees of freedom (denominator)</title>
<min>1</min>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
<function>
<title>Inverse Cumulative F-distribution</title>
<names>r:fdistinv</names>
<subfunction precalculate="true">betaincinv(\x,\y/2,\z/2)</subfunction>
<expression>if(\x=1,plus_infinity,(\1*\z)/(\y-\1*\y))</expression>
<argument type="number" index="1">
<title>P</title>
<min include_equals="true">0</min>
<max include_equals="true">1</max>
</argument>
<argument type="integer" index="2">
<title>Degrees of freedom (numerator)</title>
<min>1</min>
</argument>
<argument type="integer" index="3">
<title>Degrees of freedom (denominator)</title>
<min>1</min>
</argument>
</function>
<function>
<title>Cauchy Distribution</title>
<names>r:cauchydist</names>
<description>Returns the probability density or cumulative distribution function of the Cauchy distribution.</description>
<expression>if(\A{0},1/pi*atan((\x-\y)/\z)+1/2,1/(pi*\z*(1+((\x-\y)/(\z))^2)))</expression>
<argument type="number" index="1">
<title>X</title>
<min include_equals="true">0</min>
</argument>
<argument type="number" index="2">
<title>Location (x_0)</title>
</argument>
<argument type="number" index="3">
<title>Scale (γ)</title>
<min include_equals="false">0</min>
</argument>
<argument type="boolean" index="4">
<title>Cumulative</title>
</argument>
</function>
</category>
</category>
<category>
<title>Date & Time</title>
<builtin_function name="date">
<title>Construct Date</title>
<names>r:date</names>
<description>Returns a date. Available calendars are gregorian (1), hebrew (2), islamic (3), persian (4), indian (5), chinese (6), julian (7), milankovic (8), coptic (9), ethiopian (10), egyptian (11). The Chinese year uses an epoch of 2697 BCE and chinese leap months are indicated by adding 12 to the month number (e.g. leap month 4 = 16).</description>
<argument index="1">
<title>Year</title>
</argument>
<argument index="2">
<title>Month</title>
</argument>
<argument index="3">
<title>Day</title>
</argument>
<argument index="4">
<title>Calendar</title>
</argument>
</builtin_function>
<builtin_function name="datetime">
<title>Construct Date and Time</title>
<names>r:datetime</names>
<argument index="1">
<title>Year</title>
</argument>
<argument index="2">
<title>Month</title>
</argument>
<argument index="3">
<title>Day</title>
</argument>
<argument index="4">
<title>Hour</title>
</argument>
<argument index="5">
<title>Minute</title>
</argument>
<argument index="6">
<title>Second</title>
</argument>
</builtin_function>
<builtin_function name="days">
<title>Days between two dates</title>
<names>r:days</names>
<description>Returns the number of days between two dates.
Basis is the type of day counting you want to use: 0: US 30/360, 1: real days (default), 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<argument index="1">
<title>First date</title>
</argument>
<argument index="2">
<title>Second date</title>
</argument>
<argument index="3">
<title>Day counting basis</title>
</argument>
<argument index="4">
<title>Financial function mode</title>
</argument>
</builtin_function>
<builtin_function name="yearfrac">
<title>Years between two dates</title>
<names>r:yearfrac</names>
<description>Returns the number of years (fractional) between two dates.
Basis is the type of day counting you want to use: 0: US 30/360, 1: real days (default), 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<argument index="1">
<title>First date</title>
</argument>
<argument index="2">
<title>Second date</title>
</argument>
<argument index="3">
<title>Day counting basis</title>
</argument>
<argument index="4">
<title>Financial function mode</title>
</argument>
</builtin_function>
<builtin_function name="week">
<title>Week of Year</title>
<names>r:week</names>
<argument index="1">
<title>Date</title>
</argument>
<argument index="2">
<title>Week begins on Sunday</title>
</argument>
</builtin_function>
<builtin_function name="weekday">
<title>Day of Week</title>
<names>r:weekday</names>
<argument index="1">
<title>Date</title>
</argument>
<argument index="2">
<title>Week begins on Sunday</title>
</argument>
</builtin_function>
<builtin_function name="month">
<title>Month</title>
<names>r:month</names>
<argument index="1">
<title>Date</title>
</argument>
</builtin_function>
<builtin_function name="day">
<title>Day of Month</title>
<names>r:day</names>
<argument index="1">
<title>Date</title>
</argument>
</builtin_function>
<builtin_function name="year">
<title>Year</title>
<names>r:year</names>
<argument index="1">
<title>Date</title>
</argument>
</builtin_function>
<builtin_function name="yearday">
<title>Day of Year</title>
<names>r:yearday</names>
<argument index="1">
<title>Date</title>
</argument>
</builtin_function>
<builtin_function name="time">
<title>Current Time</title>
<names>r:time</names>
</builtin_function>
<builtin_function name="timevalue">
<title>Time Value</title>
<names>r:timevalue</names>
<description>Returns the time part, in fractional hours, of a date and time value.</description>
<argument index="1">
<title>Date</title>
</argument>
</builtin_function>
<builtin_function name="timestamp">
<title>Date to Unix Timestamp</title>
<names>r:timestamp</names>
<argument index="1">
<title>Date</title>
</argument>
</builtin_function>
<builtin_function name="stamptodate">
<title>Unix Timestamp to Date</title>
<names>r:stamptodate,unix2date</names>
<description>Returns the local date and time represented by the specified Unix timestamp (seconds, excluding leap seconds, since 1970-01-01). Supports time units.</description>
<argument index="1">
<title>Timestamp</title>
</argument>
</builtin_function>
<builtin_function name="addDays">
<title>Add Days</title>
<names>r:addDays</names>
<argument index="1">
<title>Date</title>
</argument>
<argument index="2">
<title>Days</title>
</argument>
</builtin_function>
<builtin_function name="addMonths">
<title>Add Months</title>
<names>r:addMonths</names>
<argument index="1">
<title>Date</title>
</argument>
<argument index="2">
<title>Months</title>
</argument>
</builtin_function>
<builtin_function name="addYears">
<title>Add Years</title>
<names>r:addYears</names>
<argument index="1">
<title>Date</title>
</argument>
<argument index="2">
<title>Years</title>
</argument>
</builtin_function>
<function>
<title>Add Time</title>
<names>r:addTime</names>
<description>Adds a time value to a date. The value can be positive or negative, but must use a unit based on seconds (such as day and year).</description>
<expression>\x+\y</expression>
<example>$name(today, 10 d) = today + 10 d; $name(2025-10-05T07:48, 10 min) = "2025-10-05T07:48" + 10 min = "2025-10-05T07:58"</example>
<argument type="date" index="1">
<title>Date</title>
</argument>
<argument index="2">
<title>Time</title>
<condition>isNumber(\x/s)</condition>
</argument>
</function>
<builtin_function name="lunarphase">
<title>Lunar Phase</title>
<names>r:lunarphase</names>
<description>Returns the lunar phase, as a number between 0 and 1, for the specified date. This value corresponds to an angle between 0 and 360 degrees. 0 represents new moon, 0.5 full moon, and 0.25 and 0.75 quarter moons.</description>
<argument type="date" index="1">
<title>Date</title>
</argument>
</builtin_function>
<builtin_function name="nextlunarphase">
<title>Find Lunar Phase</title>
<names>r:nextlunarphase</names>
<description>Returns the date when the specified lunar phase occurs. The function searches forward beginning at the specified date. The lunar phase is specified as a number between 0 and 1, where 0 represents new moon, 0.5 full moon, and 0.25 and 0.75 quarter moons. Angle values are also allowed (e.g. π rad = 180° which corresponds to a value of 0.5). Values above 1, without unit, are interpreted as degrees.</description>
<argument type="date" index="1">
<title>Lunar phase</title>
</argument>
<argument index="2">
<title>Start date</title>
</argument>
</builtin_function>
<function>
<title>Days in Month</title>
<names>r:daysInMonth</names>
<subfunction precalculate="true">month(\X{today})</subfunction>
<subfunction precalculate="true">year(\x)</subfunction>
<expression>if((\1=2,\1=4||\1=6||\1=9||\1=11),(if(\2%4=0&&(\2%100!=0||\2%400==0),29,28),30),31)</expression>
<argument type="date" index="1">
<title>Date</title>
</argument>
</function>
</category>
<category>
<title>Utilities</title>
<category>
<title>Intervals & Uncertainties</title>
<builtin_function name="interval">
<title>Interval</title>
<names>r:interval</names>
<description>Returns a closed interval with the specified endpoints.</description>
<argument index="1">
<title>Lower endpoint</title>
</argument>
<argument index="2">
<title>Upper endpoint</title>
</argument>
</builtin_function>
<builtin_function name="uncertainty">
<title>Uncertainty</title>
<names>r:uncertainty</names>
<description>Specifies the absolute or relative (default) uncertainty/error of a value.</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Uncertainty</title>
</argument>
<argument index="3">
<title>Uncertainty is relative</title>
</argument>
</builtin_function>
<builtin_function name="lowerEndpoint">
<title>Lower Endpoint (interval)</title>
<names>r:lowerEndpoint</names>
<description>Returns the lower endpoint of a numerical interval.</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="upperEndpoint">
<title>Upper Endpoint (interval)</title>
<names>r:upperEndpoint</names>
<description>Returns the upper endpoint of a numerical interval.</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="midpoint">
<title>Midpoint (interval)</title>
<names>r:midpoint,valuePart</names>
<description>Returns the midpoint between the endpoints of a numerical interval, or the value part of a value with uncertainty/error.</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="errorPart">
<title>Get Uncertainty</title>
<names>r:errorPart</names>
<description>Returns the absolute (default) or relative uncertainty/error of a numerical value.</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Uncertainty is relative</title>
</argument>
</builtin_function>
</category>
<builtin_function name="plot">
<title>Plot Functions and Vectors</title>
<names>r:plot</names>
<example>$name(5x + 2, -10, 10)</example>
<argument index="1">
<title>Expression or vector</title>
</argument>
<argument index="2">
<title>Minimum x value</title>
</argument>
<argument index="3">
<title>Maximum x value</title>
</argument>
<argument index="4">
<title>Options</title>
</argument>
</builtin_function>
<builtin_function name="code">
<title>Unicode Value</title>
<names>r:code</names>
<description>Encodes a Unicode character or text string using the selected format. Supported encodings are UTF-8 (0), UTF-16 (1), and UTF-32 (2). If the third argument is true, each separate code unit (8, 16, or 32 bits depending on encoding) is placed in a vector.</description>
<argument index="1">
<title>Character</title>
</argument>
<argument index="2">
<title>Encoding</title>
</argument>
<argument index="3">
<title>Use vector</title>
</argument>
</builtin_function>
<builtin_function name="char">
<title>Unicode Character</title>
<names>r:char</names>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="len">
<title>Length of string</title>
<names>r:len</names>
<argument index="1">
<title>Text</title>
</argument>
</builtin_function>
<builtin_function name="concatenate">
<title>Concatenate Strings</title>
<names>r:concatenate</names>
<argument index="1">
<title>Text string 1</title>
</argument>
<argument index="2">
<title>Text string 2</title>
</argument>
</builtin_function>
<builtin_function name="replace">
<title>Replace</title>
<names>r:replace</names>
<description>Replaces a certain value in an expression with a new value. The expression is calculated before the replacement if the fourth argument is true.</description>
<argument index="1">
<title>Expression</title>
</argument>
<argument index="2">
<title>Original value</title>
</argument>
<argument index="3">
<title>New value</title>
</argument>
<argument index="4">
<title>Precalculate expression</title>
</argument>
</builtin_function>
<builtin_function name="nounit">
<title>Strip Units</title>
<names>r:nounit,strip_units</names>
<description>Removes all units from an expression. No unit conversion or prefix changes are performed before the removal.</description>
<example>$name(5 km) = 5; $name(5 m + 2 ft) = 7</example>
<argument index="1">
<title>Expression</title>
</argument>
</builtin_function>
<builtin_function name="process">
<title>Process Vector Elements</title>
<names>r:process</names>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>Element variable</title>
</argument>
<argument index="3">
<title>Vector</title>
</argument>
<argument index="4">
<title>Index variable</title>
</argument>
<argument index="5">
<title>Vector variable</title>
</argument>
</builtin_function>
<builtin_function name="processm">
<title>Process Matrix Elements</title>
<names>r:processm</names>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>Element variable</title>
</argument>
<argument index="3">
<title>Matrix</title>
</argument>
<argument index="4">
<title>Row variable</title>
</argument>
<argument index="5">
<title>Column variable</title>
</argument>
<argument index="6">
<title>Matrix variable</title>
</argument>
</builtin_function>
<builtin_function name="csum">
<title>Custom Sum of Elements</title>
<names>r:csum</names>
<argument index="1">
<title>First element</title>
</argument>
<argument index="2">
<title>Last element</title>
</argument>
<argument index="3">
<title>Initial value</title>
</argument>
<argument index="4">
<title>Function</title>
</argument>
<argument index="5">
<title>Element variable</title>
</argument>
<argument index="6">
<title>Value variable</title>
</argument>
<argument index="7">
<title>Vector</title>
</argument>
<argument index="8">
<title>Index variable</title>
</argument>
<argument index="9">
<title>Vector variable</title>
</argument>
</builtin_function>
<builtin_function name="select">
<title>Select Vector Elements</title>
<names>r:select</names>
<argument index="1">
<title>Vector</title>
</argument>
<argument index="2">
<title>Condition</title>
</argument>
<argument index="3">
<title>Element variable</title>
</argument>
<argument index="4">
<title>Select first match</title>
</argument>
</builtin_function>
<builtin_function name="function">
<title>Function</title>
<names>r:function</names>
<example>$name(x + y, 1, 2) = 1 + 2 = 3</example>
<argument index="1">
<title>Expression</title>
</argument>
<argument index="2">
<title>Argument 1</title>
</argument>
<argument index="3">
<title>Argument 2</title>
</argument>
</builtin_function>
<builtin_function name="title">
<title>Title</title>
<names>r:title</names>
<argument index="1">
<title>Name</title>
</argument>
</builtin_function>
<builtin_function name="error">
<title>Display Error</title>
<names>r:error</names>
<argument index="1">
<title>Message</title>
</argument>
</builtin_function>
<builtin_function name="warning">
<title>Display Warning</title>
<names>r:warning</names>
<argument index="1">
<title>Message</title>
</argument>
</builtin_function>
<builtin_function name="message">
<title>Display Message</title>
<names>r:message</names>
<argument index="1">
<title>Message</title>
</argument>
</builtin_function>
<builtin_function name="save">
<title>Save as Variable or Function</title>
<names>r:save</names>
<description>Stores a value in a variable or saves an expression as a function.
A function is created if the name includes parentheses (e.g. "f()"). Optionally the function arguments can be specified in the name (e.g. "save(a+b,f(a,b))"). Otherwise the function arguments are expected to be referred to in the expression using \x, \y, \z, \a, \b, ..., or x, y, z (e.g. "save(x+y,f())").
If a function was created, the processed function expression is returned as a text string, otherwise the value is returned.
The ":=" operator (e.g. var1:=10) is a shortcut for this function.</description>
<argument index="1">
<title>Value</title>
</argument>
<argument index="2">
<title>Name</title>
</argument>
<argument index="3">
<title>Category</title>
</argument>
<argument index="4">
<title>Title</title>
</argument>
<argument index="5">
<title>Precalculate expression</title>
</argument>
</builtin_function>
<builtin_function name="register">
<title>RPN Stack Register</title>
<names>r:register</names>
<description>Returns the value of a RPN stack register.</description>
<argument index="1">
<title>Index</title>
</argument>
</builtin_function>
<builtin_function name="stack">
<title>RPN Stack Vector</title>
<names>r:stack</names>
<description>Returns the RPN stack as a vector.</description>
</builtin_function>
<builtin_function name="isNumber">
<title>Is Number</title>
<names>r:isNumber</names>
<description>Returns true if evaluated argument value is explicitly a real, complex, or infinite number (has number type).</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="isReal">
<title>Is Real</title>
<names>r:isReal</names>
<description>Returns true if evaluated argument value is explicitly a real number (has number type with zero imaginary part).</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="isRational">
<title>Is Rational</title>
<names>r:isRational</names>
<description>Returns true if evaluated argument value is explicitly a rational number (has rational type).</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="isInteger">
<title>Is Integer</title>
<names>r:isInteger</names>
<description>Returns true if evaluated argument value is explicitly an integer (has integer type).</description>
<example>$name(5 + 2) = 1; $name(x) = 0; $name(log(0.2, 5)) = 0</example>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="representsNumber">
<title>Represents Number</title>
<names>r:representsNumber</names>
<description>Returns true if value is or represents a number (scalar without unit). False negatives are allowed.</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="representsReal">
<title>Represents Real</title>
<names>r:representsReal</names>
<description>Returns true if value is or represents a real number. False negatives are allowed.</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="representsRational">
<title>Represents Rational</title>
<names>r:representsRational</names>
<description>Returns true if value is or represents a rational number. False negatives are allowed.</description>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="representsInteger">
<title>Represents Integer</title>
<names>r:representsInteger</names>
<description>Returns true if value is or represents an integer. False negatives are allowed.</description>
<example>$name(2n) = 1; $name(log(0.2, 5)) = 0</example>
<argument index="1">
<title>Value</title>
</argument>
</builtin_function>
<builtin_function name="command">
<title>External Command</title>
<names>r:command</names>
<argument index="1">
<title>Command</title>
</argument>
<argument index="2">
<title>Argument</title>
</argument>
</builtin_function>
</category>
<category>
<title>Logical</title>
<builtin_function name="for">
<title>For...Do</title>
<names>r:for</names>
<example>$name(1, x, x < 10, x + 1, 2, y * x, y) = 725 760</example>
<argument index="1">
<title>Initial value of counter</title>
</argument>
<argument index="2">
<title>Counter variable</title>
</argument>
<argument index="3">
<title>For condition</title>
</argument>
<argument index="4">
<title>Counter update function</title>
</argument>
<argument index="5">
<title>Initial value</title>
</argument>
<argument index="6">
<title>Do function</title>
</argument>
<argument index="7">
<title>Value variable</title>
</argument>
</builtin_function>
<builtin_function name="foreach">
<title>For Each Element...Do</title>
<names>r:foreach</names>
<example>$name(1...5, 0, y + x) = 15</example>
<argument index="1">
<title>Matrix/vector</title>
</argument>
<argument index="2">
<title>Initial value</title>
</argument>
<argument index="3">
<title>Do function</title>
</argument>
<argument index="4">
<title>Value variable</title>
</argument>
<argument index="5">
<title>Element variable</title>
</argument>
</builtin_function>
<builtin_function name="if">
<title>If...Then...Else</title>
<names>r:if</names>
<description>Tests a condition and returns a value depending on the result. Vectors can be used for argument 1 and 2, instead of nested functions.</description>
<argument index="1">
<title>Condition</title>
</argument>
<argument index="2">
<title>Expression if condition is met</title>
</argument>
<argument index="3">
<title>Expression if condition is NOT met</title>
</argument>
<argument index="4">
<title>Assume false if not true</title>
</argument>
</builtin_function>
<builtin_function name="xor">
<title>Bitwise Exclusive OR</title>
<names>r:xor</names>
<argument index="1">
<title>Value 1</title>
</argument>
<argument index="2">
<title>Value 2</title>
</argument>
</builtin_function>
<builtin_function name="lxor">
<title>Logical Exclusive OR</title>
<names>r:lxor</names>
<argument index="1">
<title>Value 1</title>
</argument>
<argument index="2">
<title>Value 2</title>
</argument>
</builtin_function>
<builtin_function name="shift">
<title>Bitwise Shift</title>
<description>Applies logical or arithmetic bitwise shift to an integer. The second argument specifies the number of steps that each binary bit is shifted to the left (use negative values for right shift).</description>
<names>r:shift</names>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Steps</title>
</argument>
<argument index="3">
<title>Arithmetic shift using two's complement</title>
</argument>
</builtin_function>
<builtin_function name="bitcmp">
<title>Bitwise Complement (Not)</title>
<description>Applies bitwise NOT to an integer of specified bit width and signedness (use 1 for signed and 0 for unsigned). If bit width is zero, the smallest necessary number of bits (of 8, 16, 32, 64, 128, ...) will be used.</description>
<names>r:bitcmp</names>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Bit width</title>
</argument>
<argument index="3">
<title>Signed integer</title>
</argument>
</builtin_function>
<builtin_function name="bitrot">
<title>Bit Rotation</title>
<description>Applies circular bitwise shift to an integer of specified bit width and signedness (use 1 for signed and 0 for unsigned). The second argument specifies the number of steps that each binary bit is shifted to the left (use negative values for right shift). If bit width is zero, the smallest necessary number of bits (of 8, 16, 32, 64, 128, ...) will be used.</description>
<names>r:bitrot</names>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Steps</title>
</argument>
<argument index="3">
<title>Bit width</title>
</argument>
<argument index="4">
<title>Signed integer</title>
</argument>
</builtin_function>
<builtin_function name="bitset">
<title>Set Bit</title>
<description>Set binary bit at specified position. The index of the least significant bit is 1. Specify bit width and signedness (use 1 for signed and 0 for unsigned) to allow sign changes when the most significant bit is set.</description>
<example>$name(8, 3) = 12</example>
<names>r:bitset</names>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Position</title>
</argument>
<argument index="3">
<title>Value</title>
</argument>
<argument index="4">
<title>Bit width</title>
</argument>
<argument index="5">
<title>Signed integer</title>
</argument>
</builtin_function>
<builtin_function name="setbits">
<title>Set Multiple Bits</title>
<description>Set binary bits at specified range with binary bits from an integer (index 1 to length of range). The index of the least significant bit is 1. Specify bit width and signedness (use 1 for signed and 0 for unsigned) to allow sign changes when the most significant bit is set.</description>
<example>$name(0xFFFF, 9, 12, 0xA) = 0xFAFF</example>
<names>r:setbits</names>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>First position</title>
</argument>
<argument index="3">
<title>Last position</title>
</argument>
<argument index="4">
<title>Value</title>
</argument>
<argument index="5">
<title>Bit width</title>
</argument>
<argument index="6">
<title>Signed integer</title>
</argument>
</builtin_function>
<builtin_function name="bitget">
<title>Get Bit</title>
<description>Returns the binary bit at the specified position. The index of the least significant bit is 1. If last index is non-zero the bits from (first) position to, and including, last position are returned as a new binary number.</description>
<example>$name(12, 3) = 1; $name(0b01011100, 2; 4) = 0b00000110 = 6</example>
<names>r:bitget</names>
<argument index="1">
<title>Number</title>
</argument>
<argument index="2">
<title>Position</title>
</argument>
<argument index="3">
<title>Last position</title>
</argument>
</builtin_function>
</category>
<category>
<title>Algebra</title>
<builtin_function name="sum">
<title>Summation</title>
<names>au:Σ,au:∑,r:sum</names>
<description>Corresponds to the summation symbol. Adds terms for each x ranging from the lower to the upper limit.</description>
<example>$name(x^2, 1, 5) = 1^2 + 2^2 + 3^2 + 4^2 + 5^2 = 55</example>
<argument index="1">
<title>Term expression</title>
</argument>
<argument index="2">
<title>Lower limit (i)</title>
</argument>
<argument index="3">
<title>Upper limit (n)</title>
</argument>
<argument index="4">
<title>Index variable</title>
</argument>
</builtin_function>
<builtin_function name="product">
<title>Product of a sequence</title>
<names>au:Π,r:product</names>
<description>Corresponds to the product symbol. Multiplies factors for each x ranging from the lower to the upper limit.</description>
<example>$name(x^2, 1, 5) = 1^2 * 2^2 * 3^2 * 4^2 * 5^2 = 14400</example>
<argument index="1">
<title>Factor expression</title>
</argument>
<argument index="2">
<title>Lower limit (i)</title>
</argument>
<argument index="3">
<title>Upper limit (n)</title>
</argument>
<argument index="4">
<title>Index variable</title>
</argument>
</builtin_function>
<builtin_function name="multisolve">
<title>Solve for multiple variables</title>
<names>r:multisolve</names>
<argument index="1">
<title>Equation vector</title>
</argument>
<argument index="2">
<title>Variable vector</title>
</argument>
</builtin_function>
<builtin_function name="solve">
<title>Solve equation</title>
<names>r:solve</names>
<argument index="1">
<title>Equation</title>
</argument>
<argument index="2">
<title>With respect to</title>
</argument>
</builtin_function>
<builtin_function name="dsolve">
<title>Solve differential equation</title>
<names>r:dsolve</names>
<argument index="1">
<title>Equation</title>
</argument>
<argument index="2">
<title>Initial condition: function value (y)</title>
</argument>
<argument index="3">
<title>Initial condition: argument value (x)</title>
</argument>
<description>Solves a differential equation and returns the value of y(x). The derivative in the equation should be in the format diff(y, x). Only first-order differential equations are currently supported.</description>
<example>$name(2 * diff(y, x) - y = 4x, 5, 2) = 21e^(x/2) / e - 4x - 8</example>
</builtin_function>
<builtin_function name="newtonsolve">
<title>Solve using Newton's Method</title>
<names>r:newtonsolve</names>
<argument index="1">
<title>Equation</title>
</argument>
<argument index="2">
<title>Initial estimate</title>
</argument>
<argument index="3">
<title>Variable</title>
</argument>
<argument index="4">
<title>Precision</title>
</argument>
<argument index="5">
<title>Max iterations</title>
</argument>
</builtin_function>
<builtin_function name="secantsolve">
<title>Solve using Secant Method</title>
<names>r:secantsolve</names>
<argument index="1">
<title>Equation</title>
</argument>
<argument index="2">
<title>Initial estimate 1</title>
</argument>
<argument index="3">
<title>Initial estimate 2</title>
</argument>
<argument index="4">
<title>Variable</title>
</argument>
<argument index="5">
<title>Precision</title>
</argument>
<argument index="6">
<title>Max iterations</title>
</argument>
</builtin_function>
<function>
<title>Solve for two variables</title>
<names>r:solve2</names>
<description>Solves two equations with two unknown variables. Returns the value of the first variable.</description>
<expression>solve(replace(\x,\A{y},solve(\y,\A)),\Z{x})</expression>
<argument index="1" type="free">
<title>Equation 1</title>
</argument>
<argument index="2" type="free">
<title>Equation 2</title>
</argument>
<argument index="3" type="symbol">
<title>Variable 1</title>
</argument>
<argument index="4" type="symbol">
<title>Variable 2</title>
</argument>
</function>
<function>
<title>Find Linear Function</title>
<names>r:linearfunction</names>
<description>Finds the linear function for the straight line between two distinct points.</description>
<expression>(\a-\y)/(\z-\x)*("x"-\x)+\y</expression>
<argument type="free" index="1">
<title>x1</title>
</argument>
<argument type="free" index="2">
<title>y1</title>
</argument>
<argument type="free" index="3">
<title>x2</title>
</argument>
<argument type="free" index="4">
<title>y2</title>
</argument>
</function>
</category>
<category>
<title>Calculus</title>
<builtin_function name="diff">
<title>Differentiate</title>
<names>r:diff,derivative</names>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>With respect to</title>
</argument>
<argument index="3">
<title>Order</title>
</argument>
<argument index="4">
<title>Variable value</title>
</argument>
</builtin_function>
<builtin_function name="integrate">
<title>Integrate</title>
<names>r:integrate,integral,au:∫</names>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>Lower limit</title>
</argument>
<argument index="3">
<title>Upper limit</title>
</argument>
<argument index="4">
<title>Variable of integration</title>
</argument>
<argument index="5">
<title>Force numerical integration</title>
</argument>
</builtin_function>
<builtin_function name="romberg">
<title>Romberg Integration</title>
<names>r:romberg</names>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>Lower limit</title>
</argument>
<argument index="3">
<title>Upper limit</title>
</argument>
<argument index="4">
<title>Min iterations</title>
</argument>
<argument index="5">
<title>Max iterations</title>
</argument>
<argument index="6">
<title>Variable of integration</title>
</argument>
</builtin_function>
<builtin_function name="montecarlo">
<hidden>true</hidden>
<title>Monte Carlo Integration</title>
<names>r:montecarlo</names>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>Lower limit</title>
</argument>
<argument index="3">
<title>Upper limit</title>
</argument>
<argument index="4">
<title>Number of samples</title>
</argument>
<argument index="5">
<title>Variable of integration</title>
</argument>
</builtin_function>
<builtin_function name="limit">
<title>Limit</title>
<description>Returns the two-sided limit of the function if direction is zero, limit from left (below) if direction is -1, or limit from right (above) if direction is +1.</description>
<names>r:limit</names>
<argument index="1">
<title>Function</title>
</argument>
<argument index="2">
<title>Value to approach</title>
</argument>
<argument index="3">
<title>Variable</title>
</argument>
<argument index="4">
<title>Direction</title>
</argument>
</builtin_function>
<function>
<title>Limit with Multiple Variables</title>
<names>r:multilimit</names>
<description>Returns limit of a function for multiple variables. The limit is calculated recursively, for one variable in each iteration, with the result of each iteration used as function in the next.</description>
<example>$name(x^2/(x+y)*y, [x y], [-2 1]) = -4</example>
<condition>dimension(\y)=dimension(\z)</condition>
<expression>foreach(1...dimension(\y),\x,limit("$mlvalue",element(\z,"$mlindex"),element(\y,"$mlindex"),element(\A{0},if(dimension(\A)<"$mlindex",dimension(\A),"$mlindex"))),"$mlvalue","$mlindex")</expression>
<argument type="free" index="1">
<title>Function</title>
</argument>
<argument type="vector" index="2">
<title>Variable vector</title>
</argument>
<argument type="vector" index="3">
<title>Value vector</title>
</argument>
<argument type="vector" index="4">
<title>Direction vector</title>
</argument>
</function>
<function>
<title>Extreme Values</title>
<names>r:extremum</names>
<expression>solve(diff(\x, \Y{x})=0, \Y)</expression>
<argument type="free" index="1">
<title>Function</title>
</argument>
<argument type="symbol" index="2">
<title>With respect to</title>
</argument>
</function>
<category>
<title>Named Integrals</title>
<builtin_function name="li">
<title>Logarithmic Integral</title>
<names>rc:li,logint</names>
<description>The integral of 1/ln(x).</description>
</builtin_function>
<builtin_function name="Ei">
<title>Exponential Integral</title>
<names>rc:Ei,expint</names>
<description>The integral of e^x/x.</description>
</builtin_function>
<builtin_function name="Si">
<title>Sine Integral</title>
<names>rc:Si,sinint</names>
<description>The integral of sin(x)/x.</description>
</builtin_function>
<builtin_function name="Ci">
<title>Cosine Integral</title>
<names>rc:Ci,cosint</names>
<description>The integral of cos(x)/x.</description>
</builtin_function>
<builtin_function name="Shi">
<title>Hyperbolic Sine Integral</title>
<names>rc:Shi,sinhint</names>
<description>The integral of sinh(x)/x.</description>
</builtin_function>
<builtin_function name="Chi">
<title>Hyperbolic Cosine Integral</title>
<names>rc:Chi,coshint</names>
<description>The integral of cosh(x)/x.</description>
</builtin_function>
<builtin_function name="fresnels">
<title>Fresnel Integral S</title>
<names>r:fresnels</names>
<description>The integral of sin(pi*x^2/2).</description>
</builtin_function>
<builtin_function name="fresnelc">
<title>Fresnel Integral C</title>
<names>r:fresnelc</names>
<description>The integral of cos(pi*x^2/2).</description>
</builtin_function>
<builtin_function name="igamma">
<title>Upper Incomplete Gamma Function</title>
<names>r:igamma</names>
</builtin_function>
<function>
<title>Lower Incomplete Gamma Function</title>
<names>r:gammainc</names>
<expression>gamma(\x)-igamma(\x,\y)</expression>
</function>
<builtin_function name="betainc">
<title>Regularized Incomplete Beta Function</title>
<names>r:betainc</names>
</builtin_function>
<builtin_function name="betaincinv">
<title>Inverse Regularized Incomplete Beta Function</title>
<names>r:betaincinv</names>
</builtin_function>
</category>
</category>
<category>
<title>Geometry</title>
<category>
<title>Triangle</title>
<function>
<title>Hypotenuse</title>
<names>r:hypot</names>
<expression>sqrt(\x^2+\y^2)</expression>
<argument type="free" index="1">
<title>Side A</title>
</argument>
<argument type="free" index="2">
<title>Side B</title>
</argument>
</function>
<function>
<title>Triangle Area</title>
<names>r:triangle</names>
<expression>(\x*\y)/2</expression>
<argument type="free" index="1">
<title>Base</title>
</argument>
<argument type="free" index="2">
<title>Height</title>
</argument>
</function>
<function>
<title>Triangle Perimeter</title>
<names>r:triangle_perimeter</names>
<expression>\x+\y+\z</expression>
<argument type="free" index="1">
<title>Side A</title>
</argument>
<argument type="free" index="2">
<title>Side B</title>
</argument>
<argument type="free" index="3">
<title>Side C</title>
</argument>
</function>
</category>
<category>
<title>Circle</title>
<function>
<title>Circle Area</title>
<names>r:circle</names>
<description>Calculates the area of a circle using the radius</description>
<expression>\x^2*pi</expression>
<argument type="free" index="1">
<title>Radius</title>
</argument>
</function>
<function>
<title>Circle Circumference</title>
<names>r:circumference</names>
<description>Calculates the area of a circle using the radius</description>
<expression>\x*2*pi</expression>
<argument type="free" index="1">
<title>Radius</title>
</argument>
</function>
</category>
<category>
<title>Cylinder</title>
<function>
<title>Cylinder Volume</title>
<names>r:cylinder</names>
<expression>\x^2*pi*\y</expression>
<argument type="free" index="1">
<title>Radius</title>
</argument>
<argument type="free" index="2">
<title>Height</title>
</argument>
</function>
<function>
<title>Surface Area of Cylinder</title>
<names>r:cylinder_sa</names>
<expression>2*\x^2*pi+2*pi*\x*\y</expression>
<argument type="free" index="1">
<title>Radius</title>
</argument>
<argument type="free" index="2">
<title>Height</title>
</argument>
</function>
</category>
<category>
<title>Cone</title>
<function>
<title>Cone Volume</title>
<names>r:cone</names>
<expression>\x^2*pi*\y/3</expression>
<argument type="free" index="1">
<title>Radius</title>
</argument>
<argument type="free" index="2">
<title>Height</title>
</argument>
</function>
<function>
<title>Surface Area of Cone</title>
<names>r:cone_sa</names>
<expression>\x^2*pi+pi*\x*abs((\y^2+\x^2)^(1/2))</expression>
<argument type="free" index="1">
<title>Radius</title>
</argument>
<argument type="free" index="2">
<title>Height</title>
</argument>
</function>
</category>
<category>
<title>Sphere</title>
<function>
<title>Sphere Volume</title>
<names>r:sphere</names>
<expression>\x^3*pi*4/3</expression>
<argument type="free" index="1">
<title>Radius</title>
</argument>
</function>
<function>
<title>Surface Area of Sphere</title>
<names>r:sphere_sa</names>
<expression>\x^2*pi*4</expression>
<argument type="free" index="1">
<title>Radius</title>
</argument>
</function>
</category>
<category>
<title>Square</title>
<function>
<title>Square Area</title>
<names>r:square</names>
<expression>\x^2</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
<function>
<title>Square Perimeter</title>
<names>r:square_perimeter</names>
<expression>\x*4</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
</category>
<category>
<title>Cube</title>
<function>
<title>Cube Volume</title>
<names>r:cube</names>
<expression>\x^3</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
<function>
<title>Surface Area of Cube</title>
<names>r:cube_sa</names>
<expression>(\x^2)*6</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
</category>
<category>
<title>Rectangle</title>
<function>
<title>Rectangle Area</title>
<names>r:rect</names>
<expression>\x*\y</expression>
<argument type="free" index="1">
<title>Length</title>
</argument>
<argument type="free" index="2">
<title>Width</title>
</argument>
</function>
<function>
<title>Rectangle Perimeter</title>
<names>r:rect_perimeter</names>
<expression>(\x+\y)*2</expression>
<argument type="free" index="1">
<title>Length</title>
</argument>
<argument type="free" index="2">
<title>Width</title>
</argument>
</function>
</category>
<category>
<title>Prism</title>
<function>
<title>Volume of Rectangular Prism</title>
<names>r:rectprism</names>
<description>Calculates the volume of a prism with rectangular base.</description>
<expression>\x*\y*\z</expression>
<argument type="free" index="1">
<title>Length</title>
</argument>
<argument type="free" index="2">
<title>Width</title>
</argument>
<argument type="free" index="3">
<title>Height</title>
</argument>
</function>
<function>
<title>Surface Area of Rectangular Prism</title>
<names>r:rectprism_sa</names>
<description>Calculates the surface area of a prism with rectangular base.</description>
<expression>(\x*\y)*2+(\x*\z)*2+(\y*\z)*2</expression>
<argument type="free" index="1">
<title>Length</title>
</argument>
<argument type="free" index="2">
<title>Width</title>
</argument>
<argument type="free" index="3">
<title>Height</title>
</argument>
</function>
<function>
<title>Volume of Triangular Prism</title>
<names>r:triangleprism</names>
<description>Calculates the volume of a prism with triangular base.</description>
<expression>\x*\y*\z/2</expression>
<argument type="free" index="1">
<title>Length</title>
</argument>
<argument type="free" index="2">
<title>Width</title>
</argument>
<argument type="free" index="3">
<title>Height</title>
</argument>
</function>
</category>
<category>
<title>Pyramid</title>
<function>
<title>Pyramid Volume</title>
<names>r:pyramid</names>
<description>Calculates the volume of a 3-dimensional shape standing on a rectangular base and terminating in a point at the top.</description>
<expression>\x*\y*\z/3</expression>
<argument type="free" index="1">
<title>Length of base</title>
</argument>
<argument type="free" index="2">
<title>Width of base</title>
</argument>
<argument type="free" index="3">
<title>Height</title>
</argument>
</function>
<function>
<title>Volume of Regular Tetrahedron</title>
<names>r:tetrahedron</names>
<expression>sqrt(2)/12*\x^3</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
<function>
<title>Surface Area of Regular Tetrahedron</title>
<names>r:tetrahedron_sa</names>
<expression>sqrt(3)*\x^2</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
<function>
<title>Height of Regular Tetrahedron</title>
<names>r:tetrahedron_height</names>
<expression>sqrt(6)/3*\x</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
<function>
<title>Volume of Square Pyramid (Equilateral)</title>
<names>r:sqpyramid</names>
<expression>sqrt(2)/6*\x^3</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
<function>
<title>Surface Area of Square Pyramid (Equilateral)</title>
<names>r:sqpyramid_sa</names>
<expression>(1+sqrt(3))*\x^2</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
<function>
<title>Height of Square Pyramid (Equilateral)</title>
<names>r:sqpyramid_height</names>
<expression>sqrt(2)/2*\x</expression>
<argument type="free" index="1">
<title>Length of side</title>
</argument>
</function>
</category>
<category>
<title>Parallelogram</title>
<function>
<title>Parallelogram Area</title>
<names>r:parallelogram</names>
<description>Calculates the area of a four-sided figure whose opposite sides are both parallel and equal in length.</description>
<expression>\x*\y</expression>
<argument type="free" index="1">
<title>Base</title>
</argument>
<argument type="free" index="2">
<title>Height</title>
</argument>
</function>
<function>
<title>Parallelogram Perimeter</title>
<names>r:parallelogram_perimeter</names>
<description>Calculates the perimeter of a four-sided figure whose opposite sides are both parallel and equal in length.</description>
<expression>(\x+\y)*2</expression>
<argument type="free" index="1">
<title>Side A</title>
</argument>
<argument type="free" index="2">
<title>Side B</title>
</argument>
</function>
</category>
<category>
<title>Trapezoid</title>
<function>
<title>Trapezoid Area</title>
<names>r:trapezoid</names>
<description>Calculates the area of a four-sided figure with two parallel sides.</description>
<expression>(\x+\y)/2*\z</expression>
<argument type="free" index="1">
<title>Side A</title>
</argument>
<argument type="free" index="2">
<title>Side B</title>
</argument>
<argument type="free" index="3">
<title>Height</title>
</argument>
</function>
</category>
</category>
<category>
<title>Economics</title>
<category>
<title>Microeconomics</title>
<function>
<title>Elasticity</title>
<names>r:elasticity</names>
<description>Calculates the demand elasticity. Also works for supply elasticity, income elasticity, cross-price elasticity, etc. Just replace demand with supply, or price with income...
e.g. elasticity(100-x^2, 3) calculates the demand elasticity when the price is 3 for the function "Q = 100 - x^2" where x is the default price variable.</description>
<expression>replace(diff(\x,\Z{x}),\Z,\y,1)*\y/replace(\x,\Z,\y)</expression>
<argument type="free" index="1">
<title>Demand function</title>
</argument>
<argument type="free" index="2">
<title>Price</title>
</argument>
<argument type="symbol" index="3">
<title>Price variable</title>
</argument>
</function>
</category>
<function>
<title>Sum-of-Years Digits Depreciation</title>
<names>r:syd</names>
<description>Calculates the sum-of-years digits depreciation for an asset based on its cost, salvage value, anticipated life, and a particular period. This method accelerates the rate of the depreciation, so that more depreciation expense occurs in earlier periods than in later ones. The depreciable cost is the actual cost minus the salvage value. The useful life is the number of periods (typically years) over which the asset is depreciated.</description>
<expression>((\x-\y)*(\z-\a+1)*2)/(\z*(\z+1))</expression>
<argument type="free" index="1">
<title>Cost</title>
</argument>
<argument type="free" index="2">
<title>Salvage value</title>
</argument>
<argument type="free" index="3">
<title>Life</title>
</argument>
<argument type="free" index="4">
<title>Period</title>
</argument>
</function>
<function>
<title>Straight Line Depreciation</title>
<names>r:sln</names>
<description>Determines the straight line depreciation of an asset for a single period.
Cost is the amount you paid for the asset. Salvage is the value of the asset at the end of the period. Life is the number of periods over which the asset is depreciated. SLN divides the cost evenly over the life of an asset.</description>
<expression>(\x-\y)/\z</expression>
<argument type="free" index="1">
<title>Cost</title>
</argument>
<argument type="free" index="2">
<title>Salvage value</title>
</argument>
<argument type="free" index="3">
<title>Life</title>
</argument>
</function>
<function>
<title>Present Value</title>
<names>ra:pv</names>
<description>Returns the present value of an investment.
If type = 1 then the payment is made at the beginning of the period. If type = 0 (or omitted) it is made at the end of each period.</description>
<expression>(-\A{0}-\z*(1+\x*\B{0})*(((1+\x)^\y-1)/\x))/((1+\x)^\y)</expression>
<argument type="free" index="1">
<title>Interest rate</title>
</argument>
<argument type="free" index="2">
<title>Number of periods</title>
</argument>
<argument type="free" index="3">
<title>Payment made each period</title>
</argument>
<argument type="free" index="4">
<title>Future value</title>
</argument>
<argument type="boolean" index="5">
<title>Type</title>
</argument>
</function>
<function>
<title>Nominal Interest Rate</title>
<names>r:nominal</names>
<description>Calculates the nominal interest rate from a given effective interest rate compounded at given intervals.</description>
<expression>\y*(abs((\x+1)^(1/\y))-1)</expression>
<argument type="free" index="1">
<title>Effective interest rate</title>
</argument>
<argument type="free" index="2">
<title>Periods</title>
</argument>
</function>
<function>
<title>Zero Coupon</title>
<names>r:zero_coupon</names>
<description>Calculates the value of a zero-coupon (pure discount) bond.</description>
<expression>\x/((1+\y)^\z)</expression>
<argument type="free" index="1">
<title>Face value</title>
</argument>
<argument type="free" index="2">
<title>Interest rate</title>
</argument>
<argument type="free" index="3">
<title>Years</title>
</argument>
</function>
<function>
<title>Treasury Bill Yield</title>
<names>r:tbillyield</names>
<description>Returns the yield for a treasury bill.</description>
<expression>(100-\z)/\z*(360/days(\x,\y,1,1))</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="free" index="3">
<title>Price per $100 face value</title>
</argument>
</function>
<function>
<title>Treasury Bill Price</title>
<names>r:tbillprice</names>
<description>Returns the price per $100 face value for a treasury bill.</description>
<expression>100*(1-(\z*days(\x,\y,1,1))/360)</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="free" index="3">
<title>Discount rate</title>
</argument>
</function>
<function>
<title>Treasury Bill Equivalent</title>
<names>r:tbilleq</names>
<description>Returns the bond equivalent yield for a treasury bill.</description>
<expression>365*\z/(360-\z*days(\x,\y,1,1))</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="free" index="3">
<title>Discount rate</title>
</argument>
</function>
<function>
<title>Interest paid on a given period of an investment (ISPMT)</title>
<names>r:ispmt</names>
<description>Calculates the interest paid on a given period of an investment.</description>
<expression>(-\a*\x)-((-\a*\x)/\z*\y)</expression>
<argument type="free" index="1">
<title>Periodic interest rate</title>
</argument>
<argument type="integer" index="2">
<title>Amortizement period</title>
<min>1</min>
</argument>
<argument type="integer" index="3">
<title>Number of periods</title>
<min>1</min>
</argument>
<argument type="free" index="4">
<title>Present value</title>
</argument>
</function>
<function>
<title>Payment for a loan</title>
<names>r:pmt</names>
<description>Returns the amount of payment (negative) each period for a loan based on a constant interest rate and constant payments (each payment is equal amount).
If type = 1 then the payment is made at the beginning of the period. If type = 0 (or omitted) it is made at the end of each period.
Note that the interest rate here refers to the rate for each period and if you calculate with an annual rate, each period will be interpreted as a whole year. To get monthly payments divide the annual interest rate by 12 and enter the total number of months (12 times number of years) in the periods field.</description>
<example>$name(2%/12, 10*12, 100000€) = -€920</example>
<expression>(-\z*((1+\x)^\y)-\A{0})/((1+\x*\B{0})*(((1+\x)^\y-1)/\x))</expression>
<argument type="free" index="1">
<title>Rate</title>
</argument>
<argument type="free" index="2">
<title>Number of periods</title>
</argument>
<argument type="free" index="3">
<title>Present value</title>
</argument>
<argument type="free" index="4">
<title>Future value</title>
</argument>
<argument type="boolean" index="5">
<title>Type</title>
</argument>
</function>
<function>
<title>Rate of investment</title>
<names>r:rate</names>
<description>Calculates the rate of return.
If type = 1 then the payment is made at the beginning of the period. If type = 0 (or omitted) it is made at the end of each period.
Note that the optional guess is needed because there can be more than one valid result. It defaults to 10%.</description>
<example>$name(10, -1500, 10000) ≈ 0.0814</example>
<subfunction precalculate="true">newtonsolve(pmt("rate",\x,\z,\A{0},\B{0})=\y,\C{0.1},"rate",0,20)</subfunction>
<expression>if(isNumber(\1),\1,undefined)</expression>
<argument type="number" index="1">
<title>Number of periods</title>
<min include_equals="false">0</min>
</argument>
<argument type="free" index="2">
<title>Payment made each period</title>
</argument>
<argument type="free" index="3">
<title>Present value</title>
</argument>
<argument type="free" index="4">
<title>Future value</title>
</argument>
<argument type="boolean" index="5">
<title>Type</title>
</argument>
<argument type="number" index="6">
<title>Guess</title>
</argument>
</function>
<function>
<title>Periods of an investment</title>
<names>r:nper</names>
<description>Calculates number of periods of an investment based on periodic constant payments and a constant interest rate.
Type defines the due date. 1 for payment at the beginning of a period and 0 (default) for payment at the end of a period.</description>
<expression>ln((\y*(1+\x*\B{0})-\A{0}*\x)/(\z*\x+\y*(1+\x*\B)))/ln(1+\x)</expression>
<argument type="free" index="1">
<title>Interest rate</title>
</argument>
<argument type="free" index="2">
<title>Payment made each period</title>
</argument>
<argument type="free" index="3">
<title>Present value</title>
</argument>
<argument type="free" index="4">
<title>Future value</title>
</argument>
<argument type="free" index="5">
<title>Type</title>
</argument>
</function>
<function>
<title>Periods for investment to attain desired value</title>
<names>r:g_duration</names>
<description>Returns the number of periods needed for an investment to attain a desired value.</description>
<expression>ln(\z/\y)/ln(1+\x)</expression>
<argument type="free" index="1">
<title>Rate</title>
</argument>
<argument type="free" index="2">
<title>Present value</title>
</argument>
<argument type="free" index="3">
<title>Future value</title>
</argument>
</function>
<function>
<title>Payment of an annuity going towards principal (PPMT)</title>
<names>r:ppmt</names>
<description>Calculates the amount of a payment of an annuity going towards principal.
Type defines the due date. 1 for payment at the beginning of a period and 0 (default) for payment at the end of a period.</description>
<expression>((-\a*(pow(1+\x,\z))-\B{0})/((1+\x*\C{0})*((pow(1+\x,\z)-1)/\x)))+(\a*pow(1+\x,(\y-1))+((-\a*(pow(1+\x,\z))-\B)/((1+\x*\C)*((pow(1+\x,\z)-1)/\x)))*((pow(1+\x,(\y-1))-1)/\x))*\x</expression>
<argument type="free" index="1">
<title>Periodic interest rate</title>
</argument>
<argument type="integer" index="2">
<title>Amortizement period</title>
<min>1</min>
</argument>
<argument type="integer" index="3">
<title>Number of periods</title>
<min>1</min>
</argument>
<argument type="free" index="4">
<title>Present value</title>
</argument>
<argument type="free" index="5">
<title>Desired future value</title>
</argument>
<argument type="boolean" index="6">
<title>Type</title>
</argument>
</function>
<function>
<title>Effective Interest Rate</title>
<names>r:effect</names>
<description>Calculates the annual net interest rate for a nominal interest rate.</description>
<expression>(1+\x/\y)^\y-1</expression>
<argument type="free" index="1">
<title>Nominal interest rate</title>
</argument>
<argument type="free" index="2">
<title>Periods</title>
</argument>
</function>
<function>
<title>Future Value</title>
<names>ra:fv,a:FV</names>
<description>Computes the future value of an investment. This is based on periodic, constant payments and a constant interest rate.
If type = 1 then the payment is made at the beginning of the period. If type = 0 (or omitted) it is made at the end of each period.</description>
<expression>-(\A{0}*((1+\x)^\y)+\z*(1+\x*\B{0})*(((1+\x)^\y-1)/\x))</expression>
<argument type="free" index="1">
<title>Interest rate</title>
</argument>
<argument type="free" index="2">
<title>Number of periods</title>
</argument>
<argument type="free" index="3">
<title>Payment made each period</title>
</argument>
<argument type="free" index="4">
<title>Present value</title>
</argument>
<argument type="boolean" index="5">
<title>Type</title>
</argument>
</function>
<function>
<title>Return on continuously compounded interest</title>
<names>r:continuous</names>
<description>Calculates the return on continuously compounded interest, given the principal, nominal rate and time in years.</description>
<expression>\x*exp(\y*\z)</expression>
<argument type="free" index="1">
<title>Principal</title>
</argument>
<argument type="free" index="2">
<title>Interest rate</title>
</argument>
<argument type="free" index="3">
<title>Years</title>
</argument>
</function>
<function>
<title>Compound</title>
<names>r:compound</names>
<description>Returns the value of an investment, given the principal, nominal interest rate, compounding frequency and time.</description>
<expression>\x*(1+\y/\z)^(\z*\a)</expression>
<argument type="free" index="1">
<title>Principal</title>
</argument>
<argument type="free" index="2">
<title>Nominal interest rate</title>
</argument>
<argument type="free" index="3">
<title>Periods per year</title>
</argument>
<argument type="free" index="4">
<title>Years</title>
</argument>
</function>
<function>
<title>Payment of an annuity going towards interest (IPMT)</title>
<names>r:ipmt</names>
<description>Calculates the amount of a payment of an annuity going towards interest.
Type defines the due date. 1 for payment at the beginning of a period and 0 (default) for payment at the end of a period.</description>
<expression>-(\a*pow(1+\x,(\y-1))+((-\a*(pow(1+\x,\z))-\B)/((1+\x*\C)*((pow(1+\x,\z)-1)/\x)))*((pow(1+\x,(\y-1))-1)/\x))*\x</expression>
<argument type="free" index="1">
<title>Periodic interest rate</title>
</argument>
<argument type="integer" index="2">
<title>Period</title>
<min>1</min>
</argument>
<argument type="integer" index="3">
<title>Number of periods</title>
<min>1</min>
</argument>
<argument type="free" index="4">
<title>Present value</title>
</argument>
<argument type="free" index="5">
<title>Future value</title>
</argument>
<argument type="boolean" index="6">
<title>Type</title>
</argument>
</function>
<function>
<title>Interest rate for a fully invested security</title>
<names>r:intrate</names>
<description>Returns the interest rate for a fully invested security.
Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<expression>(\a-\z)/\z/yearfrac(\x,\y,\B{0},1)</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="free" index="3">
<title>Investment</title>
</argument>
<argument type="free" index="4">
<title>Redemption</title>
</argument>
<argument type="integer" index="5">
<title>Day counting basis</title>
<min>0</min>
<max>4</max>
</argument>
</function>
<function>
<title>Dollar Fraction</title>
<names>r:dollarfr</names>
<description>Converts a decimal dollar price into a dollar price expressed as a fraction.</description>
<expression>int(\x)+frac(\x)*\y/10^ceil(log10(\y))</expression>
<argument type="number" index="1">
<title>Decimal dollar</title>
</argument>
<argument type="integer" index="2">
<title>Denominator of fraction</title>
<min>1</min>
</argument>
</function>
<function>
<title>Dollar Decimal</title>
<names>r:dollarde</names>
<description>Converts a dollar price expressed as a fraction into a dollar price expressed as a decimal number.</description>
<expression>int(\x)+frac(\x)*10^ceil(log10(\y-0.5))/\y</expression>
<argument type="number" index="1">
<title>Fractional dollar</title>
</argument>
<argument type="integer" index="2">
<title>Denominator of fraction</title>
<min>1</min>
</argument>
</function>
<function>
<title>Amount received at maturity</title>
<names>r:received</names>
<description>Returns the amount received at the maturity date for an invested security.
Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360. The settlement date must be before maturity date.</description>
<expression>\z/(1-\a*yearfrac(\x,\y,\B{0},1))</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="free" index="3">
<title>Investment</title>
</argument>
<argument type="free" index="4">
<title>Discount rate</title>
</argument>
<argument type="integer" index="5">
<title>Day counting basis</title>
<min>0</min>
<max>4</max>
</argument>
</function>
<function>
<title>Discount rate for a security</title>
<names>r:disc</names>
<description>Returns the discount rate for a security.
Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<expression>(\a-\z)/\a/yearfrac(\x,\y,\B{0},1))</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="free" index="3">
<title>Price per $100 face value</title>
</argument>
<argument type="free" index="4">
<title>Redemption</title>
</argument>
<argument type="integer" index="5">
<title>Day counting basis</title>
<min>0</min>
<max>4</max>
</argument>
</function>
<function>
<title>Accrued interest of security paying at maturity</title>
<names>r:accrintm</names>
<description>Returns the accrued interest for a security which pays interest at maturity date.
Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<expression>\A{1000}*\z*yearfrac(\x,\y,\B{0},1)</expression>
<argument type="date" index="1">
<title>Issue date</title>
</argument>
<argument type="date" index="2">
<title>Settlement date</title>
</argument>
<argument type="free" index="3">
<title>Annual rate of security</title>
</argument>
<argument type="free" index="4">
<title>Par value</title>
</argument>
<argument type="integer" index="5">
<title>Day counting basis</title>
<min>0</min>
<max>4</max>
</argument>
</function>
<function>
<title>Accrued interest of security with periodic interest payments</title>
<names>r:accrint</names>
<description>Returns accrued interest for a security which pays periodic interest.
Allowed frequencies are 1 - annual, 2 - semi-annual or 4 - quarterly. Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<expression>\b*\a/\c*\c*yearfrac(\x,\z,\D{0},1)+\y*0</expression>
<argument type="date" index="1">
<title>Issue date</title>
</argument>
<argument type="date" index="2">
<title>First interest</title>
</argument>
<argument type="date" index="3">
<title>Settlement date</title>
</argument>
<argument type="free" index="4">
<title>Annual rate of security</title>
</argument>
<argument type="free" index="5">
<title>Par value</title>
</argument>
<argument type="integer" index="6">
<title>Frequency</title>
<min>1</min>
<max>4</max>
</argument>
<argument type="integer" index="7">
<title>Day counting basis</title>
<min>0</min>
<max>4</max>
</argument>
</function>
<function>
<title>Number of coupons to be paid</title>
<names>r:coupnum</names>
<description>Returns the number of coupons to be paid between the settlement and the maturity.
Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<expression>trunc(yearfrac(\x,\y,\A{0},1)*\z)</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="integer" index="3">
<title>Frequency</title>
<min>1</min>
<max>12</max>
</argument>
<argument type="integer" index="4">
<title>Day counting basis</title>
<min>0</min>
<max>4</max>
</argument>
</function>
<function>
<title>Price per $100 face value of a discounted security</title>
<names>r:pricedisc</names>
<description>Calculates and returns the price per $100 face value of a discounted security. The security does not pay interest at maturity.
Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<expression>\a-\z*\a*yearfrac(\x,\y,\B{0},1)</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="free" index="3">
<title>Discount</title>
</argument>
<argument type="free" index="4">
<title>Redemption</title>
</argument>
<argument type="integer" index="5">
<title>Day counting basis</title>
<min>0</min>
<max>4</max>
</argument>
</function>
<function>
<title>Price per $100 face value of a security</title>
<names>r:pricemat</names>
<description>Calculates and returns the price per $100 face value of a security. The security pays interest at maturity.
Basis is the type of day counting you want to use: 0: US 30/360 (default), 1: real days, 2: real days/360, 3: real days/365 or 4: European 30/360.</description>
<expression>(100+yearfrac(\z,\y,\C{0},1)*\a*100)/(1+yearfrac(\x,\y,\C,1)*\b)-yearfrac(\z,\x,\C,1)*\a*100</expression>
<argument type="date" index="1">
<title>Settlement date</title>
</argument>
<argument type="date" index="2">
<title>Maturity date</title>
</argument>
<argument type="date" index="3">
<title>Issue date</title>
</argument>
<argument type="free" index="4">
<title>Discount rate</title>
</argument>
<argument type="free" index="5">
<title>Annual yield</title>
</argument>
<argument type="integer" index="6">
<title>Day counting basis</title>
<min>0</min>
<max>4</max>
</argument>
</function>
<function>
<title>Level-Coupon Bond</title>
<names>r:level_coupon</names>
<description>Calculates the value of a level-coupon bond.</description>
<expression>(\y*\x/\z)*((1-1/(((1+(\b/\z))^(\a*\z))))/(\b/\z))+(\x/((1+(\b/\z))^(\a*\z)))</expression>
<argument type="free" index="1">
<title>Face value</title>
</argument>
<argument type="free" index="2">
<title>Coupon rate</title>
</argument>
<argument type="free" index="3">
<title>Coupons per year</title>
</argument>
<argument type="free" index="4">
<title>Years</title>
</argument>
<argument type="free" index="5">
<title>Market interest rate</title>
</argument>
</function>
</category>
</QALCULATE>
|