/usr/share/maxima/5.32.1/tests/rtest16.mac is in maxima-test 5.32.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | (kill (all), values);
[];
/* make sure things work after a reset(). ID: 1986726 and ID: 2787047
*
* display2d is a resetable option variable. We save the value of display2d
* and restore it after the reset. This allows to run the testsuite in both
* display modes.
*/
(save:display2d, done);
done$
(reset(),0);
0;
(display2d:save, done);
done$
/* From A. Reiner. Fixed in buildq.lisp rev. 1.4.
Exposed a bug caused by the dynamical scope of VARLIST. */
buildq([foo:sin(baz+bar)],1);
1$
buildq([foo:[sin(baz+bar),sin(baz-bar)]],+splice(foo));
sin(baz+bar)+sin(baz-bar)$
/* Fixed in series.lisp rev 1.5, 04 Feb 2004.
First case returned second result */
powerseries(1/sqrt(1+x),x,0);
2*'sum(x^i1/beta(1/2-i1,i1+1),i1,0,inf);
powerseries(sqrt(1+x),x,0);
2*('sum(x^i2/beta(3/2-i2,i2+1),i2,0,inf))/3;
/* sf bug 1730044 - powerseries(1+x^n,x,0) wrong */
powerseries(1+x^n, x, 0);
('sum(x^(i3*n)/beta(2-i3,i3+1),i3,0,inf))/2;
(declare(n, integer), powerseries(1/(1+x^n), x, 0));
'sum((-1)^i4*x^(i4*n),i4,0,inf);
/* Examples from SF bug report [ 1722156 ] powerseries((x+1)/(1-2*x^2), x, 0);
* tnx Dan Gildea
*/
gensumnum : 0;
0;
/* two simple roots */
powerseries((1)/((1-2*x)*(1-3*x)), x, 0);
'sum((3^(i1+1)+(-2*2^i1))*x^i1,i1,0,inf);
/* fibonacci */
powerseries((1)/(1-x-x^2), x, 0);
-'sum((-2*(sqrt(5)-1)^(-i2-1)*2^i2/sqrt(5)
-2*(sqrt(5)+1)^(-i2-1)*(-2)^i2/sqrt(5))
*x^i2,i2,0,inf);
/* 1 1 2 2 4 4 8 8 */
factor(powerseries((1+x)/(1-2*x^2), x, 0));
/*
'sum( (-1*(1/-(1/sqrt(2)))*(1/sqrt(2)-1)*(1/-(4/sqrt(2)))*(1/-(1/sqrt(2)))^i3 +
-1*(1/(1/sqrt(2)))*(-1/sqrt(2)-1)*(1/(4/sqrt(2)))*(1/(1/sqrt(2)))^i3 ) * x^i3,i3,0,inf);
*/
'sum(2^(i3/2-3/2)*((sqrt(2)-1)*(-1)^i3+sqrt(2)+1)*x^i3,i3,0,inf);
/* multiple root */
powerseries((1+x)/(1-x)^2, x, 0);
'sum(2*(i4+1)*x^i4-x^i4,i4,0,inf);
/* numerator higher order poly than denom */
powerseries((1+x^3)/(1-x-x^2), x, 0);
-2*x
*'sum((-2*(sqrt(5)-1)^(-i5-1)*2^i5/sqrt(5)
-2*(sqrt(5)+1)^(-i5-1)*(-2)^i5/sqrt(5))
*x^i5,i5,0,inf)
-x+1;
/* zero root in denom */
powerseries((1)/((1-2*x)*(x)), x, 0);
('sum(2^i6*x^i6,i6,0,inf))/x;
/* one simple and one repeated root in denom */
powerseries((1+x+x^2)/((1-2*x)*(1+x)^2), x, 0);
'sum(7*2^i7*x^i7/9+(i7+1)*(-1)^i7*x^i7/3-(-1)^i7*x^i7/9,i7,0,inf);
/* gcd of exps is two */
powerseries((1-x^2)/(1-4*x^2+x^4), x, 0);
'sum((-1*(1/(2-sqrt(3)))*(sqrt(3)-1)*(1/(2*(2-sqrt(3))-4))*(1/(2-sqrt(3)))^i8 +
-1*(1/(sqrt(3)+2))*(-sqrt(3)-1)*(1/(2*(sqrt(3)+2)-4))*(1/(sqrt(3)+2))^i8 )*x^(2*i8),
i8, 0, inf);
/* Verify that extended functionality of rhs/lhs works as advertised */
(kill (x, y, aa, bb, cc), infix("@@"), 0);
0;
map (lhs, [aa < bb, aa <= bb, aa = bb, aa # bb, equal (aa, bb), notequal (aa, bb), aa >= bb, aa > bb]);
[aa, aa, aa, aa, aa, aa, aa, aa];
map (rhs, [aa < bb, aa <= bb, aa = bb, aa # bb, equal (aa, bb), notequal (aa, bb), aa >= bb, aa > bb]);
[bb, bb, bb, bb, bb, bb, bb, bb];
map (lhs, [foo(x) := 2*x, bar(y) ::= 3*y, '(aa : bb), '(aa :: bb), ?marrow(aa, bb)]);
['(foo(x)), '(bar(y)), aa, aa, aa];
map (rhs, [foo(x) := 2*x, bar(y) ::= 3*y, '(aa : bb), '(aa :: bb), ?marrow(aa, bb)]);
[2*x, 3*y, bb, bb, bb];
[lhs (aa @@ bb), lhs (aa @@ bb @@ cc), rhs (aa @@ bb), rhs (aa @@ bb @@ cc)];
[aa, aa @@ bb, bb, cc];
map (lhs, [aa + bb, aa - bb, aa * bb, aa / bb, sin(aa), log(aa)]);
[aa + bb, aa - bb, aa * bb, aa / bb, sin(aa), log(aa)];
map (rhs, [aa + bb, aa - bb, aa * bb, aa / bb, sin(aa), log(aa)]);
[0, 0, 0, 0, 0, 0];
kill ("@@");
done;
/* Verify that grind treats nouns correctly. string calls MSIZE in src/grind.lisp.
*/
kill (all);
done;
string ('(integrate(f(x), x) + integrate(g(x), x, minf, inf) + diff(u, x) + sum(h(x), x, 1, n)));
"sum(h(x),x,1,n)+integrate(g(x),x,minf,inf)+integrate(f(x),x)+diff(u,x)";
string ('integrate(f(x), x) + 'integrate(g(x), x, minf, inf) + 'diff(u, x) + 'sum(h(x), x, 1, n));
"'sum(h(x),x,1,n)+'integrate(g(x),x,minf,inf)+'integrate(f(x),x)+'diff(u,x,1)";
/* GREAT puts nounified atoms before others, it appears ... */
string (%a%a + %b%b + nounify(%c%c) + nounify(%d%d) + %e%e + %f%f);
"%d%d+%c%c+%f%f+%e%e+%b%b+%a%a";
string (sin(x) * cos(x) + tan(x));
"tan(x)+cos(x)*sin(x)";
string ('foo(x, y, z) / bar(a, b, c) + 'baz(%pi - 'quux(%e ^ mumble(%i))));
"'foo(x,y,z)/bar(a,b,c)+'baz(%pi-'quux(%e^mumble(%i)))";
/* It's conceivable that someday nounified arithmetic operators would be treated differently by grind.
* If/when that happens, revise this example accordingly.
*/
string ('"+"(a, b, '"."(c, d), '"^"(e, f)));
"'?mplus(a,b,'?mnctimes(c,d),'?mexpt(e,f))";
/* Bug 626721 */
logarc(atan2(y,x));
-%i*log((%i*y+x)/sqrt(x^2+y^2));
rectform(ev(%,x=-1,y=1));
3*%pi/4;
/*
* Bug [ 1661490 ] An integral gives a wrong result.
*/
(assume(a>0, b>0, sqrt(sqrt(b^2+a^2)-a)*(sqrt(b^2+a^2)+a)^(3/2)-b^2>0),0);
0;
radcan(integrate(exp(-(a+%i*b)*x^2),x,minf,inf)/(sqrt(%pi)/sqrt(a+%i*b)));
1;
/*
* [ 1663704 ] integrate(sin(r*x)^7/x^4,x,0,inf) -> r^3*false
*
* Should return the integral instead of producing false.
*/
integrate(sin(a*x)^7/x^4,x,0,inf);
'integrate(sin(a*x)^7/x^4,x,0,inf);
/* we have assumed a>0 */
integrate(%e^(-a*r)*sin(k*r),r,0,inf);
k/(k^2+a^2);
/*
* Bug [ 1854888 ] hgfred([5],[5], 1) doesn't simplify
*/
hgfred([5],[5],1);
%e;
/*
* Bug [ 1858964 ] hgfred([7],[-1], x) --/--> error
*/
hgfred([7],[-1],x);
und;
/*
* Bug [ 1858939 ] hgfred([-1],[-2],x) --> error
*/
hgfred([-1],[-2],x);
/* Because of revision 1.110 of hyp.lisp gen_laguerre simplifies
-gen_laguerre(1,-3,x)/2; */
1+x/2;
/*
* Tests for the :: operator
*/
a:b;
b$
a::3;
3$
b;
3$
p:concat('p,1);
p1$
p::5;
5$
p1;
5$
kill(all);
done$
/* Bug [ 1860250 ] erf(-inf) --> -erf(inf) */
erf(-inf);
-1$
erf(inf);
1$
erf(-x) + erf(x);
0$
erf(a-b) + erf(b-a);
0$
/* Bug [ 1950653 ] bessel_j not simplified
* A few additional related tests added too.
*/
bessel_j(1/2,%pi),besselexpand:true;
0;
bessel_y(1/2,%pi/2),besselexpand:true;
0;
/* Bug [ 2149714 ] fpprintprec does not work correctly
*/
fpprec:16;
16;
block([fpprintprec:5], string(1.23b0));
"1.23b0";
block([fpprintprec:5], string(1.2345b0));
"1.2345b0";
block([fpprintprec:5], string(1.23456789b0));
"1.2345b0";
block([fpprintprec:25], string(1.2345678901234567890123456789b0));
"1.234567890123457b0";
/*
* Bug 2142758: integrate(sqrt(2-2*x^2)*(sqrt(2)*x^2+sqrt(2))/(4-4*x^2),x,0,1)
*/
integrate(sqrt(2-2*x^2)*(sqrt(2)*x^2+sqrt(2))/(4-4*x^2),x,0,1);
3*%pi/8;
integrate(sqrt(1-x^2)*(x^2+1)/(2-2*x^2),x,0,1);
3*%pi/8;
integrate(sqrt(1-x^2)*(x^2+1)/(1-x^2),x,0,1);
3*%pi/4;
/*
* Bug [ 2208303 ] Problem with jacobi_dn and elliptic_kc
*/
jacobi_dn(elliptic_kc(m)*t,m);
jacobi_dn(elliptic_kc(m)*t,m);
/*
* Bug [ 2180110 ] GCL do not signal an overflow converting bigfloat to float
*/
errcatch(float(2b400));
[];
errcatch(float(bfloat(2^1024)));
[];
/*
* Bug [ 2055235 ] Plot leaves range with jacobi functions
*
* Actually jacobi_cn(100, .7) is computed inaccurately. Just check that abs(jacobi_cn(100,.7)) < 1
*/
is(abs(jacobi_cn(100.0, 0.7)) < 1);
true$
/*
* Bug [ 1658067 ] jacobi_sn(elliptic_kc(1-m)*%i/2,m) isn't simplified
*/
jacobi_sn(elliptic_kc(1-m)*%i/2,m);
%i*m^(1/4)$
jacobi_sc(elliptic_kc(m)+u,m);
-jacobi_cs(u,m)/sqrt(1-m)$
/*
* Bug [ 2505945 ] - hgfred([2,-1/2],[3],-x^2);
*
* Shouldn't signal from diff about non-variable second arg.
*
* The expected value here is computed from
* factor(ratsimp(subst([z=-x^2],hgfred([2,-1/2],[3],z))))
*/
factor(ratsimp(hgfred([2,-1/2],[3],-x^2)));
4*(3*x^4*sqrt(x^2+1)+x^2*sqrt(x^2+1)-2*sqrt(x^2+1)+2)/(15*x^4)$
/*
* Bug 2534420: asinh(%i*2b0) causes error
*/
is(abs(asinh(%i*2b0)-expand(bfloat(asinh(%i*2)))) < 3b-17);
true;
/*
* Bug 2543079: bfloat(gamma(3/4)/gamma(1/4)) is wrong.
*/
bfloat(gamma(3/4)/gamma(1/4));
3.379891200336424b-1;
/*
* Bug 2582034 - hgfred([a/2,-a/2],[1/2],z) causes error
*/
(assume(zn<0), done);
done;
hgfred([a/2,-a/2],[1/2],zn);
((%i*sqrt(zn)+sqrt(1-zn))^a+(sqrt(1-zn)-%i*sqrt(zn))^a)/2$
/*
* Bug 2618401 - bfloat produces incorrect answer
*/
is(abs(bfloat((sqrt(2)+2)*%pi^(3/2)/(8*gamma(3/4)^2))-float((sqrt(2)+2)*%pi^(3/2)/(8*gamma(3/4)^2))) < 1d-15);
true;
/* (-1.0b0)^(1/3) vs (-1.0d0)^(1/3) - ID: 619927 */
(-1b0)^(1/3);
-1.0b0;
(-1.0)^(1/3);
-1.0;
domain:complex;
complex;
(-1b0)^(1/3);
1.0b0*(-1)^(1/3);
(-1.0)^(1/3);
1.0*(-1)^(1/3);
domain:real;
real;
(-1b0)^(1/3),domain:complex,m1pbranch:true;
1.0b0*(sqrt(3)*%i/2+1/2);
(-1.0)^(1/3),domain:complex,m1pbranch:true;
1.0*(sqrt(3)*%i/2+1/2);
/*
* Bug [ 2688847 ] float of rats rounds incorrectly
*/
float((2^60-1)/2^60)-1;
0.0;
float((2^1000-1)/2^1000)-1;
0.0;
/*
* Bug [ 2687962 ] hgfred([-3/2,1],[-1/2],-t) division by zero
*
* Solution from functions.wolfram.com
*/
ratsimp(hgfred([-3/2,1],[-1/2], t));
1+3*t-3*t^(3/2)*atanh(sqrt(t));
/*
* Bug 2793827: internal error in integrate
*/
(assume(n>0),declare(n,integer),0);
0;
integrate((g32475^n*(g32475*n-n-1)/(g32475-1)^2+1/(g32475-1)^2)/(1-g32475)
-(g32475^(2*n+1)*(g32475*n-n-1)/(g32475-1)^2+g32475^(n+1)/(g32475-1)^2)
/(1-g32475),g32475,0,1);
n^2/2+n;
kill(all);
done;
/*
* Bug 609464 : 1+%e,numer and %e^%e,numer
*
* The simplifier has been extended to handle %e like other constants.
* In addition functions with arguments which involve %e simplify
* accordingly.
*/
%e,numer;
2.7182818284590451;
%e+1,numer;
3.7182818284590451;
%e^%e,numer;
15.154262241479262;
%e^x,numer;
%e^x;
sin(%e),numer;
0.41078129050290885;
sin(%e+1),numer;
-0.54525155669233449;
/* Do not simplify, when %e is the base of an expression and %enumer FALSE*/
sin(%e^(2*x+1)),numer;
sin(%e^(2*x+1));
sin(%e^(%e^(2*x+1))),numer;
sin(%e^(%e^(2*x+1)));
/* Additionally simplifications when %enumer TRUE */
%enumer:true;
true;
sin(%e^x),numer;
sin(2.7182818284590451^x);
sin(%e^(%e^(2*x+1))),numer;
sin(2.7182818284590451^(2.7182818284590451^(2*x+1)));
%enumer:false;
false;
/*
* Bug ID: 2797885 - "problem with integration"
*
* integrate(exp(%i*x)*sin(x),x) generates a Lisp error.
*
* This is a special case for the integrand: exp(a*x)*sin(b*x),
* with a^2+b^2 equal to zero.
*/
/* This is the general case for an integral with exp and sin or cos */
integrate(exp(a*x)*sin(b*x),x);
%e^(a*x)*(a*sin(b*x)-b*cos(b*x))/(b^2+a^2);
integrate(exp(a*x)*cos(b*x),x);
%e^(a*x)*(b*sin(b*x)+a*cos(b*x))/(b^2+a^2);
/* Now the special case with a=%i and b=1 */
expand(integrate(exp(%i*x)*sin(x),x));
%i*x/2-%e^(2*%i*x)/4;
expand(integrate(exp(x)*sin(%i*x),x));
%i*%e^(2*x)/4-%i*x/2;
expand(integrate(exp(%i*x)*cos(x),x));
x/2-%i*%e^(2*%i*x)/4;
expand(integrate(exp(x)*cos(%i*x),x));
%e^(2*x)/4+x/2;
/* Bug ID: 932076 - ode2( 'diff(y,x)=%i*y+sin(x), y, x) => div by 0
*
* This bug is related to the Bug ID: 2797885 - "problem with integration"
*/
ode2('diff(y,x)-%i*y-sin(x),y,x);
y = (%c-%i*(x-%i*%e^-(2*%i*x)/2)/2)*%e^(%i*x);
/*
* Bug ID: 826623 "simplifer returns %i*%i"
*
* Some examples to show simplification of expressions of the form
* (a*b*...)^q*(a*b*...)^r, where q+r=1
*/
sqrt(-%i)*sqrt(-%i)*%i;
1;
sqrt(a*b)*sqrt(a*b)*a*b;
a^2*b^2;
(a*b*c)^(3/4)*(a*b*c)^(1/4)*c;
a*b*c^2;
/*
* Bug ID: 2792493 "hgfred([1],[-5.2],x);"
*/
hgfred([1],[-5.2],x);
%f[1,1]([-6.2],[-5.2],-x)*%e^x$
/* BUG ID: 721575 2/sqrt(2) doesn\'t simplify */
2/sqrt(2);
sqrt(2);
(1/2)*sqrt(2);
1/sqrt(2);
sqrt(2)*(1/2);
1/sqrt(2);
/* BUG ID 2029041 a*sqrt(2)/2 unsimplified */
a*sqrt(2)/2;
a/sqrt(2);
/* BUG ID 1923119 1/sqrt(8)-sqrt(8)/8 */
1/sqrt(8)-sqrt(8)/8;
0;
/* BUG ID 1927178 integrate(sin(t),t,%pi/4,3*%pi/4) */
integrate(sin(t),t,%pi/4,3*%pi/4);
sqrt(2);
/* BUG ID: 1480562 2*a*2^k isn't simplified to a*2^(k+1) */
2*a*2^k;
a*2^(k+1);
a*2^k*2;
a*2^(k+1);
/* Some examples to show simplification of expressions
* with floating point and bigfloat numbers after improvement
* of plusin
*/
(4.0*x-4.0*x);
0.0;
(4.0*x-3.0*x);
1.0*x;
(4.0*x-3.0*x)/2;
0.5*x;
(4.0b0*x-4.0*x);
0.0b0;
(4.0b0*x-3.0*x);
1.0b0*x;
(4.0b0*x-3.0*x)/2;
0.5b0*x;
/* BUG ID: 1996354 unsimplifed result from expand */
expand((%e^(-2*sqrt(2))*(%e^(2*sqrt(2))+2*%e^sqrt(2)+1)^2)/16
+(%e^(-2*sqrt(2))*(%e^(2*sqrt(2))-2*%e^sqrt(2)+1)^2)/16
-(%e^(-2*sqrt(2))*(%e^(2*sqrt(2))-1)^2)/8);
1;
/* BUG ID: 631216 - "horner([...],x)/FIX"
horner now maps over lists, matrices and equations.
*/
horner(x^2+x=a*x^2+b*x);
x*(x+1) = x*(a*x+b);
horner([x^2+x,x^3+x,x^4+x]);
[x*(x+1),x*(x^2+1),x*(x^3+1)];
/* BUG ID: 2699862 "derivative of polylogarithm"
* The noun form is not put on the property list, but NIL. The routine
* sdiffgrad generates a noun form, when the derivative is not known.
*/
diff(li[n](x),n);
'diff(li[n](x),n);
diff(li[n*x](x),x);
'diff(li[n*x](x),x);
diff(li[n](x),x,1,n,1);
'diff(li[n-1](x),n)/x;
/* Not reported as a bug, but the same problem for the function psi */
diff(psi[n](x),n);
'diff(psi[n](x),n);
diff(psi[n*x](x),x);
'diff(psi[n*x](x),x);
diff(psi[n](x),x,1,n,1);
'diff(psi[n+1](x),n);
/* BUG ID: 2824909 " exp(%i*%pi/4) not simplified"
* Check the simplification of exp(%i*%pi/4) and exp(-%i*pi/4)
*/
exp(%i*%pi/4);
1/sqrt(2)+%i/sqrt(2);
exp(-%i*%pi/4);
1/sqrt(2)-%i/sqrt(2);
/*
* Bug ID: 2831259 - bfloat() underflow bug
*/
fpprec:500;
500;
float(0b0);
0.0;
/*
* BUG ID: 2835098 - SIGN-PREP strangeness
*/
block ([?limitp : true], sign (foo (x)));
pnz;
integrate(sqrt(2*m*(E[n]-U(x))),x,-x[0],x[0])=(n-1/2)*%pi*hbar;
sqrt(2)*'integrate(sqrt(m*(E[n]-U(x))),x,-x[0],x[0]) = %pi*hbar*(n-1/2);
integrate(f(x),x,x[0],x[1]);
'integrate(f(x),x,x[0],x[1]);
/*
* BUG ID: 2840566 - defint fails to determine if one of its limit is real
*/
(assume(b>0,c>0),done);
done;
integrate(x,x,0,sqrt(b^2+(b-c)^2));
(c^2-2*b*c+2*b^2)/2;
/*
* BUG ID: 2842060 - unsimplified result from integrate
*/
/* The result for a general symbol x */
integrate(1/x/sqrt(x^2-1),x);
-asin(1/abs(x));
(assume(x>0), done);
done;
/* abs(x) simplifies to x for x>0 */
integrate(1/x/sqrt(x^2-1),x);
-asin(1/x);
(forget(x>0), done);
done;
/*
* Bug ID: 2820202 - rootscontract(%i/2)
*/
rootscontract(%i/2);
%i/2;
/* Bug ID: 2872738 - sign(-(1/n)*(-1)^n)
* We got the error because of the simplification
* (-1)^n*(-1) -> (-1)^(n+1) and not -(-1)^n
* The other case
(-1)*(-1)^n simplifies already to -(-1)^n
* Adding tests for both cases.
*/
kill(all);
done;
sign(-(1/n)*(-1)^n);
pn;
(-1)*(-1)^n;
-(-1)^n;
(-1)^n*(-1);
-(-1)^n;
/* Bug ID: 2835634 - logcontract broken
* Bug ID: 1467368 - logcontract returns unsimplified expr
*/
logcontract(log(x)-log(2));
log(x/2);
/* Check that we do not break the following again */
logcontract(log(%e*k)-log(%e^-1*k));
2;
log(%e^2),logexpand:false;
2;
/* Bug ID: 2880923 - realpart --> floating-point-overflow
*/
sign(exp(2009));
pos;
realpart(sqrt(4*%e^2009-3)-1);
sqrt(4*%e^2009-3)-1;
sqrt(4*exp(2009));
2*%e^(2009/2);
/* Bug ID: 640332 - Need to specdisrep more systematically
Add the examples of the bug report.
*/
ratdisrep(diff(rat(x),rat(x)));
1;
diff(x,rat(x));
1;
outofpois(diff(intopois(sin(x)),x));
cos(x);
taylor(intopois(sin(x)),x,0,3);
x-x^3/6;
ratsimp(intopois(sin(x)));
sin(x);
/* Bug ID: 627759 - Ratdisrep of aggregates
*/
ratdisrep(rat(x=y));
x = y;
ratdisrep(rat([x=a,y=b]));
[x = a,y = b];
ratdisrep(rat(matrix([a,b],[c,d])));
matrix([a,b],[c,d]);
/* Bug ID: 711885 - Rootscontract with imaginaries fails
*/
(oldvalue:radexpand, radexpand:false, done);
done;
rootscontract(((sqrt(3)*%i+1)^(3/2)-4*%i)/sqrt(sqrt(3)*%i+1));
((sqrt(-3)+1)^(3/2)-4*%i)/sqrt(sqrt(-3)+1);
/* It is a problem of the simplifier. Show that it works */
sqrt(1/(1+sqrt(-3)));
1/sqrt(sqrt(-3)+1);
(radexpand:oldvalue, done);
done;
/* BUG ID: 767556 - Distributing operations over =
* The operators "." and "^^" distribute over equations.
*/
x . (a=b);
x . a = x . b;
(a=b)^^x;
a^^x = b^^x;
/* A more complicated example */
x . ((2*a+b . c) = x . (y + z))^^w;
x . (b . c+2*a)^^w = x . (x . (z+y))^^w;
/* Bug ID: 2914176 - Conversion of rational to bfloat is inaccurate
*
* The difference should be 1/262144, but we don't check for that.
*/
(oldfpprec:fpprec, fpprec:5, done);
done;
is(bfloat((2^20+1)/(2^20-1)) - 1b0 > 0);
true;
/* Related to the fix for 2914176. Didn't handle the ratio 0/1 */
is(equal(0b0, 0));
true;
(fpprec:oldfpprec, done);
done;
/* Bug ID:2933882 - Power function: 0^a not fully implemented
* Show some simplifications of 0^a
*/
assume(a>0);
[a>0];
0^a;
0;
errcatch(0^-a);
[];
0^(a+%i);
0;
0^(1/2+%i);
0;
errcatch(0^(-1/2+%));
[];
errcatch(0^%i);
[];
forget(a>0);
[a>0];
/* Bug ID: 2938078 - Crash on attached input
*/
declare(n,integer, j,noninteger);
done;
assume(equal(x,n), equal(y,j), equal(z,i));
[equal(x, n), equal(y, j), equal(z,i)];
featurep(x,integer);
true;
featurep(x,noninteger);
false;
featurep(y,integer);
false;
featurep(y,noninteger);
true;
diff(z+1,z);
1;
remove(n,integer, j,noninteger);
done;
forget(equal(x,n), equal(y,j), equal(z,i));
[equal(x, n), equal(y, j), equal(z, i)];
/* Bug ID: 2948800 - integrate((1-cos(2*x)^2)^2/x^4,x,0,inf) wrong
*/
integrate((1-cos(2*x)^2)^2/x^4,x,0,inf);
8*%pi/3;
assume(a>0);
[a>0];
/* The more general type with an argument a*x and a positive */
integrate((1-cos(a*x)^2)^2/x^4,x,0,inf);
%pi*a^3/3;
forget(a>0);
[a>0];
/* Bug ID: 777564 - subtraction "-"(a,b) should work/FIX */
"-"();
0;
"-"(a);
-a;
"-"(2*a);
-2*a;
"-"(a+b);
-b-a;
"-"(a+b+c);
-c-b-a;
"-"(100,20,10);
70;
map("-",[a,x,100],[b,y,20]);
[a-b,x-y,80];
map("-",[a,x,100],[b,y,20],[c,z,10]);
[-c-b+a,-z-y+x,70];
/* Bug ID: 910270 - 1/+3*x parses as 1/(+3*x)
* Show that the "+" operator can be used as a prefix operator too.
*/
1/+3*x;
x*1/3;
1/+x/3;
1/(3*x);
a^+b*c;
c*a^b;
/* Bug ID: 2961822 - sinh(0.0b0) causes Maxima to abort
*/
sinh(0.0b0);
0.0b0;
/* Bug ID: 1219846 - properties of translated functions
* The property noun is already present
*/
kill(f);
done;
f(x):=x;
f(x):=x;
properties(f);
[function,noun];
translate(f);
[f];
properties(f);
[transfun,function,noun];
kill(f);
done;
/* Bug ID: 2968344 - gamma_incomplete(1.0, 4.368265444147715e+19) fails
*/
gamma_incomplete(1.0, 4.368265444147715e+19);
0.0;
/* Bug ID: 643254 - orderlessp([rat(x)], [rat(x)])
*/
orderlessp([rat(x)],[rat(x)]);
false;
/* Bug ID: 781657 - binomial(x,x) => 1, but binomial(-1,-1) => 0
* binomial(x,x) simplifies to 1 only if the sign of x is known not to be
* negative.
*/
is(equal(binomial(x,x),1));
'unknown;
is(equal(binomial(x^2,x^2),1));
true;
/* Bug ID:856209 - inconsistency between facts() and facts(v)
* Show that facts(expr) now works more general.
*/
assume(z+a>0,b>z);
[a+z>0,b>z];
facts(a);
[a+z>0];
facts(b);
[b>z];
facts(z);
[a+z>0,b>z];
facts(a+z);
[a+z>0];
forget(z+a>0,b>z);
[a+z>0,b>z];
/* Bug ID: 840848 - trigreduce doesn't enter unknown functions
*/
trigexpand(f(sin(2*x)));
f(2*cos(x)*sin(x));
trigreduce(%);
f(sin(2*x));
/* Bug ID: 2954472 - rectform with large floats gives bad answer
*/
is(abs(rectform(1e160/(1e160+%i))-1) < 1e-160);
true;
is(abs(rectform(1e160/(1e160+3/2*%i))-1) < 1.5e-160);
true;
/* Bug ID: 2953369 - Definite Integration of 1/(a-b*cos(x)) wrong
*
* For simplicity we test the equivalent integrate(1/(1-r*cos(x)),x,0,%pi).
*/
/* These assumes are to answer the questions integrate (from routine unitcir) will ask */
(assume(r>0,r<1,abs(sqrt(1-r^2)-1)/r-1 < 0, sqrt(1-r^2)-r+1>0), 0);
0;
integrate(1/(1-r*cos(x)),x,0,%pi);
%pi/sqrt(1-r^2);
/* Bug ID: 2907727 - Incorrect Integral with option integrate_use_rootsof
* :true
*/
%rnum:0;
0;
integrate((d*x^2+2*c*x+3*b)/(g*r*x^3+d*x^2+c*x+b), x), integrate_use_rootsof:true;
lsum((%r1^2*d+2*%r1*c+3*b)*log(x-%r1)/(3*%r1^2*g*r+2*%r1*d+c),%r1,
rootsof(g*r*x^3+d*x^2+c*x+b));
/* Bug ID: 2880797 - bad answer in integrate(sqrt(sin(t)^2+cos(t)^2),t,0,2*%pi)
*
*/
integrate(sqrt(sin(t)^2+cos(t)^2),t,0,2*%pi);
2*%pi;
/* Bug ID: 2980551 - Inconsistent simplification of exp(x*%i*%pi)
*
* These examples show consistent simplification for x an expression which
* can contain float or bigfloat values
*/
exp(2*%i*%pi);
1;
exp((2+x)*%i*%pi);
exp(x*%i*%pi);
exp(2*%i*%pi+x*%i*%pi);
exp(x*%i*%pi);
log(exp((2+x)^2*%i*%pi));
(2+x)^2*%i*%pi;
exp(2.0*%i*%pi);
1.0;
exp((2.0+x)*%i*%pi);
exp(1.0*x*%i*%pi);
exp(2.0*%i*%pi+x*%i*%pi);
exp(1.0*x*%i*%pi);
log(exp((2.0+x)^2*%i*%pi));
(2.0+x)^2*%i*%pi;
exp(2.0b0*%i*%pi);
1.0b0;
exp((2.0b0+x)*%i*%pi);
exp(1.0b0*x*%i*%pi);
exp(2.0b0*%i*%pi+x*%i*%pi);
exp(1.0b0*x*%i*%pi);
log(exp((2.0b0+x)^2*%i*%pi));
(2.0b0+x)^2*%i*%pi;
exp(3/2*%pi*%i);
-%i;
exp(1.5*%pi*%i);
-1.0*%i;
exp(1.5b0*%pi*%i);
-1.0b0*%i;
exp((3/2+x)*%pi*%i);
-%i*exp(%i*%pi*x);
exp((1.5+x)*%pi*%i);
-%i*exp(1.0*%i*%pi*x);
exp((1.5b0+x)*%pi*%i);
-%i*exp(1.0b0*%i*%pi*x);
/* Bug ID: 2781127 - bfpsi0 of complex
*
* (The result was not in rectangular form but it should be.)
*/
bfpsi0(4.5 + %i,15);
2.43845477527606b-1*%i + 1.41875534014717b0;
/* Bug ID: 2988190 - atan2(1b20,-1b0); badly wrong
* It's really a bug in atan for x < -1, so test both.
*/
(fpprec:16, atan(-1b20));
-1.570796326794897b0;
atan2(1b20,-1b0);
1.570796326794897b0;
/*
* Bug ID: 2991924 - Incorrect integration of rational functions
*/
integrate(1/(x^4-2),x,0,1) - integrate(1/(x^2-sqrt(2))/(x^2+sqrt(2)),x,0,1);
0;
integrate(1/(x^6-4),x,0,1) - integrate(1/(x^3-2)/(x^3+2),x,0,1);
0;
/* BUG ID: 2113751 - Incomprehensible behavior of coeff()
*/
coeff(2*%e^x, x, 0);
2*%e^x;
/* For numerical tests */
closeto(e,tol):=block([numer:true,abse],abse:abs(e),if(abse<tol) then true else abse);
closeto(e,tol):=block([numer:true,abse],abse:abs(e),if(abse<tol) then true else abse);
/* Bug ID: 2997276 - zeta(3),numer; gives Lisp error
*
* Also add a test for complex rational argument, which wasn't handled
* correctly either.
*
* Some Lisp implementations fail these tests because things like
* (cl:expt 2d0 3) only gives single-float accuracy (but with
* double-float precision).
*/
closeto(zeta(3)-1.202056903159594,1e-15), numer:true;
true;
closeto(zeta(3+%i)-(1.10721440843141 - .1482908671781754*%i), 1e-15);
true;
/*
* Reported on mailing list 2011-05-22 by Thomas Dean:
*
* plot2d(abs(zeta(1/2+x*%i)),[x,0,36]) causes a Lisp error with
* clisp.
*
*/
closeto(abs(zeta(1/2+.5*%i)) - 1.06534921249378, 1e-14);
true;
/* Bug ID: 2997401 - float(log(200!)) produces an error
*
*/
closeto(float(log(200!))-863.2319871924054, 1e-15);
true;
closeto(float(log((1+200!)/7))-861.2860770433501, 1e-15);
true;
/* Additional tests */
closeto(float(log(-1))-float(%pi)*%i, 1e-15);
true;
closeto(float(log((1+200!)/(-7))) - (3.141592653589793*%i + 861.2860770433501), 1e-14);
true;
closeto(float(log((1+200!)+(1+199!)*%i))- (.004999958333958322*%i + 863.2319996922491), 1e-15);
true;
closeto(float(log((1+200!)/7+(1+199!)/11*%i)) - (.003181807444342708*%i + 869.9736929490153), 1e-15);
true;
/* Bug ID: 2306402 - scalarp bug
* Bug ID: 1985748 - array and scalar declarations yield inconsistent results
* Examples from the bug report to show consistent behavior of scalarp
*/
declare(x,scalar);
done;
scalarp(foo(x));
true;
scalarp(foo(1));
true;
scalarp(foo(x,1));
true;
scalarp(x);
true;
scalarp(x[1]);
true;
array(x,5);
x;
scalarp(x);
true;
scalarp(x[1]);
true;
nonscalarp(x);
false;
kill(x);
done;
/* Bug ID:1723548 - gradef for variables: not used in diff
* Show that the total differential of f works in expressions too.
*/
depends(f,[x,y]);
[f(x,y)];
diff(f);
'diff(f,y,1)*del(y)+'diff(f,x,1)*del(x)$
diff(3*f);
3*'diff(f,y,1)*del(y)+3*'diff(f,x,1)*del(x)$
diff(a*f);
a*'diff(f,y,1)*del(y)+a*'diff(f,x,1)*del(x)+f*del(a)$
remove(f,dependency);
done;
/* Bug ID: 1089719 addrow creates strange matrix
*/
m:matrix([0,0]);
matrix([0,0]);
m:addrow(m,m);
matrix([0,0],[0,0])$
m[1,1]:11;
11;
m;
matrix([11,0],[0,0])$
kill(m);
done;
/* Bug ID: 1663385 - declare multiplicative - wrong simplification
*/
declare(f,additive,f,multiplicative);
done;
f(a*b+c);
f(a)*f(b)+f(c);
kill(f);
done;
/* Bug ID: 816808 - subst(in)part of rat -- internal errs
*/
substpart(x,2/3,2);
2/x;
substinpart(4,2/3,2);
1/2;
/* Bug ID: 1117533 - letsimp complains about assignment to %pi
*/
matchdeclare(a,true);
done;
(let(%pi*a,foo(a)),done);
done;
letsimp(%pi*x);
foo(x);
remlet(%pi*a);
done;
/* Bug ID: 2805600 depends() partially prevents diff() to work
*/
depends(t,x);
[t(x)];
diff(f(t),z);
0;
remove(t,dependency);
done;
/* Bug ID: 1184718 - AT needs soime basic simplifications
*/
'at(2,x=0);
2;
/* Bug ID: 2998227 - spurious at(0,A=0)
*/
taylor(integrate(gamma(x+1),x,0,A),A,0,3),nouns;
A-%gamma*A^2/2+(6*%gamma^2+%pi^2)*A^3/36;
/* Bug ID: 3010829 - numerical evaluation of elliptic_ec fails for argument > 1
*/
closeto(elliptic_ec(2.0)-(.5990701173677959*%i+0.599070117367796), 1.5e-15);
true;
/* Bug ID: 1929287 - 0.0 + [0] ---> [0]
*/
0.0+[0];
[0.0];
0.0b0+[0];
[0.0b0];
0.0+matrix([0,1/2,1,x]);
matrix([0.0,0.5,1.0,x]);
0.0b0+matrix([0,1/2,1,x]);
matrix([0.0b0,5.0b-1,1.0b0,x]);
/* Bug ID: 2996106 - at(diff(f(x,y),x,1,y,1),[x=a,y=b]) is wrong
*/
at(diff(f(x,y),x,1,y,1),[x=a,y=b]);
'at('diff(f(x,y),x,1,y,1),[x = a,y = b]);
/* Bug report ID: 2556133 - "at" should do parallel substitutions
*/
errcatch(at(atan2(y^2+1,x),[y=%i,x=0]));
[];
errcatch(at(atan2(y^2+1,x),[x=0,y=%i]));
[];
/* Bug report ID: 2014941 - compositions of 'at'
*/
at(at(diff(f(x),x),[x=b]),[b=y]);
'at('at('diff(f(x),x,1),[x = b]),[b = y]);
at(diff(f(x,y),x,1,y,1),[x=a,y=b]) - at(diff(f(x,y),x,1,y,1),[y=b,x=a]);
0;
/* Bug report ID: 1677217 - composistions of 'at'
*/
depends(y,[x,z]);
[y(x,z)];
at(at(diff(y,x),x=a),z=b);
'at('at('diff(y,x,1),x = a),z = b);
remove(y,dependency);
done;
/* Bug report ID: 3023978 - integrate(x^x+x,x) is wrong
*/
integrate(x^x+x,x);
'integrate(exp(x*log(x)),x)+x^2/2;
/* Bug report ID: 2465066 - unsimplified result from integrate
*/
matchdeclare(x, symbolp);
done;
(tellsimpafter('integrate(f(x),x), g(x)),done);
done;
integrate(5*f(x) + 7,x);
5*g(x)+7*x;
kill(rules);
done;
/* Bug report ID: 2789110 - solve, tan and atan depend on order of variables
*/
solve(tan(x - atan(a/b)) = 0, x);
[x = atan(a/b)];
solve(tan(x - atan(b/a)) = 0, x);
[x = atan(b/a)];
/* Bug report ID: 1961494 - translated functions & values list
*/
(kill(all), f():= x:2, translate(f));
[f];
f();
2;
values;
[x];
kill(f,x);
done;
/* The value of x has been removed. */
x;
'x;
/* Bug report ID: 3025038 - gruntz needs logexpand:true
*/
gruntz( (x + 2^x) / 3^x, x, inf),logexpand:false;
0;
/* Bug report ID: 2977217 - maxima can not integrate x*exp(-1/2*(x-m)^2)
*/
integrate(x*exp(-1/2*(x-m)^2),x);
%i*(sqrt(2)*%i*gamma_incomplete(1,(m-x)^2/2)*(m-x)^2/(x-m)^2
-%i*gamma_incomplete(1/2,(m-x)^2/2)*m*(m-x)/abs(x-m))/sqrt(2);
/* Bug report ID: 2996542 - log(x) integration is incorrect
*/
assume(a>0);
[a>0];
integrate(log(x),x,0,a);
a*log(a)-a;
forget(a>0);
[a>0];
/* Bug report ID: 3062883 - diff does not recognize indirect dependencies
* in expressions
*/
depends([a,b],x,x,t);
[a(x),b(x),x(t)];
diff(-a,t);
-'diff(a,x,1)*'diff(x,t,1);
diff(a*b,t);
a*'diff(b,x,1)*'diff(x,t,1)+'diff(a,x,1)*b*'diff(x,t,1);
remove([a,b,x],dependency);
done;
/* Bug report ID: 3080397 - laplace(unit_step(-t),t,s) generates an error.
*/
laplace(unit_step(-t),t,s);
0;
/* Bug report ID: 3081820 - lbfgs causes error
*
* Still generates an error, but a different error that maxima
* signals.
*/
block([V:0.75, a:24, b:68, e],
C(r) := 2*%pi*b*r^2 + 4*a*%pi*r + 2*b*V/r + a*V/(%pi*r^2),
load(lbfgs),
/* This should signal an error that we catch */
e : errcatch(lbfgs(C(r), [r], [1], 1e-4, [1,0])),
[e, error]);
[[], ["Evaluation of gradient at ~M failed. Bad initial point?~%", [0.0]]];
/* Bug report ID: 875089 - defint(f(x)=g(x),x,0,1) -> false = false
*
* We distribute defint more early in the code of bags to get a correct result.
*/
defint(f(x)=g(x),x,0,1);
'integrate(f(x),x,0,1)='integrate(g(x),x,0,1);
/* Bug report ID: 2796194 - error doing a Fourier transform
* The following integral is divergent, but gives a noun form.
* The Lisp error is no longer present.
*/
(assume(equal(x,0)),done);
done;
integrate(%pi*exp(-2*%pi*t)*exp(2*%pi*x*t*%i),t,minf,inf);
%pi*'integrate(%e^(2*%i*%pi*t*x-2*%pi*t),t,minf,inf);
(forget(equal(x,0)),done);
done;
/* Bug reported on the mailing list
* <http://www.math.utexas.edu/pipermail/maxima/2010/023024.html>
* integrate(cos(2*x)*cos(x),x) is wrong.
*
* Add a few more test that are similar to test the part of
* monstertrig that deals with trig1(m*x)*trig2(n*x) where trig1 and
* trig2 are either sin or cos.
*/
integrate(cos(2*x)*cos(x),x);
sin(3*x)/6+sin(x)/2;
integrate(sin(2*x)*sin(x),x);
sin(x)/2-sin(3*x)/6;
integrate(cos(2*x)*sin(x),x);
cos(x)/2-cos(3*x)/6;
integrate(sin(x)*cos(2*x),x);
cos(x)/2-cos(3*x)/6;
/* Bug ID: 3111568 - subsequent calls to gradef hide variable dependencies
*/
gradef(f,x,g);
f;
gradef(f,y,h);
f;
dependencies;
[f(y,x)];
kill(f);
done;
/* Bug ID: 3118770 - %edispflag:true causes a bug
*/
%edispflag:true;
true;
integrate(x/(%e)^(2*x), x, 0, 1);
1/4-3/(4*%e^2);
reset(%edispflag);
[%edispflag];
/* Bug ID: 3067098 - The command timer for a Lisp function
* Check that the function trisplit does not go away, when we collect
* timing statistics for this function and call later kill(all).
*/
timer(?trisplit);
[?trisplit];
kill(all);
done;
rectform(1+%i);
1+%i;
/* Bug ID: 3133916 - scanmap(minfactorial,a!) infinite loop
*/
scanmap(minfactorial, a!);
a!;
/* Bug ID: 3131324 - simplification of sqrt
*/
sqrt(x^3)/sqrt(x^3);
1;
/* Bug ID: 1285104 - trigsimp and trigreduce & square roots
*/
trigreduce(sqrt(r^2*sin(x)^2+r^2*cos(x)^2));
abs(r);
trigreduce(sqrt(r^2*sin(x)^2+r^2*cos(x)^2)),radexpand:all;
r;
radexpand:false;
false;
trigreduce(sqrt(r^2*sin(x)^2+r^2*cos(x)^2));
sqrt(r^2);
reset(radexpand);
[radexpand];
/* Bug ID: 917283 - Comment syntax confused
* Show that nested comments work as expected.
*/
a/*/**/*/+b;
a+b;
a/*/**/*/+/*/**/*/b;
a+b;
/* Bug ID: 3138054 - bfloat problem / FIX -
*/
exp(gamma(1/3)),bfloat;
1.45696199392313b1;
/* Bug ID: 3288989 - Lisp functions and linear display
* Show that we do not get a Lisp error.
*/
grind(?cdr([a,b,c]));
done;
/* Bug ID: 3291590 - Problems with fast arrays
*/
(a:make_array(hashed), done);
done;
a[100]:100;
100;
a[x]:sin(x);
sin(x);
a[x*y]:x^2+y;
y+x^2;
/* Cutting out these two examples.
* The ordering of the lists is different depending on the underlying Lisp.
*
* arrayinfo(a);
* [hash_table,1,100,x,x*y];
* listarray(a);
* [100,sin(x),y+x^2];
*/
(f:make_array(functional, 'factorial, hashed), done);
done;
f[10];
3628800;
(a: make_array(fixnum, 2, 2), done);
done;
listarray(a);
[0, 0, 0, 0];
use_fast_arrays:true;
true;
(array(a, any, 2, 2), done);
done;
arrayinfo(a);
[declared, 2, [2, 2]];
(array(a, fixnum, 2, 2), done);
done;
arrayinfo(a);
[declared, 2, [2, 2]];
(array(a, flonum, 2, 2), done);
done;
arrayinfo(a);
[declared, 2, [2, 2]];
(array(a, hashed), done);
done;
arrayinfo(a);
[hash_table, 1];
reset(use_fast_arrays);
[use_fast_arrays];
kill(a);
done;
/* Bug ID: 3247367 - expand returns unsimplified
*/
sqrt(2)+sqrt(2);
2^(3/2);
sqrt(2)+sqrt(2)+sqrt(2);
3*sqrt(2);
sqrt(2)+sqrt(2)+sqrt(2)+sqrt(2);
2^(5/2);
sqrt(2)+sqrt(2)+sqrt(2)+sqrt(2)+sqrt(2);
5*sqrt(2);
2*sqrt(2)+3*sqrt(2);
5*sqrt(2);
3*sqrt(2)+2*sqrt(2);
5*sqrt(2);
3*sqrt(2)+2*sqrt(2)+sqrt(2);
3*2^(3/2);
sqrt(2)+3*sqrt(2)+2*sqrt(2);
3*2^(3/2);
sqrt(1/2)+sqrt(1/2);
sqrt(2);
sqrt(1/2)+sqrt(1/2)+sqrt(1/2);
3/sqrt(2);
sqrt(1/2)+sqrt(1/2)+sqrt(1/2)+sqrt(1/2);
2^(3/2);
sqrt(1/2)+sqrt(1/2)+sqrt(1/2)+sqrt(1/2)+sqrt(1/2);
5/sqrt(2);
2*sqrt(1/2)+3*sqrt(1/2);
5/sqrt(2);
3*sqrt(1/2)+2*sqrt(1/2);
5/sqrt(2);
3*sqrt(1/2)+2*sqrt(1/2)+sqrt(1/2);
3*sqrt(2);
sqrt(1/2)+3*sqrt(1/2)+2*sqrt(1/2);
3*sqrt(2);
2^(1/5)+2^(1/5);
2^(6/5);
2^(1/5)+2^(1/5)+2^(1/5);
3*2^(1/5);
2^(1/5)+2^(1/5)+2^(1/5)+2^(1/5);
2^(11/5);
2^(1/5)+2^(1/5)+2^(1/5)+2^(1/5)+2^(1/5);
5*2^(1/5);
(1/2)^(1/5)+(1/2)^(1/5);
2^(4/5);
(1/2)^(1/5)+(1/2)^(1/5)+(1/2)^(1/5);
3/2^(1/5);
(1/2)^(1/5)+(1/2)^(1/5)+(1/2)^(1/5)+(1/2)^(1/5);
2^(9/5);
(1/2)^(1/5)+(1/2)^(1/5)+(1/2)^(1/5)+(1/2)^(1/5)+(1/2)^(1/5);
5/2^(1/5);
2*(1/2)^(1/5)+3*(1/2)^(1/5);
5/2^(1/5);
3*(1/2)^(1/5)+2*(1/2)^(1/5);
5/2^(1/5);
2^sin(x)+2^sin(x);
2^(sin(x)+1);
2^sin(x)+2^sin(x)+2^sin(x);
3*2^sin(x);
2^sin(x)+2^sin(x)+2^sin(x)+2^sin(x);
2^(sin(x)+2);
2^sin(x)+2^sin(x)+2^sin(x)+2^sin(x)+2^sin(x);
5*2^sin(x);
(1/2)^sin(x)+(1/2)^sin(x);
2^(1-sin(x));
(1/2)^sin(x)+(1/2)^sin(x)+(1/2)^sin(x);
3/2^sin(x);
(1/2)^sin(x)+(1/2)^sin(x)+(1/2)^sin(x)+(1/2)^sin(x);
2^(2-sin(x));
(1/2)^sin(x)+(1/2)^sin(x)+(1/2)^sin(x)+(1/2)^sin(x)+(1/2)^sin(x);
5/2^sin(x);
(1-sqrt(5))^3-4*(1-sqrt(5))^2+8, expand;
0;
1/sqrt(2)+1/sqrt(2)+1/sqrt(2);
3/sqrt(2);
2^(9/5)+2^(4/5);
3*2^(4/5);
3*sqrt(2)+2*sqrt(2);
5*sqrt(2);
2*sqrt(2)+3*sqrt(2);
5*sqrt(2);
(1-sqrt(5))^3, expand;
16-8*sqrt(5);
p : z^3-2^(3/2)*%i*z^2-4*z^2+2^(5/2)*%i*z+2*z;
z^3-2^(3/2)*%i*z^2-4*z^2+2^(5/2)*%i*z+2*z;
divide(p, (z-2-sqrt(2)*%i),z);
[z^2+(-sqrt(2)*%i-2)*z,0];
2^a + 3*2^(a+1);
7*2^a;
2^(3/5)+2^(-2/5);
3/2^(2/5);
2^(3/5+x)+2^(-2/5+x);
3*2^(x-2/5);
/* -----------------------------------------------------------------------------
* Bug ID: 1439566 - zerobern & bernpoly
* Show that the option variable zerobern does not change the results.
* -------------------------------------------------------------------------- */
zerobern:false;
false;
bernpoly(x,3);
x^3-3*x^2/2+x/2$
bernpoly(x,5);
x^5-5*x^4/2+5*x^3/3-x/6$
reset(zerobern);
[zerobern];
/* Show that bern no longer fails with zerobern:false.
*
* The compared values are from A&S p810, Table 23.2.
*/
bern(28);
-23749461029/870$
bern(40);
-261082718496449122051/13530$
euler(16);
19391512145$
zerobern:false;
false$
bern(17);
-7709321041217/510$
bern(24);
596451111593912163277961/282$
euler(10);
370371188237525$
reset(zerobern);
[zerobern]$
/* -----------------------------------------------------------------------------
* Bug ID: 2905929 - gcdex
* -------------------------------------------------------------------------- */
q0[2] : 6;
6$
ratdisrep(gcdex(x-7, x-8));
[1,-1,1]$
is(equal(gcdex(z^2-1, 0, z), [1,0,z^2-1]));
true;
is(equal(gcdex(0, z^2-1, z), [0, 1, z^2-1]));
true;
/* Examples from the Maxima Manual */
is(equal(gcdex(x^2+1, x^3+4), [-(x^2+4*x-1)/17,(x+4)/17,1]));
true$
is(equal(gcdex(x*(y+1), y^2-1, x), [0,1/(y^2-1),1]));
true$
kill(q0);
done;
/* -----------------------------------------------------------------------------
* Bug ID: 3389830 - Error break in rtest15 with linear display
*
* Show that we do not get an error with grind for a prefix and a postfix
* Operator when displaying the definition of a function or a macro.
* This is a test of the function msz-mdef in grind.lisp.
* -------------------------------------------------------------------------- */
(postfix("f"), prefix("g"), done);
done$
grind("f"(x):=x);
done$
grind("f"(x)::=x);
done$
grind("g"(x):=x);
done$
grind("g"(x)::=x);
done$
/* -----------------------------------------------------------------------------
* Bug ID: 3396631 - equal terms produce different results
* Correcting a bug in plusin revision 23.08.2011
* -------------------------------------------------------------------------- */
5*sqrt(5)+2*sqrt(3)+6*sqrt(5);
11*sqrt(5)+2*sqrt(3)$
5*sqrt(5)+4*sqrt(3)+6*sqrt(5);
11*sqrt(5)+4*sqrt(3)$
5*sqrt(5)+3*sqrt(5)+5*sqrt(3)+3*sqrt(3)+2*sqrt(75)+2*sqrt(45);
14*sqrt(5)+2*3^(5/2)$
5*sqrt(5)+5*sqrt(3)+3*sqrt(3)+2*sqrt(75)+2*sqrt(45)+3*sqrt(5);
14*sqrt(5)+2*3^(5/2)$
5*sqrt(5)+5*sqrt(3)+2*sqrt(75)+2*sqrt(45)+3*sqrt(5)+3*sqrt(3);
14*sqrt(5)+2*3^(5/2)$
/* -----------------------------------------------------------------------------
* Bug ID 3437268: expand doesn't fully expand
* Check the expected results after revision 14.11.2011 of simp.lisp.
* -------------------------------------------------------------------------- */
-3*a/sqrt(2)+sqrt(2)*a+a/sqrt(2);
0$
expand(-(atan((sqrt(2)*sin(8))/cos(8))+3*%pi)/sqrt(2)
+atan((sqrt(2)*sin(8))/cos(8))/sqrt(2)
+sqrt(2)*%pi
+%pi/sqrt(2));
0$
/*
* SF Bug: elliptic_e error observed - ID: 3438911
*
* Test the bug by using the identity:
* elliptic_e(%pi,m) = 2*elliptic_ec(m)
*
* There's also a bug in elliptic_f. We test this using the identity:
* elliptic_f(%pi,m) = 2*elliptic_kc(m)
*/
closeto(e,tol):=block([numer:true,abse],abse:abs(e),if(abse<tol) then true else abse);
closeto(e,tol):=block([numer:true,abse],abse:abs(e),if(abse<tol) then true else abse);
closeto(elliptic_e(float(%pi), .1) - 2*elliptic_ec(.1), 1e-15);
true;
closeto(elliptic_e(float(%pi), .9) - 2*elliptic_ec(.9), 1e-15);
true;
closeto(elliptic_e(bfloat(%pi), .1b0) - 2*elliptic_ec(.1b0), 1e-16);
true;
closeto(elliptic_e(bfloat(%pi), .9b0) - 2*elliptic_ec(.9b0), 1e-16);
true;
closeto(elliptic_f(float(%pi), .1) - 2*elliptic_kc(.1), 1e-15);
true;
closeto(elliptic_f(float(%pi), .9) - 2*elliptic_kc(.9), 1e-15);
true;
closeto(elliptic_f(bfloat(%pi), .1b0) - 2*elliptic_kc(.1b0), 1e-16);
true;
closeto(elliptic_f(bfloat(%pi), .9b0) - 2*elliptic_kc(.9b0), 1e-16);
true;
/*
* Bug 3526111 - float erf (%i) not working
*/
closeto(float(erf(%i)) - 1.650425758797543*%i, 1e-15);
true;
/*
* Bug 3529992: Shi (sinh integral) wrong branch, integrate inconsistent
*/
closeto(float(expintegral_shi(1/2) - 0.50699674981966719583), 3e-16);
true;
/* integrate changes k[0] --> k(0) - ID: 3530767 */
integrate(x * (x^2 + k[0])/(1 + x^2),x);
((k[0]-1)*log(x^2+1))/2+x^2/2$
/* polarform error on simple case - ID: 3517034 */
polarform((a+1)/2 - a/2 - 1/2);
0$
polarform((a+1)/2 - a/2 - 0.5);
0.0$
polarform((a+1)/2 - a/2 - 0.5b0);
0.0b0$
/* #2531 Integration with inf */
errcatch(integrate((1+1/x)^(1/2),x,1,inf));
[];
error;
["defint: integral is divergent."];
/*
* ID: 3440046: elliptic_f(0.5,1) signals error
*
* Add a few more tests for invalid values.
*/
closeto(elliptic_f(0.5,1)-elliptic_f(1/2,1), 1e-15);
true;
closeto(elliptic_f(0.5b0,1) - bfloat(elliptic_f(1/2,1)), 1b-16);
true;
errcatch(elliptic_f(2.0,1));
[];
errcatch(elliptic_f(2b0,1));
[];
/*
* Bug 3428734: integrate(bessel_y(1,z),z) with ?z : 1
*/
(?z:1, 0);
0;
integrate(bessel_y(1,z),z);
-bessel_y(0,z);
integrate(bessel_j(1,z),z);
-bessel_j(0,z);
integrate(bessel_k(1,z),z);
-bessel_k(0,z);
integrate(bessel_i(1,z),z);
bessel_i(0,z);
/*
* Bug 3381301: log(-1.0b0) has small realpart
*/
realpart(log(-1b0));
0;
/*
* Bug 3559064: elliptic_f(2,1) is wrong.
*/
errcatch(elliptic_f(2,1));
[];
/*
* Bug 2528: A variable should be real if it is both real and complex
*/
(declare(foo, real), declare(foo, complex), 0);
0$
[realpart(foo), imagpart(foo)];
[foo, 0]$
(kill(foo), 0);
0$
map(lambda([x], featurep(x, 'irrational)),[42,%pi,%phi,%e]);
[false, true, true, true]$
/* #2501 %pi/8 is definitely not an integer */
integrate(log(cot(x)-1),x,0,%pi/4);
(%i*li[2]((%i+1)/2)-%i*li[2](-((%i-1)/2)))/2 -(%i*(2*li[2](%i+1)-2*li[2](1-%i))+%pi*log(2))/4$
integrate(log(cos(x)),x,0,%pi/2);
%i*%pi^2/24-(6*%pi*log(4)+%i*%pi^2)/24$
map(lambda([x], featurep(x, noninteger)),[sqrt(5),%pi,%pi/3, %pi/8,log(42),99/2013]);
[true,true,true,true,true,true]$
map(lambda([x], featurep(x, noninteger)),[0,1,2013]);
[false,false,false]$
/* #2583 sign error for integrate(x^(8*%i-1),x) */
block([domain : 'real], integrate(x^(8*%i-1),x));
-%i*x^(8*%i)/8$
/* #2602: some-bfloatp and some-floatp recursed wrongly on rat expressions */
?some\-bfloatp(rat(1/2));
false$
/* #2594: Error in trigreduce for complicated expressions */
subst(0, x, trigreduce(product(cos(k*x), k, 1, 8)));
1$
/* #2591: Risch gives lisp error */
(risch(asinh((z^2-1)/z)/z,z), 0);
0$
|