This file is indexed.

/usr/share/giac/doc/xcasfr.html is in giac-doc 1.2.3.57+dfsg1-2build3.

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
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
<!DOCTYPE HTML>
<html id="fulldocument" lang="fr"> 
<head>
<meta charset="utf-8">
<meta name=viewport content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="xcas, firefox, navigateur, calcul, formel, en, ligne, programmation, algorithmique">
<title>
Session_Xcas
</title>

<style>
html {
    background-color: #FFFFFF;
}
body {
    color: black;
    text-align: justify;
    background-color: #FFFFFF;
}
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
canvas.emscripten { border: 1px solid black; }
textarea.emscripten { font-family: monospace; width: 100%; }
div.emscripten { text-align: center; }
</style>

<style id="document_style" type="text/css">
h1,h2,h3 { display:inline; font-size:1em;}
 input[type="number"] {
width:40px;
font-size:24px;
}
input[type="text"] {
width:40px;
font-size:24px;
}
input[type="button"] {
width:40px;
font-size:24px;
}
.outdiv {
width: 410px;
max-height: 200px;
  overflow: auto;
}
.filenamecss {
width:120px;
height:20px
}
.historyinput {
width:400px;
}
</style>
<style type="text/css">

.matrixcell {
  font-size:18px;
}

td.matrixcell {
border: 1px solid ;
}

input.matrixcell {
  width: 100px;
}

input.matrixcell:hover {
  background-color: #eee;
}

input.matrixcell:focus {
  background-color: #ccf;
}

input.matrixcell:not(:focus) {
  text-align: right;
}

textarea.matrixcell {
  width: 100px;
  height: 22px;
}

textarea.matrixcell:hover {
  background-color: #eee;
}

textarea.matrixcell:focus {
  background-color: #ccf;
}

textarea.matrixcell:not(:focus) {
  text-align: right;
}

div.matrixcell:hover {
  background-color: #eee;
}

div.matrixcell:focus {
  background-color: #ccf;
}

div.matrixcell:not(:focus) {
  text-align: right;
}
</style>

</head>

<body>
<!-- https://developer.mozilla.org/fr/docs/Web/API/Service_Worker_API/Using_Service_Workers
pour le moment, on utilise manifest="xcas.appcache" en en-tete et on modifie xcas.appcache...
-->
    
<script language="javascript">
if (window.location.href.substr(0,4)=="http"){
 if ('serviceWorker' in navigator) {
   navigator.serviceWorker.register('service-worker.js');
 }
}
KEY_DOWN	= 40;
KEY_UP		= 38;
KEY_LEFT	= 37;
KEY_RIGHT	= 39;

KEY_END		= 35;
KEY_BEGIN	= 36;



KEY_BACK_TAB 	= 8;
KEY_TAB				= 9;
KEY_SH_TAB  	= 16;
KEY_ENTER			= 13;
KEY_ESC				= 27;
KEY_SPACE			= 32;
KEY_DEL				= 46;

KEY_A		= 65;
KEY_B		= 66;
KEY_C		= 67;
KEY_D		= 68;
KEY_E		= 69;
KEY_F		= 70;
KEY_G		= 71;
KEY_H		= 72;
KEY_I		= 73;
KEY_J		= 74;
KEY_K		= 75;
KEY_L		= 76;
KEY_M		= 77;
KEY_N		= 78;
KEY_O		= 79;
KEY_P		= 80;
KEY_Q		= 81;
KEY_R		= 82;
KEY_S		= 83;
KEY_T		= 84;
KEY_U		= 85;
KEY_V		= 86;
KEY_W		= 87;
KEY_X		= 88;
KEY_Y		= 89;
KEY_Z		= 90;

KEY_PF1		= 112;
KEY_PF2		= 113;
KEY_PF3		= 114;
KEY_PF4		= 115;
KEY_PF5		= 116;
KEY_PF6		= 117;
KEY_PF7		= 118;
KEY_PF8		= 119;

REMAP_KEY_T	= 5019;
	
function checkEventObj ( _event_ ){
	// --- IE explorer
	if ( window.event )
		return window.event;
	// --- Netscape and other explorers
	else
		return _event_;
}
	
function applyKey (_event_){	
 // --- Retrieve event object from current web explorer
 var winObj = checkEventObj(_event_);	
 var intKeyCode = winObj.keyCode;
 var intAltKey = winObj.altKey;
 var intCtrlKey = winObj.ctrlKey;
 // raccourcis avec Alt
 // F1 aide, c cmdline, m menu, 
 if (intAltKey) {
   var done=false;
   if (intKeyCode == KEY_D || intKeyCode == KEY_B || intKeyCode == KEY_RIGHT){
    UI.move_focus(UI.focused,1);
    done=true;
   }		
   if (intKeyCode == KEY_G || intKeyCode == KEY_V || intKeyCode == KEY_LEFT){
    UI.move_focus(UI.focused,-1);
    done=true;
   }
   if (intKeyCode == KEY_N || intKeyCode == KEY_DOWN){
    UI.move_focus(UI.focused,1); UI.move_focus(UI.focused,1);
    done=true;
   }
   if (intKeyCode == KEY_P || intKeyCode == KEY_UP){
    UI.move_focus(UI.focused,-1); UI.move_focus(UI.focused,-1);
    done=true;
   }
   if (intKeyCode == KEY_A){
    document.getElementById('helptxt').focus();
    done=true;
   }
   if (intKeyCode == KEY_C){
    cmentree.focus();
    done=true;
   }
   if (intKeyCode == KEY_M){
    UI.show_menu();
    done=true;
   }
   if (intKeyCode == KEY_T || intKeyCode==KEY_TAB || intKeyCode==KEY_PF1){
    UI.completion(cmentree);
    done=true;
   }
   if (done){
    // --- Map the keyCode in another keyCode not used
    winObj.keyCode = REMAP_KEY_T;
    winObj.returnValue = false;
    return false;
   }
 }	
}

document.onkeydown = applyKey;

</script>

<div id="startup2" style="display:none">
  <button
  onclick="if (UI.usecm){ document.getElementById('config').usecm.checked=false;  UI.set_config();} cmentree.focus();">Version accessible</button>
  pour deficients visuels,
  <a href="xcasen.html">English version</a>.  
</div>  
<div id="startup1">
  Bienvenue dans Xcas pour Firefox ou navigateur compatible
  (c) 2017, B. Parisse et R. De Graeve, Institut Fourier,
  Universit&eacute; de Grenoble.
</div>
<div id="startup">
  Si Xcas ne fonctionne pas, <a
  href="https://fr.wikipedia.org/wiki/Aide:Purge_du_cache_du_navigateur">effacez
  compl&egrave;tement le cache du navigateur</a> et rechargez.
  <br>
  Consultez le 
  <button  
  onclick="if(document.getElementById('help').style.display=='none') document.getElementById('help').style.display='block';  else document.getElementById('help').style.display='none';" title="Montrer ou cacher le tutoriel">Tutoriel</button>
  sous l'icone de Xcas.  
<hr>
</div>
<span id="apropos" style="display:none">
Xcasfr.html est une interface javascript optimis&eacute;e pour Firefox
du système de calcul formel
<a
href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/emgiac.tgz">Giac/Xcas</a>
compil&eacute; par emscripten (l'&eacute;diteur de
programme de cette interface
utilise <a href="http://codemirror.net">CodeMirror</a>).
Il n'a pas besoin de serveur, il s'exécute localement
(avec le moteur javascript de votre navigateur qui doit être récent,
mettez-le &agrave; jour pour avoir de bonnes performances, il faut
aussi avoir au moins 300M de RAM disponible)
à partir du code du CAS (13M) qui est téléchargé
une fois. Le prix à payer pour cette simplicité
est la vitesse, le code est au moins 2 fois plus lent, parfois
beaucoup plus (par exemple 8 fois plus lent pour un calcul intensif
de bases de Groebner).
La plupart du temps, cela n'est pas vraiment
genant, mais
si vous devez exécuter un gros calcul, il
vaut mieux installer
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac_fr.html">Xcas</a>!
<br>
Giac/Xcas (c) 2017 B. Parisse, R. De Graeve, Institut Fourier, Université
de Grenoble, sous licence GPL3, pour une licence commerciale nous
contacter.
<br>
Sortie mathml et SVG (c) code principalement &eacute;crit par J.P. Branchard.
<br>
<button onclick="parentNode.style.display='none'">Masquer</button>
<hr>
</span>

<form id="config" style="display:none" onsubmit="setTimeout(function(){
  UI.set_config();
}); return false">
<h2>Configuration</h2>
<table>
  <tr>
    <td>
      Chiffres:<input class="bouton" type="number" name="digits_mode" title="Nombre de chiffres significatifs (si &gt; 14 multipr&eacute;cision, calculs plus lents)" value=12>
      Autosimplification: <input class="bouton"
      type="number" name="autosimp_level"
  title="0: pas d'autosimplification, 1: minimum, 2: maximum" value=1
  max=2 min=0>
    </td>
    </tr>
    <tr>
    <td>
      <input class="bouton" type="button" title="Bascule unit&eacute; d'angles radians/degr&eacute;s" value="Radians" onclick="angle_mode.checked=!angle_mode.checked;"> <input class="bouton" type="checkbox" name="angle_mode" title="Cocher pour utiliser les radians, d&eacute;cocher pour utiliser les degr&eacute;s" checked>,
      <input class="bouton" type="button" title="Bascule mode complexe/r&eacute;el" value="Complexe" onclick="complex_mode.checked=!complex_mode.checked"> <input class="bouton" type="checkbox" name="complex_mode" title="Cocher pour travailler par d&eacute;faut sur les complexes">,
      <input class="bouton" type="button" title="Bascule pour toujours factoriser les polynomes de degr&eacute; 2" value=" √ " onclick="sqrt_mode.checked=!sqrt_mode.checked"> <input class="bouton" type="checkbox" name="sqrt_mode" title="Cocher pour toujours factoriser les polynomes de degr&eacute; 2">,
      <input class="bouton" type="button" title="Bascule pour montrer les &eacute;tapes de certains calculs" value="step" onclick="step_mode.checked=!step_mode.checked"> <input class="bouton" type="checkbox" name="step_mode" title="Cocher pour montrer les &eacute;tapes de certains calculs" checked>,
      <input class="bouton" type="button" title="Bascule pour executer les calculs par un webworker" value="worker" onclick="worker_mode.checked=!worker_mode.checked"> <input class="bouton" type="checkbox" name="worker_mode" title="Cocher pour executer les calculs par un webworker">
    </td>
  </tr>
  <tr>
    <td>
      <input class="bouton" type="button" title="Bascule pour affichage 2d" value="2d" onclick="prettyprint.checked=!prettyprint.checked"> <input class="bouton" type="checkbox" name="prettyprint"
  title="Cocher pour affichage 2d" checked>,
      <input class="bouton" type="button" title="Bascule pour avoir commandes et reponses sur le meme niveau" value="Q/R sur 1 ligne" onclick="qa.checked=!qa.checked"> <input class="bouton" type="checkbox" name="qa"
  title="Cocher pour avoir commandes et reponses sur le meme niveau">,
      <input class="bouton" type="button" title="Coloration syntaxique si on edite un niveau existant" value="Coloration syntaxique" onclick="usecm.checked=!usecm.checked"> <input class="bouton" type="checkbox" name="usecm"
      title="Coloration syntaxique si on edite un niveau existant">
      
    </td>
  </tr>
  <tr>
    <td>
      Historique <input class="bouton" type="number" name="history_width" value=1000
        title="Largeur maximale de l'historique">
      par <input class="bouton" type="number" name="history_height" value=400
  title="Hauteur maximale de l'historique">      
      Sortie <input class="bouton" type="number" name="outdiv_width" value=410
  title="Largeur maximale d'un champ r&eacute;ponse">
      par <input class="bouton" type="number" name="outdiv_height" value=200
  title="Hauteur maximale d'un champ r&eacute;ponse">      
    </td>
  </tr>
  <tr>
    <td>
      Taille maximale de l'assistant matrice
      <input class="bouton" type="number" name="matr_cfg_rows" id="matr_cfg_rows"
      title="Nombre de lignes" value=40 min=1 max=1000>,
      <input class="bouton" type="number" name="matr_cfg_cols" id="matr_cfg_cols"
      title="Nombre de colonnes" value=6 min=1 max=100>
      <input class="bouton" type="checkbox" name="matr_textarea"
      onclick="UI.assistant_matr_textarea=checked; UI.assistant_matr_setmatrix(UI.assistant_matr_maxrows,UI.assistant_matr_maxcols); UI.assistant_matr_setdisplay();"
  id="matr_textarea" title="Cocher pour avoir des cellules dont on peut changer la taille">d&eacute;formable
    </td>
  </tr>
  <tr>
    <td>
      Documentation <input class="bouton" type="checkbox" name="online_doc"
  title="Cocher si Xcas n'est pas install&eacute; (utilise la documentation en ligne)" checked>online
      <input class="bouton" type="text" name="doc_path" size="60"
  value="/usr/share/giac/doc/fr/cascmd_fr/"
  title="Chemin de la documentation hors-ligne (pr&eacute;rempli pour une installation Xcas sous linux, sous mac ajouter /Applications)">
      </td>
    </tr>
  </table>
<input class="bouton" type="button" title="Annule les changements de configuration" value="Annul." onclick="form.style.display='none';  UI.focused.focus();">
  <input class="bouton" type="submit" title="ok" value="OK">
  <hr>
</form>
  
<table>
  <tr>
    <th rowspan=2>
      <button  onclick="if(document.getElementById('apropos').style.display=='none')
      document.getElementById('apropos').style.display='block';
      else document.getElementById('apropos').style.display='none';"
      title="Montre ou cache des informations sur la conception de Xcas dans votre navigateur">
      <img WIDTH="48" HEIGHT="48" SRC="logo.png" alt="Xcas">
      </button>
    </th>
    <td>
      <button class="bouton" onclick="UI.show_config()" title="Permet de modifier la configuration">Config</button>
      <h1>Session</h1>
      <span id="startup_restore" style="display:none">
      pr&eacute;c&eacute;dente
      <button title="Charge la session pr&eacute;c&eacute;dente" class="bouton" onclick="var s=UI.readCookie('xcas_session');UI.restoresession(s,document.getElementById('mathoutput'),false,false);">evalu&eacute;e</button> ou
      <button title="Charge la session pr&eacute;c&eacute;dente sans l'&eacute;valuer" class="bouton" onclick="var s=UI.readCookie('xcas_session');UI.restoresession(s,document.getElementById('mathoutput'),true,false);">non</button>
      </span>
      <span id='thelink'></span>
      <span id='themailto'></span>
    </td>
  </tr>
  <tr>
    <td>
      <span id="history1" style="display:none">
      <button class="bouton" title="Cliquer ici pour sauvegarder l'historique avec le nom de fichier du champ texte qui suit" onclick="if (document.getElementById('loadbutton_file').style.display=='none') UI.savesession(2); else UI.savesession(0);">Sauver</button>
      <textarea cols="10" id="outputfilename" class="filenamecss" style="font-size:large" title="Nom de sauvegarde du fichier. Avec Firefox, pour pouvoir faire plusieurs sauvegardes sous le meme nom, cocher Toujours demander... dans Pr&eacute;f&eacute;rences, G&eacute;n&eacute;ral, T&eacute;l&eacute;chargements.">session</textarea>
      <button id="exportbutton" class="bouton" title="Cliquer ici pour publier la session en HTML avec le nom de fichier du champ texte qui pr&eacute;c&egrave;de" onclick='UI.savesession(1);'>Export</button>
      </span>
      <button id="loadbutton_cookie" class="bouton" title="Cliquer ici pour charger une session sauvegard&eacute;e" onclick="document.getElementById('loadfile_cookie').innerHTML=UI.listCookies();">Charger</button>
      <span id="loadfile_cookie"></span>
      <button id="loadbutton_file" style="height:25px;display:none" title="Cliquer ici pour ajouter &agrave; la session courante le contenu d'une session sauvegard&eacute;e" onclick='document.getElementById("loadfile").reset();document.getElementById("loadfile").style.display="block";'>Charger</button>
      <form id="loadfile" style="display:none">
      <input id="loadfileinput" accept=".xw" type="file"  title="Parcourir" onchange="UI.loadfile(this.files);document.getElementById('loadfile').style.display='none'">
      <input type="text" value="Annul." title="Annuler" onclick="form.style.display='none'">
      <input type="submit" value="OK" style="display:none">
      </form>
    </td>
  </tr>
</table>

<span id="help" style="display:none">

<ul>
  <li style="display:inline">
  <button class="bouton"
  onclick="document.getElementById('help').style.display='none';">
  <em>Fermer</em></button>
</li>
  <li style="display:inline">
  <button class="bouton"
  onclick="var tmp=document.getElementById('tutointro'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
  <strong>Introduction</strong></button>
  
  <div id="tutointro">
    Tapez votre calcul dans la ligne de commande en bas de la page
    (attention, tapez <tt>1.2</tt> pour 1 virgule 2).
Vous pouvez utiliser le clavier scientifique 
(bouton <tt>123</tt> au-dessus de la ligne de commande)
    et les assistants du bouton <tt>menu</tt>.
Validez avec Entr&eacute;e ou le bouton <tt>ok</tt> en vert.
<br>
Pour obtenir de l'aide, tapez un nom de commande puis le
bouton <tt>?</tt>.
Pour trouver une commande, cliquez sur un des th&egrave;mes
ci-dessous, ou consultez le
<a
href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/fr/cascmd_fr">guide des
commandes de Xcas</a>
  </div>
  </li>
  <li style="display:inline">
<button class="bouton"
onclick="var tmp=document.getElementById('tutointerface'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
<strong>Interface</strong></button>

<div id="tutointerface" style="display:none">

Cette feuille de calcul est compos&eacute;e du haut vers le bas de:
<ul>
  <li> un logo Xcas et un panel de boutons permettant de restaurer/sauvegarder
  une session et de g&eacute;rer l'historique, la corbeille et les
  variables. Au lancement de Xcas, le panel est
  r&eacute;duit &agrave; insertion d'une session, consultation des
  manuels, configuration et restauration de la session
  pr&eacute;c&eacute;dente.
  D&egrave;s que vous avez valid&eacute; une commande, il apparait
  <ul>
    <li> un lien Clone
    qui permet de <strong>cloner</strong> une session existante.
    A utiliser si le noyau de calcul formel a crash&eacute; ou
    pour copier-coller dans une page web, ou pour ex&eacute;cuter
    dans Xcas natif.
    <li> un lien E-mail qui permet de <strong>partager
    votre session</strong> par e-mail.
    </li>
  </ul>
</li>
  <li> une zone d'<strong>aide</strong>, qui contient des courtes description des
  commandes dont vous avez demand&eacute; la syntaxe.
  </li>
  <li> un <strong>historique</strong> (vide au d&eacute;but).
  Les lignes de commande y apparaissent en noir, les r&eacute;sultats en
  bleu, les boutons ↑ et ↓ permettent de d&eacute;placer un niveau
  dans l'historique, le bouton bleu ~ permet d'avoir une valeur
  num&eacute;rique du r&eacute;sultat. Vous pouvez modifier une ligne
  de commande de l'historique et valider en cliquant sur le bouton ok
  ou la touche Entree. Vous
  pouvez placer un niveau dans la corbeille avec le bouton
  d'effacement &agrave; droite du niveau (pour le restaurer,
  cliquer sur le bouton Restaure, pour l'effacer
  d&eacute;finitivement cliquer sur le bouton Vide). 
  </li>
  <li> une <strong>ligne de commande</strong>, on y tape des commandes
  ou des programmes Xcas, et on
  valide en cliquant sur le bouton ok ou en tapant Entree. Pour passer
  &agrave; la ligne dans un programme, tapez Shift-Entree au clavier
  ou utilisez le bouton <tt>\n</tt> du clavier scientifique.
  <br>
  Par exemple, tapez un calcul simple comme <tt>1/2+1/3</tt>
  ou <tt>sin(pi/4)</tt> ou <tt>sin(pi/4.0)</tt>.
  <br>
  Pour vous aider &agrave; remplir la ligne de commande,
  vous pouvez cliquer sur le bouton 123 qui fait apparaitre
  le <strong>clavier scientifique</strong> et sur le bouton menu
  qui contient des commandes
  fr&eacute;quemment utili&eacute;es et des assistants
  (d&eacute;placez la souris pr&egrave;s des boutons pour
  une description de leur action).
  <br>
  Si vous connaissez le nom d'une commande,
  vous pouvez taper (le d&eacute;but) du nom d'une commande
  (par exemple <tt>factor</tt>) puis
  la touche <button class="bouton">F1</button> ou <button class="bouton">Tab</button>
  ou cliquer sur le bouton <button class="bouton">?</button>
  pour obtenir une
  <strong>aide courte</strong> sur la commande (si elle
  est compl&egrave;te) ou des suggestions de noms de
  commande (sinon).
  <br>
  Par exemple, cliquer sur le bouton <tt>menu</tt> puis sur le bouton
  <tt>factor</tt> puis tapez sur <tt>?</tt>, observez l'aide
  en haut, cliquez sur un des exemples ou completez avec
  x^4-1 puis tapez Entree.
 <br>
  Sur mobile, vous pouvez
  <strong>s&eacute;lectionner</strong> du texte en laissant le doigt appuy&eacute;
  sur un mot, puis taper sur l'icone avec des ciseaux (pour couper) ou
  avec deux feuilles (pour copier), pour coller le presse-papier,
  laisser le doigt appuy&eacute; puis taper sur l'icone avec une
  feuille. Vous pouvez aussi appuyer sur les boutons <tt>beg</tt>
  et <tt>end</tt> pour marquer le d&eacute;but et la fin de la
  s&eacute;lection, puis optionnellement sur <tt>del</tt> pour
  effacer, puis sur <tt>cp</tt> pour coller ce que vous aviez
  s&eacute;lectionn&eacute;.  <br>
    Vous pouvez entrer un <strong>commentaire</strong> en tapant une ligne de commande
  commencant par <tt>//</tt> (vous pouvez utiliser des commandes de
  balisage HTML dans un commentaire).
  </li>
  <li>
  une <strong>console</strong> qui affiche des messages du CAS :
  erreurs de syntaxe mais aussi lors
  d'un calcul en mode pas-&agrave;-pas, par exemple d'une
  d&eacute;riv&eacute;e.
  La console n'est pas visible si elle est vide.
  Vous pouvez effacer la console ou ajuster sa taille verticale.
  </li>
  <li>
  une zone affichant des <strong>graphes 3d</strong>
  lorsqu'on ex&eacute;cute une commande
  ayant une sortie graphique 3d. Cette zone n'est pas visible s'il n'y
  a pas de graphique 3d.
  </li>
</ul>
A tout moment, vous pouvez <strong>sauvegarder</strong> l'historique,
avec le nom de session affich&eacute; &agrave; droite du bouton
<tt>Sauve</tt>
(par d&eacute;faut <tt>session</tt>).
Une session sauvegard&eacute;e
s'ouvre ensuite avec le bouton Charger.
Les sauvegardes sont faite dans les cookies du
navigateur avec un nom de cookie commencant par <tt>xcas__</tt>, vous
pouvez les effacer depuis la gestion de la Vie priv&eacute;e de votre
navigateur (attention, la sauvegarde ne fonctionne pas en utilisation locale avec
Chrome sauf si Chrome est lanc&eacute; avec l'option <tt>--enable-file-cookies</tt>).
Vous pouvez aussi <strong>exporter</strong> la feuille de calcul (sauf
sur smartphone), l'export occupe plus de place mais
  permet de publier le fichier HTML comme une page autonome.
  Vous pouvez sauvegarder les graphes 2d au format SVG avec le bouton
  save &agrave; droite du graphe. Le fichier SVG cr&eacute;&eacute;
  est au format 1.2 (il utilise la balise
  <tt>vector-effect="non-scaling-stroke"</tt> qui n'est pas compris
  par tous les visualisateurs ou convertisseurs).
  <br>
  Sous Firefox, pour pouvoir
  choisir l'emplacement de sauvegarde et &eacute;craser
  une version ant&eacute;rieure : cocher Toujours demander...
  dans Pr&eacute;f&eacute;rences,
  G&eacute;n&eacute;ral, T&eacute;l&eacute;chargements.
<br>
  Vous pouvez ouvrir (partiellement) une session existante Xcas en la clonant
  (menu Fich, Clone du programme Xcas, ou en ligne de commande
<tt>xcas --online nom_fichier.xws</tt>)
<br>
Notez que Chrome (et plus g&eacute;n&eacute;ralement
le navigateur install&eacute; par d&eacute;faut sur votre appareil)
est beaucoup plus lent que Firefox pour
faire les calculs (5 fois plus lent environ), en particulier le
premier calcul dure une bonne dizaine de secondes. De plus, Chrome
n'a pas de support natif pour afficher les formules en 2d en mathml,
il faut alors charger MathJax ce qui n&eacute;cessite
un acc&egrave;s r&eacute;seau.
<br>
<strong>Il est donc recommend&eacute; de t&eacute;l&eacute;charger
Firefox et d'ex&eacute;cuter Xcas depuis Firefox</strong>
<br>
<strong>Remarque</strong> :
  Vous pouvez revenir travailler sur cette page meme si vous n'avez pas de
r&eacute;seau disponible, car les ressources n&eacute;cessaires sont
automatiquement plac&eacute;ees dans le cache de votre navigateur.
Vous pouvez optionnellement
  <strong>installer</strong> Xcas sur votre appareil,
  d&eacute;zippez
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/xcashtml.zip">
  xcashtml.zip</a> et
  cherchez <tt>xcasfr.html</tt>, depuis <a
  href="file:///sdcard/">ici</a> (Android).
<br>
<button class="bouton"
onclick="document.getElementById('tutointerface').style.display='none';">Masquer
l'aide sur l'interface</button>
</div>
  </li>
  <li  style="display:inline"> 
  <button class="bouton"
onclick="var tmp=document.getElementById('tutosimplifier'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
  <strong>Simplifier</strong></button>
  <span id="tutosimplifier" style="display:none">
  Il n'existe pas de mani&egrave;re universelle de simplifier une
  expression, parfois il vaut mieux d&eacute;velopper, parfois factoriser,
  parfois lin&eacute;ariser, etc., il est donc important de connaitre
  quelques commandes de r&eacute;&eacute;criture.
  <ul>
    <li>
  L'appui sur le bouton <tt>menu</tt> puis <tt>simpl</tt>
    ins&egrave;re
    la commande
  <button class="bouton"
    onclick="UI.insert(UI.focused,'simplify(')">simplify</button>,
   tapez ensuite
    l'expression que
    vous voulez d&eacute;velopper et simplifier.<br>
    <button class="bouton"
    onclick="UI.insert(UI.focused,'normal(')">normal</button>,
    <button class="bouton" onclick="UI.insert(UI.focused,'reorder(')">reorder</button>, 
    <button class="bouton"
    onclick="UI.insert(UI.focused,'ratnormal(')">ratnormal</button>
    sont des versions moins puissantes mais plus rapides que simplify
    (normal ne recherche pas de relations entre fonctions
    trigonom&eacute;triques et exponentielles, ratnormal n'effectue
    que des simplifications rationnelles, reorder r&eacute;ordonne
    selon une liste de variables).
</li>    
<li>
<button class="bouton" onclick="UI.insert(UI.focused,'factor(')">factor</button>
   factorise sur R,
<button class="bouton" 
    onclick="UI.insert(UI.focused,'cfactor(')">cfactor</button>
    sur C
    </li>
    <li>
    <button class="bouton" onclick="UI.insert(UI.focused,'partfrac(')">partfrac</button>
    d&eacute;compose en &eacute;l&eacute;ments simples sur R,
    <button class="bouton" 
    onclick="UI.insert(UI.focused,'cpartfrac(')">cpartfrac</button>
    sur C.
    </li>
    <li>
<button class="bouton"
    onclick="UI.insert(UI.focused,'texpand(')">texpand</button>
    d&eacute;veloppe les expressions trigonom&eacute;triques,
    exponentielles et logarithmes,
<button class="bouton"
    onclick="UI.insert(UI.focused,'lin(')">lin</button>
    lin&eacute;rise les exponentielles,
<button class="bouton" onclick="UI.insert(UI.focused,'tlin(')">tlin</button>    
    lin&eacute;rise les expressions trigonom&eacute;triques.
    </li>
    <li> <button class="bouton"
    onclick="UI.insert(UI.focused,'subst(')">subst</button>
    permet de substituer une ou des variables par une ou des valeurs
    </li>
    <li> Conversions trigo: <button class="bouton"
    onclick="UI.insert(UI.focused,'trigcos(')">trigcos</button>,
    <button class="bouton"
    onclick="UI.insert(UI.focused,'trigsin(')">trigsin</button>,
    <button class="bouton"
    onclick="UI.insert(UI.focused,'trigtan(')">trigtan</button>,
    <button class="bouton"
    onclick="UI.insert(UI.focused,'halftan(')">halftan</button>,
    <button class="bouton"
    onclick="UI.insert(UI.focused,'tan2sincos(')">tan2sincos</button>
    </li>
    <li> Autres: <button class="bouton"
    onclick="UI.insert(UI.focused,'trig2exp(')">trig2exp</button>,
    <button class="bouton" onclick="UI.insert(UI.focused,'exp2trig(')">exp2trig</button>
    <button class="bouton"
    onclick="UI.insert(UI.focused,'pow2exp(')">pow2exp</button>,
    <button class="bouton" onclick="UI.insert(UI.focused,'exp2pow(')">exp2pow</button>
    <button class="bouton"
    onclick="UI.insert(UI.focused,'lncollect(')">lncollect</button>
<button class="bouton" onclick="UI.insert(UI.focused,'lnexpand(')">lnexpand</button>    
    </li>
  </ul>
  </span>
</li>
  <li  style="display:inline">
    <button class="bouton"
onclick="var tmp=document.getElementById('tutolinalg'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
  <strong>Alg&egrave;bre lin&eacute;aire </strong>
  </button>
<span id="tutolinalg" style="display:none">
<ul>
  <li>  Pour cr&eacute;er un vecteur, tapez ses coordonn&eacute;es
  s&eacute;par&eacute;es par des virgules entre 2 crochets [].
  <button class="bouton"
  onclick="UI.insert(UI.focused,'dot(')">dot</button> produit
  scalaire de deux vecteurs,   <button class="bouton"
  onclick="UI.insert(UI.focused,'cross(')">cross</button> produit
  vectoriel en dimension 2 ou 3.
  </li>
  <li>
  Pour cr&eacute;er une matrice, utiliser l'assistant <tt>matrix</tt>
  du <tt>menu</tt>. Vous pouvez d&eacute;finir les coefficients par
  une formule en fonction de la ligne et de la colonne ou
  &eacute;l&eacute;ment par &eacute;l&eacute;ment
  (vous pouvez entrer plusieurs coefficients en les s&eacute;parant par
  un espace et passer &agrave; la ligne suivante avec Entree).
  </li>
  <li>
  <button class="bouton" onclick="UI.insert(UI.focused,'A[0,1]')">A[0,1]</button>
  &eacute;l&eacute;ment de A ligne 0 colonne 1,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'tran(')">tran</button>
  transpos&eacute;e,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'idn(')">idn</button> identit&eacute;
  </li>
  <li>
  Utiliser <tt>+,-,*</tt> et    <button class="bouton"
  onclick="UI.insert(UI.focused,'matpow(')">matpow</button> pour
  les op&eacute;rations usuelles sur les matrices.
  </li>
  <li> 
  <button class="bouton" onclick="UI.insert(UI.focused,'linsolve(')">linsolve</button>
  syst&egrave;me lin&eacute;aire,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'rref(')">rref</button> :
  pivot de Gauss,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'p,l,u:=lu(')">det</button>
  : d&eacute;terminant,
  <button class="bouton" onclick="UI.insert(UI.focused,'inv(')">inv</button>
  : inverse,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'p,l,u:=lu(')">lu</button>
  : d&eacute;composition LU et application &agrave;
  <button class="bouton"
  onclick="UI.insert(UI.focused,'linsolve(p,l,u,')">linsolve</button>,
  </li>
  <li> 
  <button class="bouton"
  onclick="UI.insert(UI.focused,'charpoly(')">charpoly(</button>
  polynome caract&eacute;ristique ou
  <button class="bouton"
  onclick="UI.insert(UI.focused,'pmin(')">pmin(</button>
  minimal,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'p,d:=jordan(')">p,d:=jordan(</button>
  vecteurs et valeurs propres.
  </li>
  <li>
  Factorisations
  <button class="bouton"
  onclick="UI.insert(UI.focused,'lu(')">lu</button>,
  <button class="bouton" onclick="UI.insert(UI.focused,'cholesky(')">cholesky</button>,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'qr(')">qr</button>,
  <button class="bouton" onclick="UI.insert(UI.focused,'svd(')">svd</button>
  </li>
  <li> Normes
  <button class="bouton"
  onclick="UI.insert(UI.focused,'l1norm(')">l1norm</button>,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'l2norm(')">l2norm</button>,
  <button class="bouton"
  onclick="UI.insert(UI.focused,'maxnorm(')">maxnorm</button> :  
  <button class="bouton"
  onclick="UI.insert(UI.focused,'matrix_norm(')">matrix_norm</button>
  de matrice subordonn&eacute;e  
  </li>
</ul>
<li  style="display:inline">
  <button class="bouton"
onclick="var tmp=document.getElementById('tutoarit'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
<strong>Arithm&eacute;tique</strong>
</button>
<span id="tutoarit" style="display:none">
Lorsqu'un doute est possible,
les commandes agissant sur les entiers ont comme initiale <tt>i</tt>
pour les distinguer des commandes agissant sur les
polynomes.
<ul>
  <li>
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'irem(')">irem</button>,
   <button class="bouton" 
  onclick="UI.insert(UI.focused,'iquo(')">iquo</button>,
 <button class="bouton" 
    onclick="UI.insert(UI.focused,'iquorem(')">iquorem</button>:
  reste et quotient de la division euclidienne sur les entiers
  </li>
  <li>
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'gcd(')">gcd</button> PGCD,
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'iegcd(')">iegcd</button> identit&eacute;
  de B&eacute;zout sur les entiers,
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'iabcuv(')">iabcuv</button> solutions
  de au+bv=c,
  </li>
  <li>
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'isprime(')">isprime</button> test de primalit&egrave;,
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'ifactor(')">ifactor</button>
  factorisation d'entier, indicatrice d'<button class="bouton" 
  onclick="UI.insert(UI.focused,'euler(')">euler</button>
  </li>
  <li>
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'rem(')">rem</button>,
   <button class="bouton" 
  onclick="UI.insert(UI.focused,'quo(')">quo</button>,
 <button class="bouton" 
    onclick="UI.insert(UI.focused,'quorem(')">quorem</button>:
  reste et quotient de la division euclidienne sur les polynomes. La
  variable par d&eacute;faut est <tt>x</tt>, sinon l'indiquer en
  3&egrave;me argument.
  </li>
  <li>
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'gcd(')">gcd</button> PGCD,
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'egcd(')">egcd</button> identit&eacute;
  de B&eacute;zout sur les polynomes,
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'abcuv(')">abcuv</button> solutions
  de au+bv=c,
  </li>
  <li> Pour travailler dans ℤ/nℤ, utiliser le signe <tt>%</tt>, par
  exemple <tt>x^3+5x-11 % 17</tt> est un polynome a coefficients dans ℤ/17ℤ.
  </li>
  <li> Pour travailler sur un corps fini non premier, utiliser la
  commande
  <button class="bouton" 
  onclick="UI.insert(UI.focused,'GF(')">GF</button>
  </li>
</ul>
</span>
</li>
<li  style="display:inline">
  <button class="bouton"
onclick="var tmp=document.getElementById('tutosolve'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
<strong>R&eacute;soudre</strong>
</button>
<span id="tutosolve" style="display:none">
Depuis le bouton <tt>menu</tt>
<ul>
  <li> l'assistant <tt>solve</tt>
  vous guidera pour r&eacute;soudre une &eacute;quation ou un
  syst&egrave;me
  polynomial en mode exact ou approch&eacute; sur les r&eacute;els ou
les complexes (fonctions
<button class="bouton" 
onclick="UI.insert(UI.focused,'solve(')">solve</button>
<button class="bouton" 
onclick="UI.insert(UI.focused,'csolve(')">csolve</button>
<button class="bouton" 
onclick="UI.insert(UI.focused,'fsolve(')">fsolve</button>
<button class="bouton" 
  onclick="UI.insert(UI.focused,'cfsolve(')">cfsolve</button>)
  </li>
  <li>
  Pour r&eacute;soudre une &eacute;quation diff&eacute;rentielle,
cliquez sur <tt>deslv</tt>
(exact <button class="bouton" 
onclick="UI.insert(UI.focused,'desolve(')">desolve</button>,
num&eacute;rique <button class="bouton" 
onclick="UI.insert(UI.focused,'odesolve(')">odesolve</button>, voir
  aussi la section graphes).
  </li>
  <li>
Pour une ou des suites r&eacute;currentes cliquez sur <tt>rslv</tt> (commande
<button class="bouton" 
  onclick="UI.insert(UI.focused,'rsolve(')">rsolve</button>).
  </li>
  </ul>
</span>
  </li>
  <li  style="display:inline">
    <button class="bouton"
onclick="var tmp=document.getElementById('tutoanalyse'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
  <strong>Analyse</strong>
  </button>
  <span id="tutoanalyse" style="display:none">
  Le <tt>menu</tt> contient des assistants pour
  d&eacute;finir une fonction (bouton <tt>fonct</tt>),
  d&eacute;terminer le tableau de variations d'une expression
  (<tt>f(x)</tt>),
  travailler avec des suites (<tt>u_n</tt>),
  calculer une somme (<tt></tt>), des limites (<tt>limit</tt>),
  des d&eacute;riv&eacute;es (<tt></tt>),
  des primitives et valeurs d'int&eacute;grales (<tt></tt>),
  des d&eacute;veloppement limit&eacute;s  (<tt>series</tt>).  
  <br>
  Par exemple pour d&eacute;finir une fonction alg&eacute;brique
  <tt>f</tt> d'une variable, cliquer sur
  <tt>fonct</tt> du <tt>menu</tt> puis
  mettre <tt>f</tt> comme nom de fonction,
  <tt>x</tt> comme liste des arguments et <tt>sin(x^2)</tt> comme
  valeur renvoy&eacute;ee :
  <button class="bouton"
  onclick="UI.insert(UI.focused,'f(x):=sin(x^2):;')"><tt>f(x):=sin(x^2)</tt></button>.
  On peut ensuite calcule la valeur
  de <tt>f</tt> ou de sa d&eacute;riv&eacute;e par
   <button class="bouton" 
  onclick="UI.insert(UI.focused,'f(sqrt(pi)); f'(2);f'(y);')">
  <tt>f(sqrt(pi)); f'(2); f'(y) </tt></button>.
  <br>
  Une d&eacute;riv&eacute;e se calcule avec
  <button class="bouton"
  onclick="UI.insert(UI.focused,'diff(')">diff</button> ou <tt>'</tt>.
  Une primitive d'une
  expression se calcule avec <button class="bouton"
  onclick="UI.insert(UI.focused,'int(')">int</button>, par
  exemple <button class="bouton"
  onclick="UI.insert(UI.focused,'int(1/(x^4-1))')">int(1/(x^4-1));</button>,
  pour une int&eacute;grale entre deux bornes
  <button class="bouton"
  onclick="UI.insert(UI.focused,'int(1/(x^4+1),x,0,+infinity)')">
  int(1/(x^4+1)^4,x,0,+infinity);</button>.
  <br>
  Enfin  <button class="bouton"
  onclick="UI.insert(UI.focused,'limit(')">limit</button> et
   <button class="bouton"
  onclick="UI.insert(UI.focused,'series(')">series</button>
  permettent de calculer une limite ou un d&eacute;veloppement de
  Taylor, par exemple
  <button class="bouton"
  onclick="UI.insert(UI.focused,'limit(sin(x)/x,x=0); series(sin(x),x=0,5,polynom)')">
  limit(sin(x)/x,x=0); series(sin(x),x=0,5,polynom);</button>
  </span>
  </li>
  <li  style="display:inline">
  <button class="bouton"
onclick="var tmp=document.getElementById('tutoproba'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
  <strong>Probabilit&eacute;s </strong></button>
  <span id="tutoproba" style="display:none">
  Utiliser l'assistant <tt>rand</tt> du <tt>menu</tt> pour
  g&eacute;n&eacute;rer des nombres pseudo-al&eacute;atoires.
  <br>
  Lois continues:
   <button class="bouton"
  onclick="UI.insert(UI.focused,'uniformd(')">uniformd</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'normald(')">normald</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'studentd(')">studentd</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'chisquared(')">chisquared</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'gammad(')">gammad</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'exponentiald(')">exponentiald</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'cauchyd(')">cauchyd</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'fisherd(')">fisherd</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'betad(')">betad</button>.
  <br>
  Lois discr&egrave;tes :
   <button class="bouton"
  onclick="UI.insert(UI.focused,'binomial(')">binomial</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'negbinomial(')">negbinomial</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'geometric(')">geometric</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'poisson(')">poisson</button>.
  <br>
  Les distributions cumul&eacute;es s'obtiennent en rajoutant le
  suffixe <tt>_cdf</tt> ou par la commande  <button class="bouton"
  onclick="UI.insert(UI.focused,'cdf(')">cdf</button>, et les
  inverses avec le suffixe  <tt>_icdf</tt> ou par la commande  <button class="bouton"
  onclick="UI.insert(UI.focused,'icdf(')">icdf</button>.
  <br>
  La commande    <button class="bouton"
  onclick="UI.insert(UI.focused,'histogram(')">histogram</button>
  permet de repr&eacute;senter un histogramme.
  <br>
  La commande    <button class="bouton"
  onclick="UI.insert(UI.focused,'markov(')">markov</button> permet
  de d&eacute;composer une matrice de transition.
  </span>
  </li>
  <li  style="display:inline">
    <button class="bouton"
onclick="var tmp=document.getElementById('tutograph'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
  <strong>Graphes </strong>
  </button>
  <span id="tutograph" style="display:none">
  Utiliser les assistants du <tt>menu</tt> pour
  cr&eacute;er un graphe d'une fonction d'une ou deux variables
  (<tt>plot</tt>, voir aussi <tt>f(x)</tt> pour avoir un tableau
  de variations),
  une courbe ou surface param&eacute;trique (<tt>param</tt>), un champ de tangentes
  pour une &eacute;quation diff&eacute;rentielle (<tt>field</tt>).
  <br>
  Exemples
  <button class="bouton"
  onclick="UI.insert(UI.focused,'plot([sin(x),x-x^3/3!],x=-3..3,color=[red,blue])')">
  <tt>plot([sin(x),x-x^3/3!],x=-3..3,color=[red,blue])</tt>
  </button> affiche
  le graphe 2d des fonctions sin(x) et x-x^3/6, alors que
  <button class="bouton"
  onclick="UI.insert(UI.focused,'plotfunc(x^2-y^2,[x=-2..2,y=-2..2]);plan(z=0,color=cyan+filled);')">
  <tt>plotfunc(x^2-y^2,[x=-2..2,y=-2..2]);plan(z=0,color=cyan+filled);</tt>
  </button>
  affiche un graphe 3d avec un plan, vous pouvez changer de point de
  vue &agrave; la souris.
  <br>
  Vous pouvez aussi utiliser de nombreuses instructions
  g&eacute;om&eacute;triques:
   <button class="bouton"
  onclick="UI.insert(UI.focused,'point(')">point</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'milieu(')">milieu</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'droite(')">droite</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'bissectrice(')">bissectrice</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'mediatrice(')">mediatrice</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'segment(')">segment</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'triangle(')">triangle</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'cercle(')">cercle</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'ellipse(')">ellipse</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'hyperbole(')">hyperbole</button>,
   <button class="bouton"
  onclick="UI.insert(UI.focused,'parabole(')">parabole</button>, ...
  </span>
  </li>
  <li  style="display:inline">
    <button class="bouton"
onclick="var tmp=document.getElementById('tutoprog'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
  <strong>Programmes</strong>
  </button>
  <span id="tutoprog" style="display:none">
  Cliquez sur le bouton <tt>prg</tt> juste au-dessus
  de la ligne de commande, ceci affiche des assistants 
   pour cr&eacute;er les structures de programmation
  (test, boucle, fonction). Pour passer &agrave; la ligne,
  tapez simultan&eacute;ment sur Shift-Entree ou utilisez le
  bouton <tt>\n</tt> du clavier scientifique <tt>123</tt> ou du
  <tt>prg</tt>.
  <br>
  Plusieurs syntaxes sont accept&eacute;es,
  dont une syntaxe en francais tr&egrave;s proche du langage
  algorithmique, on renvoie vers ce
  <a href="algoseconde.html"target="_blank">manuel de programmation</a> pour un
  tutoriel d'apprentissage du langage.
  <br>
  Par exemple voici un programme calculant
  la somme des carr&eacute;s de 1 &agrave; x
  <br>
  <tt>fonction f(x)
  <br>
  &nbsp;&nbsp;local y,s;
  <br>
  &nbsp;&nbsp;si x &gt; 100000 alors retourne "Nombre trop grand"; fsi;
  <br>
  &nbsp;&nbsp;s:=0; 
  <br>
  &nbsp;&nbsp;pour y de 1 jusque x faire 
  <br>
  &nbsp;&nbsp;&nbsp;&nbsp;s:=s+y^2;
  <br>
  &nbsp;&nbsp;fpour
  <br>
  &nbsp;&nbsp;retourne s;
  <br>
  ffonction:;
  </tt>
  <button class="bouton" onclick="UI.insert(UI.focused,'fonction f(x)\n  local y,s;\n  si x &gt; 100 alors retourne &quot;Nombre trop grand&quot; fsi;\n  s:=0;\n  pour y de 1 jusque x faire\n    s:=s+y^2;\n  fpour\n  retourne s;\nffonction:; ')">Tester</button>
  <br>
  La commande <button class="bouton"  onmousedown="event.preventDefault()"
  onclick="UI.insert(UI.focused,'debug(')"><tt>debug</tt></button>
  permet d'ex&eacute;cuter une fonction en mode pas &agrave; pas
  pour la mettre au point.
  <ul>
    <li> Listes:
    <button class="bouton" onclick="UI.insert(UI.focused,'seq(');">seq</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'append(');">append</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'concat(');">concat</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'head(');">head</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'tail(');">tail</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'makelist(');">makelist</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'member(');">member</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'revlist(');">revlist</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'mid(');">mid</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'size(');">size</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'sort(');">sort</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'suppress(');">suppress</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'select(');">select</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'count(');">count</button>
    </li>
    <li> Ensembles:
    <button class="bouton" onclick="UI.insert(UI.focused,'intersect(');">intersect</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'minus(');">minus</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'union(');">union</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'est_element(');">est_element</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'est_inclus(');">est_inclus</button>    
    </li>
    <li> Chaines:
    <button class="bouton" onclick="UI.insert(UI.focused,'asc(');">asc</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'char(');">char</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'inString(');">inString</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'gauche(');">gauche</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'ord(');">ord</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'droit(');">droit</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'string(');">string</button>
    </li>
  </ul>
  </span>
  </li>
  <li  style="display:inline">
    <button class="bouton"
onclick="var l=['tutointro','tutointerface','tutosimplifier','tutoarit','tutosolve','tutoanalyse','tutoproba','tutoprog','tutograph','tutolinalg']; var s=l.length; for (var i=0;i<s;++i) document.getElementById(l[i]).style.display='none';">
  <em>Replier tout</em>
  </button>
</ul>
</span>

<span id="manuels" style="display:none">
  <string>Manuels de Xcas</strong> <button
  onclick="document.getElementById('manuels').style.display='none';">Masquer</button>
  <ul>
    <li> Algorithmes de calcul formel et num&eacute;rique:
  PDF <a href="file:///usr/share/giac/doc/fr/algo.pdf"
    target="_blank">disque dur</a>,
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/fr/algo.pdf"
  target="_blank">Internet</a>,
  HTML <a href="file:///usr/share/giac/doc/fr/algo.html"
    target="_blank">disque dur</a>,
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/fr/algo.html"
  target="_blank">Internet</a>,
    </li>
    <li> Programmation :
    <a href="algoseconde.html"target="_blank">algorithmique lyc&eacute;e</a>,
    <a href="file:///usr/share/giac/doc/fr/casrouge/index.html"
    target="_blank">disque dur</a>,
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/fr/casrouge/index.html"
  target="_blank">Internet</a>,
    </li>
    <li> G&eacute;om&eacute;trie :
  <a href="file:///usr/share/giac/doc/fr/casgeo/index.html"
    target="_blank">disque dur</a>,
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/fr/casgeo/index.html"
  target="_blank">Internet</a>,
    </li>
    <li> Simulation :
  <a href="file:///usr/share/giac/doc/fr/cassim/index.html"
    target="_blank">disque dur</a>,
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/fr/cassim/index.html"
  target="_blank">Internet</a>,
    </li>
    <li> Exercices :
  <a href="file:///usr/share/giac/doc/fr/casexo/index.html"
    target="_blank">disque dur</a>,
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/fr/casexo/index.html"
  target="_blank">Internet</a>,
    </li>
    <li> Amusement :
  <a href="file:///usr/share/giac/doc/fr/cascas/index.html"
    target="_blank">disque dur</a>,
  <a href="http://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/fr/cascas/index.html"
  target="_blank">Internet</a>,
    </li>
  </ul>
  </span>
  
<div>
<button class="bouton" 
  onclick="if(document.getElementById('help').style.display=='none')
  document.getElementById('help').style.display='block';
  else document.getElementById('help').style.display='none';"
title="Montrer ou cacher le tutoriel"><strong>Tutoriel</strong></button>
<button class="bouton" 
  onclick="document.getElementById('manuels').style.display='block';"
  title="Montrer ou cacher la liste des manuels">Docs</button>
  <button class="bouton" style="width:40px;vertical-align:bottom"
  title="Lance la recherche de l'aide courte" onclick="UI.addhelp('?',document.getElementById('helptxt').value)">?</button>
  <textarea cols="11" class="bouton" style="font-size:large;vertical-align:bottom" id="helptxt"
  title="Aide courte sur un nom de commande" rows=1 onclick="UI.focused=this;" onkeypress="if (event.keyCode!=13) return true;UI.addhelp('?',value); return false;"></textarea>
  <button class="bouton" style="vertical-align:bottom"
  title="Efface l'aide" onclick="helpoutput.innerHTML='';document.getElementById('helptxt').value='';document.getElementById('helptxt').focus();">Del</button>
</div>

<div id="divhelpoutput" style="max-height: 200px; overflow:auto">
<table id="helpoutput" title="Aide"
  style="max-width:1000px "></table>
</div>
<hr>
<div id="history4" style="display:none">
  <button class="bouton" onclick="var tmp=document.getElementById('variables'); if(tmp.style.display=='inline') tmp.style.display='none'; else tmp.style.display='inline';"><strong>Variables</strong></button>
  <span id="variables" style="display:none">
  <button class="bouton"  name="add_purge"
  onmousedown="event.preventDefault()"
  onClick="UI.insert(UI.focused,'purge(')" title="Efface le contenu d'une ou plusieurs variables, par exemple purge(a) ou purge(a,b,c)">purge</button>
  <button class="bouton" onclick="UI.addhelp(' ','VARS(1)')" title="Commande pour afficher la liste des variables">Liste</button>
  <button class="bouton" onclick="UI.addhelp(' ','rm_all_vars(1)')"
  title="Effacer le contenu de toutes les variables">Efface</button>
  <br>
  </span>
  <span id="historique">
  <button class="bouton" onclick="UI.exec(document.getElementById('mathoutput'),0)"
  title="Executer toutes les commandes de l'historique">Exec</button>
  <button class="bouton" id="button_show_answers" onclick="UI.show_answers(true)" title="Montrer les r&eacute;ponses">+</button>
  <button class="bouton" id="button_hide_answers" onclick="UI.show_answers(false)" title="Cacher les r&eacute;ponses">-</button>
  <button class="bouton" onclick="UI.erase_all(document.getElementById('mathoutput'))"
title="Placer tout les niveaux de l'historique dans la
  corbeille">→Corbeille</button>
  <button class="bouton" onclick="UI.restoretrash()" class="bouton" title="Restaurer les niveaux plac&eacute;s dans la corbeille">Restaure</button>
  <button class="bouton" onclick="UI.emptytrash()" class="bouton" title="Vider la corbeille">Vide</button>
  </span>
</div>

<div id="divoutput" style="max-height: 400px; overflow:auto">
<table id="mathoutput" contextmenu="cmdmenu" title="Historique"
  style="max-width:1000px "></table>
</div>


<table border="0" align="center" summary="" id="keyboard"
  style="display:none" onmousedown="event.preventDefault()" >
  <tr>
    <td> 
      <input type="button" style="width:29px;height:35px;"
  name="add_newline" id="add_newline" value=" "
  onmousedown="event.preventDefault()"  onClick="if (UI.kbdshift) UI.insert(UI.focused,' \n') ; else UI.insert(UI.focused,' ');">  
      <input type="button" style="width:29px;height:35px;" name="add_sin" id="add_sin"  value="sin" onmousedown="event.preventDefault()"  onClick="UI.insert(UI.focused,value+'(')" title="fonction sinus, taper asin pour arcinus">        
      <input type="button" style="width:29px;height:35px;" name="add_cos"
id="add_cos"
  value="cos" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value+'(')" title="fonction cosinus, taper acos pour arccosinus">        
      <input type="button" style="width:29px;height:35px;" name="add_tan"
id="add_tan"
  value="tan" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value+'(')" title="fonction tangente, taper atan pour arctangente">        
      <input type="button" style="width:29px;height:35px;" name="add_ln"
id="add_ln"
  value="ln" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value+'(')" title="logarithme neperien et exponentielle.">        
      <input type="button" style="width:29px;height:35px;" name="add_^" id="add_^" value="^"  onmousedown="event.preventDefault()" onClick ="UI.insert(UI.focused,'^')">  
      <input type="button" style="width:29px;height:35px;" name="add_7" id="add_7" value="7" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'7')">  
      <input type="button" style="width:29px;height:35px;" name="add_8" id="add_8" value="8" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'8')">  
      <input type="button" style="width:29px;height:35px;" name="add_9" id="add_9" value="9" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'9')">  
      <input type="button" style="width:29px;height:35px;" name="add_/"
id="add_/"
  value="/" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)" title="Division. // pour faire un commentaire, % pour travailler dans Z/nZ.">  
    </td>
  </tr>
  <tr>
    <td>
      <input type="button" style="width:29px;height:35px;"
  name="add_left_[" id="add_left_[" value="[ ]" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value);UI.moveCaret(UI.focused,-2);"
  title="[ servent de d&eacute;limiteurs pour les vecteurs, listes et matrices, par exemple [1,2,3] ou [[1,2],[3,4]]. { } servent de d&eacute;limiteur pour les programmes.">  
      <input type="button" style="width:29px;height:35px;" name="add_left_paren" id="add_left_paren" value="(" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'(');">  
      <input type="button" style="width:29px;height:35px;" id="add_right_paren"
      value=")" onmousedown="event.preventDefault()"
  onClick="UI.insert(UI.focused,')')" title="Parenth&egrave;se">
      <input type="button" style="width:29px;height:35px;" name="add_pi" id="add_pi" value="π,∞" onmousedown="event.preventDefault()" onClick="if (UI.kbdshift) UI.insert(UI.focused,'∞'); else UI.insert(UI.focused,'pi')">
      <input type="button" style="width:29px;height:35px;" name="add_i"
id="add_i"
  value="i" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'i')" title="Nombre complexe racine carree de -1">
      <input type="button" style="width:29px;height:35px;" name="add_sqrt"
id="add_sqrt"
  value="√" onmousedown="event.preventDefault()" onClick="if (UI.kbdshift) UI.insert(UI.focused,'^2'); else UI.insert(UI.focused,'sqrt(');" title="racine carree">        
      <input type="button" style="width:29px;height:35px;" name="add_4" id="add_4" value="4" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'4')">  
      <input type="button" style="width:29px;height:35px;" name="add_5" id="add_5" value="5" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'5')">  
      <input type="button" style="width:29px;height:35px;" name="add_6" id="add_6" value="6" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'6')">  
      <input type="button" style="width:29px;height:35px;" name="add_*" id="add_*" value="*" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'*')">  
    </td>
  </tr>
  <tr>
    <td>
      <input type="button" style="width:29px;height:35px;"
  onmousedown="event.preventDefault()"
  onClick="UI.insert(UI.focused,value);" id="add_inferieur" value="<"
  title="Inf&eacute;rieur ou sup&eacute;rieur">
      <input type="button" style="width:29px;height:35px;" name="add-=" id="add-=" value="=" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" style="width:29px;height:35px;" name="add_,"
id="add_,"
  value="," onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)" title="La virgule est utilisee comme separateur des composantes d'un vecteur. La quote sert &agrave; empecher l'&eacute;valuation.">  
      <input type="button" style="width:29px;height:35px;" name="curseur_up"
id="curseur_up"
  value="↑" onmousedown="event.preventDefault()" onClick="UI.moveCaretUpDown(UI.focused,-1)" title="deplace le curseur vers le haut">        
      <input type="button" style="width:29px;height:35px;" name="copy_button" id="copy_button" value="cp"
      onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,UI.selection)" title="Copie la derni&egrave;re ligne de commande s&eacute;lectionn&eacute;e vers le focus.">  
      <input type="button" style="width:29px;height:35px;" name="add_∞"
id="add_∞"
  value="x,t,n" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,UI.xtn)" title="+∞. Utiliser infinity pour l'infini complexe.">
      <input type="button" style="width:29px;height:35px;" name="add_1" id="add_1" value="1" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'1')">  
      <input type="button" style="width:29px;height:35px;" name="add_2" id="add_2" value="2" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'2')">  
      <input type="button" style="width:29px;height:35px;" name="add_3" id="add_3" value="3" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'3')">  
      <input type="button" style="width:29px;height:35px;" name="add_-" id="add_-" value="-" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'-')">  
    </td>
  </tr>
  <tr>
    <td>
      <input type="button" style="width:29px;height:35px" id="shift_key" value="alt" title="Touches compl&eacute;mentaires" onmousedown="event.preventDefault()" onClick ="UI.toggleshift();">  
      <input type="button" style="width:29px;height:35px;" name="add_:"
id="add_:"
  value=":=" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)" title=":= effectue une affectation, par exemple a:=pi/2; sin(a). ! calcule une factorielle.">
      <input type="button" style="width:29px;height:35px;"
      name="add_semi" id="add_semi" value=";" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)"
  title="Le point virgule permet de separer plusieurs commandes pour les executer en une fois, par exemple dans un programme.">
      <input type="button" style="width:29px;height:35px;" name="curseur_down" id="curseur_down"  value="↓" onmousedown="event.preventDefault()" onClick="UI.moveCaretUpDown(UI.focused,1)" title="deplace le curseur vers le bas">
      <input type="button" style="width:29px;height:35px;"
  id="add_beg"
  value="beg" onmousedown="event.preventDefault()"
  onClick="UI.setselbeg(UI.focused);" title="Debut selection">  
      <input type="button" style="width:29px;height:35px;"
  id="add_end"
  value="end" onmousedown="event.preventDefault()"
  onClick="UI.setselend(UI.focused)" title="Fin selection">  
      <input type="button" style="width:29px;height:35px;" name="add_e"
id="add_e"
  value="e" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'e')" title="e est la base de l'exponentielle ou le separateur entre la mantisse et l'exposant d'un nombre approche ">  
      <input type="button" style="width:29px;height:35px;" name="add_0" id="add_0" value="0" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'0')">  
      <input type="button" style="width:29px;height:35px;" name="add_." id="add_." value="." onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'.')">  
      <input type="button" style="width:29px;height:35px;" name="add_+" id="add_+" value="+" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'+')">  
    </td>    
  </tr>
</table>

<table border="0" align="center" summary="" id="keyboardfunc"
  style="display:none" onmousedown="event.preventDefault()" >
  <tr>
    <td>
      <input type="button" style="width:60px;height:35px"
  name="add_simplify" id="add_simplify" value="simpl"
  onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'simplify(') ;UI.kbdonfuncoff();" title="Tentative de simplifier une expression, par exemple simplify(sin(3x)/sin(x)). Essayez une commande comme ratnormal, normal ou de reecriture si simplify echoue.">        
 
      <input type="button" style="width:60px;height:35px"
  name="add_texpand" id="add_texpand" value="texpnd"
  onmousedown="event.preventDefault()"
  onClick="UI.insert(UI.focused,'texpand(') ;UI.kbdonfuncoff();"
  title="Developpe les expressions trigonometriques, exponentielles et logarithmes">  

      <input type="button" style="width:60px;height:35px" name="add_solve"
id="add_solve"
  value="solve" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused; document.getElementById('assistant_solve').style.display='block';UI.set_focus('solveeq') ;"
  title="r&eacute;soudre une &eacute;quation ou expression=0 par rapport &agrave; une ou plusieurs variables, par exemple solve(x^4-1=0) ou solve(y^3-1,y) ou solve([2x^2-y^2=1,x+y=3],[x,y]). Utiliser csolve pour r&eacute;soudre sur C.">        
      <input type="button" style="width:60px;height:35px" name="add_linsolve"
id="add_linsolve"
  value="linslv" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'linsolve(') ;UI.kbdonfuncoff();"
  title="r&eacute;soudre un syst&egrave;me lin&eacute;aire, par exemple linsolve([x+y=1,a*x-y=2],[x,y])">        
      <input type="button" style="width:60px;height:35px"
  name="add_desolve" id="add_desolve" value="deslv"
  onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_desolve').style.display='block';UI.set_focus('desolveeq');" title="Resolution d'une equation differentielle, par exemple desolve(y''+y=0), desolve(y'+y=0,y(0)=1)">        
      <input type="button" style="width:60px;height:35px"
  name="add_plotfield" id="add_plotfield" value="field"
  onmousedown="event.preventDefault()"
  onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_plotfield').style.display='block';UI.set_focus('plotfieldexprf');"
  title="Champ des tangentes, par exemple plotfield(sin(t*y),[t=-5..5,y=-3..3],xstep=0.5,ystep=0.5))">  
      <input type="button" style="width:29px;height:35px" name="add_sum"
id="add_sum"
  value="∑" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_sum').style.display='block';UI.set_focus('sumexpr') ; " title="Somme d'une expression pour une variable entre deux bornes, par exemple ∑(k,k,1,n) ou ∑(1/n^2,n,1,inf)">  
      <input type="button" style="width:50px;height:35px" name="add_limit"
id="add_limit"
      value="limit" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused; document.getElementById('assistant_limit').style.display='block';UI.set_focus('limitexpr') ;" title="limite d'une expression lorsqu'une variable tend vers une limite, par exemple limit(sin(x)/x,x,0). Utiliser un 4eme parametre egal a 1 ou -1 pour une limite a droite ou a gauche.">        
    </td>
  </tr>
  <tr>
    <td>
      <input type="button" style="width:60px;height:35px"
  name="add_factor" id="add_factor" value="factor"
      onmousedown="event.preventDefault()"
  onClick="UI.insert(UI.focused,'factor(') ;UI.kbdonfuncoff();" title="Factorisation, par exemple factor(x^4-1). Utiliser cfactor pour factoriser sur C">
      <input type="button" style="width:60px;height:35px"
  name="add_tcollect" id="add_tcollect" value="tcoll"
  onmousedown="event.preventDefault()"
  onClick="UI.insert(UI.focused,'tcollect(') ;UI.kbdonfuncoff();"
  title="Linearise et regroupe les expressions trigonometriques">        
      <input type="button" style="width:60px;height:35px"
  name="add_matr" id="add_matr" value="matrix"
  onmousedown="event.preventDefault()"
  onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_matr').style.display='block';document.getElementById('matr_type_chooser').style.display='inline';document.getElementById('matr_stats').style.display='none';UI.assistant_matr_setdisplay();UI.set_focus('matr_case0_0');"
  title="assistant cr&eacute;ation de matrice">
      <input type="button" style="width:60px;height:35px" name="add_tabvar"
id="add_tabvar"
  value="f(x)" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_tabvar').style.display='block';"
  title="Etude de graphe de fonction ou de courbe parametrique, par exemple tabvar(sin(x)) ou tabvar([cos(2t),sin(3t)])">  
      <input type="button" style="width:60px;height:35px" name="add_plot"
id="add_plot"
  value="plot" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_plotfunc').style.display='block';UI.xtn='x';"
  title="Graphe d'une expression, par exemple plotfunc(sin(x),x=-5..5,xstep=0.1)">  
      <input type="button" style="width:60px;height:35px"
  name="add_plotimplicit" id="add_plotimplicit" value="impl"
  onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused; document.getElementById('assistant_plotimplicit').style.display='block';UI.set_focus('plotimplicitexprf') ;" title="Graphe d'une courbe implicite, par exemple plotimplicit(x^2+x*y+y^2=3)">  
      <input type="button" style="width:29px;height:35px" name="add_diff"
id="add_diff"
  value="∂" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_diff').style.display='block';UI.set_focus('diffexpr') ;" title="Derivee d'une expression. Pour une fonction f, par exemple f(x):=sin(x^2), la derivee de f est f', par exemple g:=f' ou f'(2)">        
      <input type="button" style="width:50px;height:35px"
  name="add_series" id="add_series" value="series"
  onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused; document.getElementById('assistant_series').style.display='block';UI.set_focus('seriesexpr') ;" title="series calcule le developpement de Taylor d'une expression lorsqu'une variable tend vers un point, par exemple series(sin(x),x=0,5,polynom). Si on omet polynom un terme de reste est renvoye. On peut specifier un developpement a droite ou a gauche en ajoutant 1 ou -1 avant polynom"> 
       </td>
  </tr>
  <tr>
    <td>
      <input type="button" style="width:60px;height:35px"
  name="add_stats" id="add_stats" value="stats"
      title="Probabilit&eacute;s et statistiques"
      onmousedown="event.preventDefault()"
  onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;var mat=document.getElementById('assistant_matr');mat.style.display='block';mat.matr_formule.checked=false;mat.matr_formuleshadow.checked=true;document.getElementById('matr_type_chooser').style.display='none';document.getElementById('matr_stats').style.display='block';UI.assistant_matr_setdisplay();document.getElementById('matr').style.display='none';document.getElementById('matr_matr').style.display='none';document.getElementById('matr_testhyp').style.display='none';document.getElementById('risque_alpha').style.display='none';"
>

      <input type="button" style="width:60px;height:35px"
  name="add_rand" id="add_rand" value="al&eacute;a"
  onmousedown="event.preventDefault()"
  onClick="UI.savefocused=UI.focused;document.getElementById('assistant_rand').style.display='block';UI.assistant_rand_setdisplay();UI.kbdonfuncoff();"
  title="g&eacute;n&eacute;rer un nombre, une liste ou une matrice al&eacute;atoirement">        
      <input type="button" style="width:50px;height:35px"
  name="add_seq" id="add_seq" value="list"
  onmousedown="event.preventDefault()"
  onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_seq').style.display='block';UI.set_focus('seqexpr')"
  title="assistant de cr&eacute;ation de liste ou tableau de valeurs, par exemple seq(j^2,j,1,n) cr&eacute;e la liste des carr&eacute;s des entiers de 1 &agrave; n ou seq(x^2,x,-2,2,0.1) cr&eacute;e la liste des carr&eacute;s des r&eacute;els de -2 &agrave; 2 par pas de 0.1"> 
<input type="button" style="width:60px;height:35px"
  name="add_rsolve" id="add_rsolve" value="u_n"
  onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_suites').style.display='block';UI.xtn='n';" title="Recherche de l'expression du terme g&eacute;n&eacute;ral d'une suite r&eacute;currente, par exemple rsolve(u(n+2)=u(n+1)+u(n),u(n),[u(0)=1,u(1)=1])">             
      <input type="button" style="width:60px;height:35px"
  name="add_plotparam" id="add_plotparam" value="param"
  onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;document.getElementById('assistant_plotparam').style.display='block';UI.xtn='t';" title="Graphe d'une courbe en parametriques, par exemple plotparam([cos(t),sin(t)],t=0..2*pi,tstep=0.1)">  
      <input type="button" style="width:60px;height:35px" name="add_polar"
id="add_polar"
  value="polar" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused; document.getElementById('assistant_plotpolar').style.display='block';UI.xtn='t'; UI.set_focus('plotpolarexpr');"
  title="Graphe en polaires, par exemple plotpolar(sin(3*t),t)">        
      <input type="button" style="width:29px;height:35px"
  name="add_integrate" id="add_integrate" value="∫" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused; document.getElementById('assistant_int').style.display='block';UI.set_focus('intexpr');"
  title="Calcul d'integrales, par exemple ∫(x^2*sin(x)*exp(x),x) ou ∫(1/(x^4+1),x,0,inf)">        
      <input type="button" value="curseur" id="add_curseur" style="height:35px" onclick="UI.addcurseur(String.fromCharCode(UI.paramname),0,-5,5,0.1); UI.paramname++;" title="Ajoute un param&egrave;tre modifiable &agrave; la souris"></button>
    </td>
  </tr>
</table>
<div id="progbuttons" style="display:none">
      <input type="button" style="width:29px;height:35px" name="add_test"
id="add_test"
      value="si" onmousedown="event.preventDefault()" onClick="UI.kbdonfuncoff();UI.savefocused=UI.focused;  document.getElementById('assistant_boucle').style.display='none'; document.getElementById('assistant_test').style.display='block' ;UI.set_focus('sicond'); //UI.insert(UI.focused,'\nsi  alors  sinon  fsi; ');UI.moveCaret(UI.focused,-20);UI.kbdonfuncoff();" title="Assistant de cr&eacute;ation de test">        
      <input type="button" style="width:40px;height:35px" 
id="add_boucle" value="boucle" onclick="UI.savefocused=UI.focused; document.getElementById('assistant_boucle').style.display='block';" title="Assistant de cr&eacute;ation de boucle">

      <input type="button" value="fonct" title="Assistant de cr&eacute;ation de fonction" style="width:55px;height:35px" id="add_function" onclick="UI.kbdonfuncoff(); UI.savefocused=UI.focused;  document.getElementById('assistant_boucle').style.display='none'; document.getElementById('assistant_prog').style.display='block';UI.set_focus('returnedvar');">
      <input type="button" style="width:46px;height:35px" name="add_debug"
id="add_debug"
  value="debug" onmousedown="event.preventDefault()"
  onClick="UI.insert(UI.focused,'debug(')" title="Mettre au point, par exemple debug(f(2,3)) execute la fonction f avec arguments 2 et 3 en pas &agrave; pas">        
      <input type="button" style="width:29px;height:35px" name="add_//"
      id="add_//"
      value="//" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'//');UI.kbdonfuncoff();" title="commentaire">        
      <input type="button" style="width:29px;height:35px" name="add_nlprog"
      id="add_nlprog"
      value="\n" onmousedown="event.preventDefault()"
      onClick="UI.insert(UI.focused,'\n')" title="Ajoute un saut de ligne">        
      <input type="button" style="width:29px;height:35px" 
      id="add_indent"
      value="->/" onmousedown="event.preventDefault()"
      onClick="UI.indentline(UI.focused);" title="Indente la ligne courante">        
      <input type="button" style="width:29px;height:35px" name="add_space"
      id="add_space"
      value=" " onmousedown="event.preventDefault()"
      onClick="UI.insert(UI.focused,' ')" title="Ajoute un espace">        
</div>

<form id="assistant_matr" style="display:none" onsubmit="setTimeout(UI.assistant_matr_ok()); return false">
<div id="matr_type_chooser">
  <input class="bouton" type="checkbox" name="matr_formule"
  onclick="document.getElementById('assistant_matr').matr_formuleshadow.checked=!checked;UI.assistant_matr_setdisplay();"
  title="Cocher pour d&eacute;finir la matrice par une formule">
  <input class="bouton" type="button" value="formule" onclick="document.getElementById('assistant_matr').matr_formule.checked=true;document.getElementById('assistant_matr').matr_formuleshadow.checked=false;UI.assistant_matr_setdisplay();"> ou
  <input class="bouton" type="checkbox" name="matr_formuleshadow"
  onclick="document.getElementById('assistant_matr').matr_formule.checked=!checked;UI.assistant_matr_setdisplay();"
  title="Cocher pour d&eacute;finir la matrice &eacute;l&eacute;ment par &eacute;l&eacute;ment" checked>
  <input class="bouton" type="button" value="&eacute;l&eacute;ment par &eacute;l&eacute;ment" onclick="document.getElementById('assistant_matr').matr_formule.checked=false;document.getElementById('assistant_matr').matr_formuleshadow.checked=true;UI.assistant_matr_setdisplay();">
</div>
&nbsp; &nbsp; &nbsp;
<input class="bouton" type="button" title="Annuler" value="Annul." onclick="form.style.display='none'; UI.focused=UI.savefocused; UI.focused.focus();"> &nbsp;
<input class="bouton" type="submit" title="ok" value="OK">
<div id="matr_stats" style="display:none">
  <input class="bouton" type="button"
  onclick="document.getElementById('chooselawdiv').style.display='block';document.getElementById('law_arg').style.display='inline';document.getElementById('matr_stat12').style.display='none';document.getElementById('matr_testhyp').style.display='none';document.getElementById('risque_alpha').style.display='none';document.getElementById('matr').style.display='none';document.getElementById('matr_matr').style.display='none';" value="lois usuelles">
  ou <input class="bouton" type="button"
  onclick="document.getElementById('chooselawdiv').style.display='block';document.getElementById('law_arg').style.display='none';document.getElementById('matr_stat12').style.display='none';document.getElementById('matr_testhyp').style.display='none';document.getElementById('risque_alpha').style.display='block';document.getElementById('matr').style.display='none';document.getElementById('matr_matr').style.display='none';" value="intervalle de fluctuation">
  ou <input class="bouton" type="button" onclick="document.getElementById('matr_stat12').style.display='block';document.getElementById('matr').style.display='block'; document.getElementById('matr_testhyp').style.display='none';document.getElementById('risque_alpha').style.display='none';document.getElementById('chooselawdiv').style.display='none'; document.getElementById('matr_matr').style.display='inline';document.getElementById('matr_submat').style.display='block';" value="statistiques descriptives">
  ou <input class="bouton" type="button" onclick="document.getElementById('matr_stat12').style.display='none';document.getElementById('matr').style.display='block'; document.getElementById('matr_testhyp').style.display='block';document.getElementById('risque_alpha').style.display='block';document.getElementById('chooselawdiv').style.display='none'; document.getElementById('matr_matr').style.display='inline';document.getElementById('matr_submat').style.display='block';" value="statistiques inf&eacute;rentielles">
<div id="matr_stat12" style="display:none">
  <input class="bouton" type="checkbox" name="stat_mean">Moyenne,
  <input class="bouton" type="checkbox" name="stat_stddev">Ecart-type,
  <input class="bouton" type="checkbox" name="stat_quartiles">Quartiles,
  <input class="bouton" type="checkbox" name="stat_histo" onclick="form.stat_cmax.value=form.stat_cmin.value;">Histogramme,
  <input class="bouton" type="checkbox" name="stat_moustache">Boite a moustache,
  <br>
  <input class="bouton" type="checkbox" name="stat_scatter" onclick="form.stat_cmax.value=form.stat_cmin.value+1;">Nuage de points
  <input class="bouton" type="checkbox" name="stat_polygonscatter" onclick="form.stat_cmax.value=form.stat_cmin.value+1;">reli&eacute;s,
  <input class="bouton" type="checkbox" name="stat_linreg" onclick="form.stat_cmax.value=form.stat_cmin.value+1;">R&eacute;gression lin&eacute;aire
</div>
<div id="risque_alpha" style="display:none">
  Risque &alpha;= <input class="bouton" type="text"
 id="adequation_alpha" name="adequation_alpha" value=0.05 size=4>
</div>
<div id="matr_testhyp" style="display:none">
  <ul>
    <li> Ad&eacute;quation data/data : 
    <strong>Chi2</strong> <input type="radio" onclick="UI.adequation(form)"
    name="adequation" value="radio" checked>, 
    <strong>Kolmogorov</strong> <input onclick="UI.adequation(form)"
    type="radio" name="adequation" value="radio" title="test de Kolmogorov-Smirnov d'ad&eacute;quation &agrave; une loi commune continue inconnue">, 
    ou <strong>Wilcoxon</strong> <input onclick="UI.adequation(form)"
    type="radio" name="adequation" value="radio" title="test de Wilcoxon-Mann-Whitney"> 
    </li>
    <li>
    Ad&eacute;quation data/loi : <strong>normal</strong> <input type="radio"
    name="adequation" value="radio" onclick="UI.adequation(form)" checked>
    ou <strong>Student</strong> <input type="radio" onclick="UI.adequation(form)"
    name="adequation" value="radio"> :
    &mu;=<input class="bouton" type="text" name="adequation_mu" size=4
    value=0>
    (&sigma;=<input class="bouton" type="text"
    name="adequation_sigma" size=4> optionnel),
    <br>
    <span title="Hypoth&egrave;se alternative a H0">Alternative H1 &lt;<input
    type="radio" name="adequation_alt" >,
    &ne;<input type="radio" name="adequation_alt" checked>,
    &gt;<input type="radio" name="adequation_alt"></span>
    </li>
    <li>
    Intervalle de confiance :
    <strong>data</strong><input type="radio" onclick="UI.adequation(form)" name="adequation"
    title="Intervalle calcul&eacute; par la loi de Student sur les donn&eacute;es des lignes et colonnes de la matrice m">,
    <strong>proportion</strong><input type="radio" name="adequation"
    onclick="UI.adequation(form)" title="Intervalle de confiance calcul&eacute; par la loi normale en supposant n*p et n*(1-p)>=5">
    (n=<input name="confiance_n" class="bouton" type="number" value=30
    min=30 step=1 title="Taille de la population. Pour n&gt;100, utilise sqrt(n/(n-1)*p*(1-p)) comme estimateur de l'ecart-type, sinon on majore par 0.5">&gt;30,
    p=<input name="confiance_p" class="bouton" type="number"
    title="Proportion dans l'&eacute;chantillon"
    value=0.5 min=0 max=1 step=0.001>),
    <strong>&mu;&sigma;</strong><input type="radio"
    onclick="UI.adequation(form)" name="adequation" title="Intervalle calcul&eacute par la loi de Student">
    (&mu;=<input name="confiance_mu" class="bouton" type="number"
    title="Moyenne de l'&eacute;chantillon" value=0
    step=0.001>, &sigma;=<input name="confiance_sigma" class="bouton" type="number"
    step=0.001 min=0 value=1 title="Ecart-type de la population">
    n=<input name="confiance_n_" class="bouton" type="number" value=30
    min=30 step=1 >)
    </li>
  </ul>
</div>
</div>
<div id="matr_matr">
<input id="matr_or_sheet" name="matr_or_sheet" class="bouton"
  type="checkbox" title="Cocher pour passer en mode tableur"
  onchange="UI.is_sheet=checked; if (checked) UI.matrix2spreadsheet(); else UI.spreadsheet2matrix(false);" checked> Tableur
<input id="matr_name" name="matr_name" class="bouton" type="text" value="m" title="Nom de la matrice" size=3> :
<input class="bouton" type="button"
onclick="var field=document.getElementById('matr_nrows');field.value=eval(field.value)-1;UI.assistant_matr_setdisplay();" value="-">
<input class="bouton" type="number" id="matr_nrows" name="matr_nrows" onkeypress="if (event.keyCode!=13) return true; UI.assistant_matr_setdisplay(); return false;"
title="Nombre de lignes de la matrice" value=3 min=1 max=40>
<input class="bouton" type="button"
onclick="var field=document.getElementById('matr_nrows');field.value=eval(field.value)+1;UI.assistant_matr_setdisplay();" value="+">
 par 
<input class="bouton" type="button"
onclick="var field=document.getElementById('matr_ncols');field.value=eval(field.value)-1;UI.assistant_matr_setdisplay();" value="-">
<input class="bouton" type="number" id="matr_ncols" name="matr_ncols" onkeypress="if (event.keyCode!=13) return true; UI.assistant_matr_setdisplay(); return false;" 
title="Nombre de colonnes de la matrice" value=3 min=1 max=6>
<input class="bouton" type="button"
onclick="var field=document.getElementById('matr_ncols');field.value=eval(field.value)+1;UI.assistant_matr_setdisplay();"
 value="+">
  </div>
<div id="matr_formulediv"> 
  (j,k)-&gt;<textarea rows="1" cols="20" style="font-size:18px"
  onclick="UI.focused=this;" id="matr_expr" name="matr_expr" title="Expression de m[j,k] en fonction de j et k"></textarea>
  <input class="bouton" type="checkbox" name="matr_start0"
  title="Cochez pour utiliser les indices commencant a 0" checked>
  (indices de 0 &agrave; taille-1)
<br>
  <input class="bouton" type="button" title="Matrice identit&eacute;" value="Identit&eacute;" onclick="form.matr_expr.value='si j==k alors 1; sinon 0; fsi';">
<input class="bouton" type="button" title="Matrice de Hilbert" value="Hilbert" onclick="form.matr_expr.value='1/(j+k+1)';">
<input class="bouton" type="button" title="Effacer" value="Effacer" onclick="if (form.matr_formule.checked) form.matr_expr.value='';">
</div>

<div id="matr" style="display:none">
  
  <div id="matr_submat" style="display:none">
  Lignes <input name="stat_lmin" class="bouton" type="number" min=0 value=0>
  -
  <input name="stat_lmax" class="bouton" type="number" min=0 value=1>,
  colonnes <input name="stat_cmin" class="bouton" type="number" min=0 value=0>
  -
  <input name="stat_cmax" class="bouton" type="number" min=0 value=1>
  </div>

  <div id="matr_casediv">
  </div>
  </div>
</form>

<form id="assistant_rand" style="display:none">
G&eacute;n&eacute;rer
<input class="bouton" type="button" onclick="form.rand_nrows.value--; if(form.rand_nrows.value<0) form.rand_nrows.value=0" value="-">
<input class="bouton" type="number" id="rand_nrows" name="rand_nrows"
title="Nombre de lignes de la matrice (0 pour un vecteur)" value=1 min=0>
<input class="bouton" type="button" onclick="document.getElementById('rand_nrows').value++;" value="+">
par
<input class="bouton" type="button" onclick="form.rand_ncols.value--; if(form.rand_ncols.value<0) form.rand_ncols.value=0" value="-">
<input class="bouton" type="number" id="rand_ncols" name="rand_ncols"
title="Nombre de colonnes de la matrice (0 pour un seul nombre)"
value=1 min=0>
<input class="bouton" type="button" onclick="document.getElementById('rand_ncols').value++;" value="+">
 nombres 
<input class="bouton" type="checkbox" name="rand_int"
 onclick="document.getElementById('assistant_rand').rand_intshadow.checked=!checked;UI.assistant_rand_setdisplay();" title="Cocher pour entiers" checked>
entiers ou
<input class="bouton" type="checkbox" name="rand_intshadow"
 onclick="document.getElementById('assistant_rand').rand_int.checked=!checked;UI.assistant_rand_setdisplay();"
title="Cocher pour choisir une loi">
selon une loi.
<div id="rand_intdiv">
 Entiers entre 0 et n ou n et -n avec n=
<input class="bouton" type="number" id="rand_maxint"
title="Entier k tel que 0&lt;=k&lt;n ou n&lt;k&lt;-n si n est n&eacute;gatif" value=100></div>
<input class="bouton" type="button" title="Annuler" value="Annul." onclick="form.style.display='none'; UI.focused=UI.savefocused; UI.focused.focus();">
  <input class="bouton" type="button" title="ok" value="OK" onclick="UI.assistant_rand_ok()">
</form>
<div id="chooselawdiv" style="display:none">
  <form id="chooselawform">
  Loi actuelle <input class="bouton" type="text" id="rand_law" name="rand_law"
title="Loi" value='normald'>, param&egrave;tres optionnels
<input class="bouton" type="number" name="rand_law1" id="rand_law1"
title="1er param&egrave;tre" value=0 step=0.01>  
<input class="bouton" type="number" name="rand_law2" id="rand_law2"
  title="2&egrave;me param&egrave;tre" value=1 step=0.01>
  <input class="bouton" type="text" name="law_arg" id="law_arg"
  title="argument de la loi, par exemple 1 ou 2 ou 1.3 ou x" value=1>
  <br>
  Choisir une autre loi
  <input type="button" onclick="document.getElementById('rand_law').value='uniform';document.getElementById('rand_law1').value=0;document.getElementById('rand_law1').step=0.01;document.getElementById('rand_law2').value=1;document.getElementById('rand_law1').style.display='inline';document.getElementById('rand_law2').style.display='inline';" value="uniform">
  <input type="button" onclick="document.getElementById('rand_law').value='normald';document.getElementById('rand_law1').value=0;document.getElementById('rand_law1').step=0.01;document.getElementById('rand_law2').value=1;document.getElementById('rand_law1').style.display='inline';document.getElementById('rand_law2').style.display='inline';" value="normald">
  <input type="button" onclick="document.getElementById('rand_law').value='binomial';document.getElementById('rand_law1').value=10;document.getElementById('rand_law1').step=1;document.getElementById('rand_law2').value=0.5;document.getElementById('rand_law1').style.display='inline';document.getElementById('rand_law2').style.display='inline';" value="binomial">
  <input type="button" onclick="document.getElementById('rand_law').value='negbinomial';document.getElementById('rand_law1').value=10;document.getElementById('rand_law1').step=1;document.getElementById('rand_law2').value=0.5;document.getElementById('rand_law1').style.display='inline';document.getElementById('rand_law2').style.display='inline';" value="negbinomial">
  <input type="button" onclick="document.getElementById('rand_law').value='geometric';document.getElementById('rand_law1').value=0.5;document.getElementById('rand_law1').step=0.01;document.getElementById('rand_law1').style.display='inline';document.getElementById('rand_law2').style.display='none';" value="geometric">
  <input type="button" onclick="document.getElementById('rand_law').value='poisson';document.getElementById('rand_law1').value=0.5;document.getElementById('rand_law1').step=0.01;document.getElementById('rand_law1').style.display='inline';document.getElementById('rand_law2').style.display='none';" value="poisson">
</form>
</div>

<div id="assistant_boucle" style="display:none">
  Choisir <strong>type de boucle</strong>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.kbdonfuncoff(); document.getElementById('assistant_pour').style.display='block';UI.set_focus('pourvarname'); document.getElementById('assistant_tantque').style.display='none';">pour</button>
ou
  <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.kbdonfuncoff(); document.getElementById('assistant_pour').style.display='none';document.getElementById('assistant_tantque').style.display='block';UI.set_focus('tantquecond'); "document.getElementById('tantquecond').focus();>tantque</button>
<div id="assistant_pour" style="display:none">
  pour <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="pourvarname" title="Nom de variable, par exemple j" rows=1></textarea><br>
  de <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="pourvarmin" title="Valeur de d&eacute;part" rows=1></textarea><br>
  jusque <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="pourvarmax" title="Valeur de fin" rows=1></textarea><br>
  pas optionnel <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="pourvarstep" title="on ajoute le pas &agrave; chaque it&eacute;ration, valeur par d&eacute;faut 1" rows=1></textarea>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_boucle').style.display='none';document.getElementById('assistant_pour').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('pourvarname').value='';document.getElementById('pourvarmin').value='';document.getElementById('pourvarmax').value='';">Effacer</button>
  <button  class="bouton" onclick="document.getElementById('pourvarname').value='j';document.getElementById('pourvarmin').value='1';document.getElementById('pourvarmax').value='10';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_pour_ok();"><strong>OK</strong></button> 
</div>
<div id="assistant_tantque" style="display:none">
  tantque <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tantquecond" title="Test de continuation de la boucle"
  rows=1></textarea>
  <br>
  Tests : <button  class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),'==')">==</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),'!=')">!=</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),'<=')">&lt;=</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),'>=')">&gt;=</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),'<')">&lt</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),'>')">&gt</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),' et ')">et</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),' ou ')">ou</button>
   <button  class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('tantquecond'),'!')">!</button>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_boucle').style.display='none';document.getElementById('assistant_pour').style.display='none'">Annuler</button>  <button class="bouton" onclick="UI.assistant_tantque_ok();"><strong>OK</strong></button> <br>
</div>
</div>

<div id="assistant_solve" style="display:none">
  R&eacute;soudre
  <button class="bouton" id="solvex" title="Cliquez ici pour une r&eacute;solution approch&eacute;e"
  onclick="style.display='none';document.getElementById('solvenum').style.display='inline'">exactement</button>
  <button class="bouton" style="display:none" id="solvenum" title="Cliquez ici pour une r&eacute;solution exacte"
  onclick="style.display='none';document.getElementById('solvex').style.display='inline'">de mani&egrave;re approch&eacute;ee</button>
  <button class="bouton" id="solveR" title="Cliquez ici pour une r&eacute;solution sur C"
  onclick="style.display='none';document.getElementById('solveC').style.display='inline'">sur R</button>
  <button class="bouton" style="display:none" id="solveC"  title="Cliquez ici pour une r&eacute;solution sur R"
  onclick="style.display='none';document.getElementById('solveR').style.display='inline'">sur C</button>
  <br>
  l'&eacute;quation ou le syst&egrave;me
  <br>
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="solveeq" title="Par exemple x^2-3x+1=0" rows=1
  cols=30></textarea>
  <br>
  d'inconnue(s)
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="solvevar" title="Par exemple x" rows=1 cols=10></textarea>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_solve').style.display='none'">Annuler</button>  
  <button  class="bouton" onclick="document.getElementById('solveeq').value='';document.getElementById('solvevar').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('solveeq').value='x^2-3x+1';document.getElementById('solvevar').value='x';">Exemple</button>
  <button class="bouton" onclick="document.getElementById('solveeq').value='[2x^2-y^2=1,x+y=3]';document.getElementById('solvevar').value='[x,y]';">Syst&egrave;me</button>
  <button class="bouton" onclick="UI.assistant_solve_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_suites" style="display:none">
  Choisir entre
  <button class="bouton"
  onclick="document.getElementById('assistant_rsolve').style.display='none';document.getElementById('assistant_fixe').style.display='block';UI.set_focus('rsolveexpr') ">&eacute;tude approch&eacute;e de u_(n+1)=f(u_n)</button>
 ou
  <button class="bouton"
  onclick="document.getElementById('assistant_rsolve').style.display='block';document.getElementById('assistant_fixe').style.display='none';UI.set_focus('rsolveeq');">
  trouver u_n en fonction de n
  </button>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_suites').style.display='none'">Annuler</button><br>  

  <div id="assistant_rsolve" style="display:none">
  Relation(s) de r&eacute;currence
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolveeq" title="Par exemple u(n+1)=2*u(n)+3" rows=1
  cols=40></textarea>
  <br>
  Suite(s) inconnue(s)
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolvevar" title="Par exemple u(n)" rows=1 cols=20>u(n)</textarea>
  <br>
  Conditions initiales
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolveinit" title="Par exemple u(0)=1" rows=1
  cols=20>u(0)=1</textarea>
  <br>
  <button  class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.set_focus('rsolveeq') ;UI.insert(UI.focused,'u(n+2)')">u(n+2)</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.set_focus('rsolveeq') ;UI.insert(UI.focused,'u(n+1)')">u(n+1)</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(UI.focused,'u(n)')">u(n)</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.set_focus('rsolveeq') ;UI.insert(UI.focused,'u(n-1)')">u(n-1)</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.set_focus('rsolveinit') ;UI.insert(UI.focused,'u(0)=')">u(0)=</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.set_focus('rsolveinit');UI.insert(UI.focused,'u(1)=')">u(1)=</button>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_suites').style.display='none'">Annuler</button>  
  <button  class="bouton" onclick="document.getElementById('rsolveeq').value='';document.getElementById('rsolvevar').value='';document.getElementById('rsolveinit').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('rsolveeq').value='u(n+1)=2*u(n)+3';document.getElementById('rsolvevar').value='u(n)';document.getElementById('rsolveinit').value='u(0)=1';">Arit-geo</button>
  <button class="bouton" onclick="document.getElementById('rsolveeq').value='u(n+1)=(u(n)+2)/(u(n)+1)';document.getElementById('rsolvevar').value='u(n)';document.getElementById('rsolveinit').value='u(0)=1';">Fixe</button>
  <button class="bouton" onclick="document.getElementById('rsolveeq').value='u(n+2)=u(n+1)+u(n)';document.getElementById('rsolvevar').value='u(n)';document.getElementById('rsolveinit').value='u(0)=1,u(1)=1';">Fibonacci</button>
  <button class="bouton" onclick="document.getElementById('rsolveeq').value='[u(n+1)=3*v(n)+u(n),v(n+1)=v(n)+u(n)]';document.getElementById('rsolvevar').value='[u(n),v(n)]';document.getElementById('rsolveinit').value='u(0)=1,v(0)=2'">Syst&egrave;me</button>
  <button class="bouton"
onclick="UI.assistant_rsolve_ok();"><strong>OK</strong></button>
</div>

  <div id="assistant_fixe" style="display:none">
  u_(n+1)=<textarea onkeyup="document.getElementById('rsolvefshadow').innerHTML=value;" onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolvef" title="Nom de la fonction" rows=1
  cols=2>f</textarea>(u_n) avec
    <span id="rsolvefshadow">f</span>(<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolvevarf" title="" rows=1 cols=2>x</textarea>):=
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolveexpr" title="Par exemple (x+2)/(x+1)" rows=1 cols=20></textarea>
  et u(0)=
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolveu0" title="Par exemple 1" rows=1
  cols=10></textarea>
    <br>
    Nombre de termes n=
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolven" title="Par exemple 10" rows=1
  cols=3>10</textarea>
    <br>
    Repr&eacute;sentation graphique entre
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolvemin" title="Par exemple 0" rows=1
  cols=3>0</textarea> et
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="rsolvemax" title="Par exemple 2" rows=1
  cols=3>2</textarea>
    
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_suites').style.display='none'">Annuler</button>  
  <button  class="bouton" onclick="document.getElementById('rsolvef').value='';document.getElementById('rsolvevarf').value='';document.getElementById('rsolveexpr').value='';document.getElementById('rsolveu0').value='';document.getElementById('rsolven').value='';document.getElementById('rsolvemin').value='';document.getElementById('rsolvemax').value='';">Effacer</button>
  <button  class="bouton" onclick="document.getElementById('rsolvef').value='f';document.getElementById('rsolvevarf').value='x';document.getElementById('rsolveexpr').value='(x+2)/(x+1)';document.getElementById('rsolveu0').value='1';document.getElementById('rsolven').value='10';document.getElementById('rsolvemin').value='1';document.getElementById('rsolvemax').value='2';">Exemple</button>
  <button class="bouton"
onclick="UI.assistant_fixe_ok();"><strong>OK</strong></button>
</div>

</div>

  <div id="assistant_desolve" style="display:none">
  &Eacute;quation diff&eacute;rentielle
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="desolveeq" title="Par exemple y'+t*y=t^2" rows=1
  cols=40></textarea>
  <br>
  Variable
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="desolvevar" title="Par exemple t" rows=1 cols=3>t</textarea>,
  inconnue
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="desolvey" title="Par exemple y" rows=1 cols=3>y</textarea>
  <br>
  Conditions initiales optionnelles
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="desolveinit" title="Par exemple y(0)=1,y'(0)=0" rows=1
  cols=20></textarea>
  <br>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.set_focus('desolveeq');UI.insert(UI.focused,'t')">t</button>
  <button  class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.set_focus('desolveeq') ;UI.insert(UI.focused,'y\'\'')">y''</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(UI.focused,'y\'')">y'</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(UI.focused,'y')">y</button>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_desolve').style.display='none'">Annuler</button>  
  <button  class="bouton" onclick="document.getElementById('desolveeq').value='';document.getElementById('desolvevar').value='';document.getElementById('desolvey').value='';document.getElementById('desolveinit').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('desolveeq').value='y\'+t*y=t';document.getElementById('desolvevar').value='t';document.getElementById('desolvey').value='y';document.getElementById('desolveinit').value='y(0)=2';">Ordre 1</button>
  <button class="bouton" onclick="document.getElementById('desolveeq').value='y\'\'+y=t^2';document.getElementById('desolvevar').value='t';document.getElementById('desolvey').value='y';document.getElementById('desolveinit').value='y(0)=1,y\'(0)=0';">Ordre 2</button>
  <button class="bouton" onclick="document.getElementById('desolveeq').value='y\'=[[1,2],[2,1]]*y+[t,t+1]';document.getElementById('desolvevar').value='t';document.getElementById('desolvey').value='y';document.getElementById('desolveinit').value='y(0)=[1,2]'">Syst&egrave;me</button>
  <button class="bouton"
onclick="UI.assistant_desolve_ok();"><strong>OK</strong></button>
</div>

<div id="assistant_test" style="display:none">
  si <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="sicond" title="Test, par exemple j!=0"
  rows=1></textarea> 
  <br>
  alors <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="sialors" title="Clause vraie, par exemple j:=-j;"
  rows=1></textarea>
  <br>
  sinon (optionnel) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="sisinon" title="Clause fausse"
  rows=1></textarea>
  <br>
  Tests : <button  class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),'==')">==</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),'!=')">!=</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),'<=')">&lt;=</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),'>=')">&gt;=</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),'<')">&lt</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),'>')">&gt</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),' et ')">et</button>
  <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),' ou ')">ou</button>
   <button class="bouton" onmousedown="event.preventDefault()"
  onclick="UI.insert(document.getElementById('sicond'),'!')">!</button>
  <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_test').style.display='none'">Annuler</button>
<button  class="bouton"
  onclick="document.getElementById('sicond').value='';document.getElementById('sialors').value='';">Effacer</button>
<button  class="bouton"
  onclick="document.getElementById('sicond').value='j<0';document.getElementById('sialors').value='j:=-j;';">Exemple</button>
<button class="bouton" onclick="UI.assistant_test_ok();"><strong>OK</strong></button>
</div>

<div id="assistant_prog" style="display:none">
  <strong>Nouvelle fonction</strong><br>
  nom de la fonction <textarea onclick="UI.focused=this;" style="height:25px;font-size:large" id="funcname" title="Nom de la fonction, par exemple f" rows=1>f</textarea><br>
  liste des arguments <textarea onclick="UI.focused=this;" style="height:25px;font-size:large" id="argsname" title="Arguments de la fonction s&eacute;par&eacute;s par des virgules" rows=1>x</textarea><br>
  variables locales <textarea onclick="UI.focused=this;" style="height:25px;font-size:large" id="localvars" title="Variables locales, s&eacute;par&eacute;es par des virgule. Laisser vide pour une fonction d&eacute;finie par une expression." rows=1></textarea><br>
  valeur renvoy&eacute;e <textarea onclick="UI.focused=this;" style="height:25px;font-size:large" id="returnedvar" title="Valeur de retour" rows=1></textarea><br>

  <button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_prog').style.display='none'">Annuler</button>
  <button  class="bouton"
      onclick="document.getElementById('funcname').value='';document.getElementById('argsname').value='';document.getElementById('localvars').value='';document.getElementById('returnedvar').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('funcname').value='f';document.getElementById('argsname').value='x,y';document.getElementById('localvars').value='';document.getElementById('returnedvar').value='x*y';">Exemple 1</button>
  <button class="bouton" onclick="document.getElementById('funcname').value='f';document.getElementById('argsname').value='x,y';document.getElementById('localvars').value='z';document.getElementById('returnedvar').value='x*z';">Exemple 2</button>
  <button class="bouton" onclick="UI.assistant_prog_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_seq" style="display:none">
  Cr&eacute;ation d'une s&eacute;quence ou tableau de valeurs, <br>
  expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seqexpr" title="Expression, par exemple j^2" rows=1></textarea><br>
  variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seqvarname" title="Nom de variable, par exemple j" rows=1></textarea><br>
  de <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seqvarmin" title="Valeur de d&eacute;part" rows=1></textarea><br>
  jusque <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seqvarmax" title="Valeur de fin" rows=1></textarea><br>
  Pas optionnel <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seqvarstep" title="on ajoute le pas &agrave; chaque it&eacute;ration, valeur par d&eacute;faut 1" rows=1></textarea>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_seq').style.display='none'">Annuler</button>
  <button  class="bouton" onclick="document.getElementById('seqexpr').value='j^2';document.getElementById('seqvarname').value='j';document.getElementById('seqvarmin').value='1';document.getElementById('seqvarmax').value='10';document.getElementById('seqvarstep').value=''">Exemple 1</button>
  <button  class="bouton" onclick="document.getElementById('seqexpr').value='[j,j^2]';document.getElementById('seqvarname').value='j';document.getElementById('seqvarmin').value='-2';document.getElementById('seqvarmax').value='2';document.getElementById('seqvarstep').value='0.25'">Exemple 2</button>
  <button class="bouton"
      onclick="document.getElementById('seqexpr').value='';document.getElementById('seqvarname').value='';document.getElementById('seqvarmin').value='';document.getElementById('seqvarmax').value='';document.getElementById('seqvarstep').value=''">Effacer</button>
  <button class="bouton" onclick="UI.assistant_seq_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_plotpolar" style="display:none">
  Courbe en polaire <br>
  expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotpolarexpr" title="Expression, par exemple sin(3*t)" rows=1></textarea><br>
  variable θ <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotpolarvarname" title="Nom de variable, par exemple t" rows=1>t</textarea><br>
  θmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotpolarvarmin" title="Valeur de d&eacute;part" rows=1></textarea><br>
  θmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotpolarvarmax" title="Valeur de fin" rows=1></textarea><br>
  θstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotpolarvarstep" title="Pas entre deux &ecaute;valuations" rows=1></textarea>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_plotpolar').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('plotpolarexpr').value='';document.getElementById('plotpolarvarname').value='';document.getElementById('plotpolarvarmin').value='';document.getElementById('plotpolarvarmax').value='';document.getElementById('plotpolarvarstep').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('plotpolarexpr').value='sin(3*t)';document.getElementById('plotpolarvarname').value='t';document.getElementById('plotpolarvarmin').value='0';document.getElementById('plotpolarvarmax').value='pi';document.getElementById('plotpolarvarstep').value='';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_plotpolar_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_series" style="display:none">
  D&eacute;veloppement limit&eacute; <br>
  expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seriesexpr" title="Expression, par exemple sin(x)" rows=1></textarea><br>
  variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seriesvarname" title="Nom de variable, par exemple x" rows=1>x</textarea><br>
  en <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seriesvarlim" title="Point limite" rows=1></textarea><br>
  ordre <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seriesvarorder" title="Ordre" rows=1></textarea><br>
  Polynome <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="seriesvarstep" title="L'option polynom supprime le terme de reste du d&eacute;veloppement" rows=1>polynom</textarea>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_series').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('seriesexpr').value='';document.getElementById('seriesvarname').value='';document.getElementById('seriesvarlim').value='';document.getElementById('seriesvarorder').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('seriesexpr').value='sin(x)/x';document.getElementById('seriesvarname').value='x';document.getElementById('seriesvarlim').value='0';document.getElementById('seriesvarorder').value='5';document.getElementById('seriesvarstep').value='polynom';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_series_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_limit" style="display:none">
  Limite de :<br>
  expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="limitexpr" title="Expression, par exemple sin(x)/x" rows=1></textarea><br>
  variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="limitvarname" title="Nom de variable, par exemple x" rows=1>x</textarea><br>
  en <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="limitvarlim" title="Valeur limite" rows=1></textarea><br>
  Direction optionnelle <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="limitvardir" title="-1: limite &agrave; gauche, 1: &agrave; droite" rows=1></textarea>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_limit').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('limitexpr').value='';document.getElementById('limitvarname').value='';document.getElementById('limitvarlim').value='';document.getElementById('limitvardir').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('limitexpr').value='sin(x)/x';document.getElementById('limitvarname').value='x';document.getElementById('limitvarlim').value='0';document.getElementById('limitvardir').value='1';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_limit_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_int" style="display:none">
  Int&eacute;grale de <br>
  expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="intexpr" title="Expression, par exemple x^2" rows=1></textarea><br>
  variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="intvarname" title="Nom de variable, par exemple x" rows=1>x</textarea><br>
  de (optionnel) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="intvarmin" title="Borne inf&eacute;rieure" rows=1></textarea><br>
  &agrave; (optionnel) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="intvarmax" title="Borne sup&eacute;rieure" rows=1></textarea>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_int').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('intexpr').value='';document.getElementById('intvarname').value='';document.getElementById('intvarmin').value='';document.getElementById('intvarmax').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('intexpr').value='1/(1+x^2)^2';document.getElementById('intvarname').value='x';document.getElementById('intvarmin').value='';document.getElementById('intvarmax').value='';">Exemple 1</button>
  <button class="bouton" onclick="document.getElementById('intexpr').value='1/(1+x^2)^2';document.getElementById('intvarname').value='x';document.getElementById('intvarmin').value='0';document.getElementById('intvarmax').value='1';">Exemple 2</button>
  <button class="bouton" onclick="UI.assistant_int_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_sum" style="display:none">
  Somme de <br>
  expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="sumexpr" title="Expression, par exemple j^2" rows=1></textarea><br>
  variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="sumvarname" title="Nom de variable, par exemple j" rows=1>j</textarea><br>
  de (optionnel) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="sumvarmin" title="Borne inf&eacute;rieure" rows=1></textarea><br>
  &agrave; (optionnel) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="sumvarmax" title="Borne sup&eacute;rieure" rows=1></textarea>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_sum').style.display='none'">Annuler</button>
  <button class="bouton" onclick="document.getElementById('sumexpr').value='j^2';document.getElementById('sumvarname').value='j';document.getElementById('sumvarmin').value='0';document.getElementById('sumvarmax').value='n';">Exemple</button>
  <button class="bouton"
      onclick="document.getElementById('sumexpr').value='';document.getElementById('sumvarname').value='';document.getElementById('sumvarmin').value='';document.getElementById('sumvarmax').value='';">Effacer</button>
  <button class="bouton" onclick="UI.assistant_sum_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_diff" style="display:none">
  D&eacute;riv&eacute;e de <br>
  expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="diffexpr" title="Expression, par exemple sin(x)^2" rows=1></textarea><br>
  variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="diffvarname" title="Nom de variable, par exemple x" rows=1>x</textarea><br>
  Nombre de d&eacute;riv&eacute;es <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="diffnumber" title="Valeur par d&eacute;faut 1" rows=1>1</textarea><br>
  <br>
<button class="bouton" onclick="UI.focused=UI.savefocused;document.getElementById('assistant_diff').style.display='none'">Annuler</button>
  <button class="bouton" onclick="document.getElementById('diffexpr').value='sin(x)^2';document.getElementById('diffvarname').value='x';document.getElementById('diffnumber').value='';">Exemple 1</button>
  <button class="bouton" onclick="document.getElementById('diffexpr').value='sin(x^2)';document.getElementById('diffvarname').value='x';document.getElementById('diffnumber').value='5';">Exemple 2</button>
  <button class="bouton"
      onclick="document.getElementById('diffexpr').value='';document.getElementById('diffvarname').value='';document.getElementById('diffnumber').value='';">Effacer</button>
  <button class="bouton" onclick="UI.assistant_diff_ok();"><strong>OK</strong></button> 
</div>

<div id="assistant_tabvar" style="display:none">
  Choisir entre &eacute;tude de
  <button class="bouton" onclick="document.getElementById('assistant_tabvarfunc').style.display='block';UI.xtn='x';document.getElementById('assistant_tabvarparam').style.display='none';UI.set_focus('tabvarfuncexpr')">fonction</button>
ou de <button class="bouton"
  onclick="document.getElementById('assistant_tabvarfunc').style.display='none';document.getElementById('assistant_tabvarparam').style.display='block';UI.xtn='t';UI.set_focus('tabvarparamexprx');">courbe
  param&eacute;tr&eacute;e</button>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_tabvar').style.display='none'">Annuler</button><br>  
  <div id="assistant_tabvarfunc" style="display:none">
  &Eacute;tude de fonction (dans la console) et trac&eacute; de <br>
  <textarea rows=1 cols=3 onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarfuncname" title="Nom de fonction" rows=1>f</textarea>(
  <textarea rows=1 cols=2 onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarfuncvarname" title="Nom de variable, par exemple x">x</textarea>)
  :=<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarfuncexpr" title="Expression, par exemple x^2" rows=1></textarea><br>
  xmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarfuncvarmin" title="Minimum" rows=1>-4</textarea><br>
  xmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarfuncvarmax" title="Maximum" rows=1>4</textarea><br>
  xstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarfuncvarstep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.0625</textarea>
  <br>
    Option : <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarfuncopt" title="diff: pas de convexit&eacute;, plot: renvoie le graphe, tabvar: renvoie le tableau de variations, equation ou coordonnees: des points particuliers," rows=1>diff</textarea>
    <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_tabvar').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('tabvarfuncname').value='';document.getElementById('tabvarfuncexpr').value='';document.getElementById('tabvarfuncvarname').value='';document.getElementById('tabvarfuncvarmin').value='';document.getElementById('tabvarfuncvarmax').value='';document.getElementById('tabvarfuncvarstep').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('tabvarfuncname').value='f';document.getElementById('tabvarfuncexpr').value='x/(x^2-1)';document.getElementById('tabvarfuncvarname').value='x';document.getElementById('tabvarfuncvarmin').value='-inf';document.getElementById('tabvarfuncvarmax').value='inf';">Exemple</button>
  <button class="bouton"
  onclick="document.getElementById('assistant_tabvar').style.display='none';document.getElementById('assistant_seq').style.display='block';document.getElementById('seqexpr').value= '['+document.getElementById('tabvarfuncvarname').value+','+document.getElementById('tabvarfuncexpr').value+']';document.getElementById('seqvarname').value=document.getElementById('tabvarfuncvarname').value;var tmp=document.getElementById('tabvarfuncvarmin').value; if(tmp=='-inf') tmp=-5;document.getElementById('seqvarmin').value=tmp;tmp=document.getElementById('tabvarfuncvarmax').value; if(tmp=='inf') tmp=5;document.getElementById('seqvarmax').value=tmp;document.getElementById('seqvarstep').value=document.getElementById('tabvarfuncxstep').value;">Tableau valeurs</button>.
  <button class="bouton" onclick="UI.assistant_tabvarfunc_ok();"><strong>OK</strong></button> 
</div>

  <div id="assistant_tabvarparam" style="display:none">
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarparamnamex" title="Nom de la fonction en abscisse"
  rows=1 cols=3>x1</textarea>
    (<textarea onkeyup="document.getElementById('tabvarparamvarnameshadow').innerHTML=value;" onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarparamvarname" title="Nom de variable, par exemple t"
  rows=1 cols=2>t</textarea>):= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarparamexprx" title="Expression de x(t), par exemple 2*cos(t)" rows=1></textarea><br>
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarparamnamey" title="Nom de la fonction en ordonn&eacute;e"
  rows=1 cols=3>y1</textarea>(<span id="tabvarparamvarnameshadow">t</span>):= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarparamexpry" title="Expression de y(t), par exemple 3*sin(t)" rows=1></textarea><br>
   tmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarparamvarmin" title="Valeur de d&eacute;part" rows=1>-4</textarea><br>
  tmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarparamvarmax" title="Valeur de fin" rows=1>4</textarea><br>
  tstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="tabvarparamvarstep" title="Pas entre 2 &eacute;valuations successives" rows=1>0.0625</textarea>
  <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_tabvar').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('tabvarparamnamex').value='';document.getElementById('tabvarparamnamey').value='';document.getElementById('tabvarparamexprx').value='';document.getElementById('tabvarparamexpry').value='';document.getElementById('tabvarparamvarname').value='';document.getElementById('tabvarparamvarnameshadow').innerHTML='';document.getElementById('tabvarparamvarmin').value='';document.getElementById('tabvarparamvarmax').value='';document.getElementById('tabvarparamvarstep').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('tabvarparamnamex').value='x1';document.getElementById('tabvarparamnamey').value='y1';document.getElementById('tabvarparamexprx').value='cos(2t)';document.getElementById('tabvarparamexprx').value='cos(2t)';document.getElementById('tabvarparamexpry').value='sin(3t)';document.getElementById('tabvarparamvarname').value='t';document.getElementById('tabvarparamvarnameshadow').innerHTML='t';document.getElementById('tabvarparamvarmin').value='-pi';document.getElementById('tabvarparamvarmax').value='pi';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_tabvarparam_ok();"><strong>OK</strong></button> 
</div>

</div>

<div id="assistant_plotfunc" style="display:none">
  Choisir un trac&eacute; de
  <button class="bouton" onclick="document.getElementById('assistant_plotfunc1var').style.display='block';document.getElementById('assistant_plotfunc2var').style.display='none';UI.set_focus('plotfuncexpr');">Courbe</button>
ou  <button class="bouton" onclick="document.getElementById('assistant_plotfunc1var').style.display='none';document.getElementById('assistant_plotfunc2var').style.display='block';UI.set_focus('plotfunc2expr');">Surface</button>
  <div id="assistant_plotfunc1var" style="display:none">
  Expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfuncexpr" title="Expression, par exemple x^2" rows=1></textarea><br>
  variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfuncvarname" title="Nom de variable, par exemple x" rows=1>x</textarea><br>
  xmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfuncvarmin" title="Valeur de d&eacute;part" rows=1>-4</textarea><br>
  xmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfuncvarmax" title="Valeur de fin" rows=1>4</textarea><br>
  xstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfuncvarstep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.0625</textarea>
  <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_plotfunc').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('plotfuncexpr').value='';document.getElementById('plotfuncvarname').value='';document.getElementById('plotfuncvarmin').value='';document.getElementById('plotfuncvarmax').value='';document.getElementById('plotfuncvarstep').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('plotfuncexpr').value='x^2';document.getElementById('plotfuncvarname').value='x';document.getElementById('plotfuncvarmin').value='-4';document.getElementById('plotfuncvarmax').value='4';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_plotfunc1var_ok();"><strong>OK</strong></button> 
</div>

  <div id="assistant_plotfunc2var" style="display:none">
  Expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfunc2expr" title="Expression, par exemple x^2-y^2" rows=1></textarea><br>
  1&egrave;re variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfunc2varx" title="Premi&egrave;re variable, par exemple x=-3..3" rows=1>x=-3..3</textarea><br>
  2&egrave;me variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfunc2vary" title="Deuxi&egrave;me variable, par exemple y=-3..3" rows=1>y=-3..3</textarea><br>
  xstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfunc2varxstep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.25</textarea><br>
  ystep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfunc2varystep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.25</textarea>
  <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_plotfunc').style.display='none'">Annuler</button>
  <button
      onclick="document.getElementById('plotfunc2expr').value='';document.getElementById('plotfunc2varx').value='x';document.getElementById('plotfunc2vary').value='y';document.getElementById('plotfunc2varxstep').value='';document.getElementById('plotfunc2varystep').value='';">Effacer</button>
  <button onclick="document.getElementById('plotfunc2expr').value='x^2-y^2';document.getElementById('plotfunc2varx').value='x=-3..3';document.getElementById('plotfunc2vary').value='-3..3';document.getElementById('plotfunc2varxstep').value='0.25';document.getElementById('plotfunc2varystep').value='0.25';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_plotfunc2var_ok();"><strong>OK</strong></button> 
</div>

</div>

<div id="assistant_plotparam" style="display:none">
  Choisir un trac&eacute; de
  <button class="bouton"
  onclick="document.getElementById('assistant_plotparam1var').style.display='block';document.getElementById('assistant_plotparam2var').style.display='none';UI.set_focus('plotparamexprx');">Courbe</button>
  ou
  <button class="bouton"
  onclick="document.getElementById('assistant_plotparam1var').style.display='none';document.getElementById('assistant_plotparam2var').style.display='block';UI.set_focus('plotparam2exprx');">Surface</button>   param&eacute;trique.
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_plotparam').style.display='none'">Annuler</button><br>
  <div id="assistant_plotparam1var" style="display:none">
  x(t)= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparamexprx" title="Expression de x(t), par exemple 2*cos(t)" rows=1></textarea><br>
  y(t)= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparamexpry" title="Expression de y(t), par exemple 3*sin(t)" rows=1></textarea><br>
  variable<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparamvarname" title="Nom de variable, par exemple t" rows=1>t</textarea><br>
  tmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparamvarmin" title="Valeur de d&eacute;part" rows=1>-4</textarea><br>
  tmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparamvarmax" title="Valeur de fin" rows=1>4</textarea><br>
  tstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparamvarstep" title="Pas entre 2 &eacute;valuations successives" rows=1>0.0625</textarea>
  <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_plotparam').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('plotparamexprx').value='';document.getElementById('plotparamexpry').value='';document.getElementById('plotparamvarname').value='';document.getElementById('plotparamvarmin').value='';document.getElementById('plotparamvarmax').value='';document.getElementById('plotparamvarstep').value='';">Effacer</button>
  <button class="bouton"  onclick="document.getElementById('plotparamexprx').value='cos(2t)';document.getElementById('plotparamexprx').value='cos(2t)';document.getElementById('plotparamexpry').value='sin(3t)';document.getElementById('plotparamvarname').value='t';document.getElementById('plotparamvarmin').value='-pi';document.getElementById('plotparamvarmax').value='pi';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_plotparam_ok();;"><strong>OK</strong></button> 
</div>

  <div id="assistant_plotparam2var" style="display:none">
  x(u,v)= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparam2exprx" title="Expression, par exemple v*cos(u)" rows=1></textarea><br>
  y(u,v)= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparam2expry" title="Expression, par exemple v*sin(u)" rows=1></textarea><br>
  z(u,v)= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparam2exprz" title="Expression, par exemple v" rows=1></textarea><br>
  1&egrave;re variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparam2varx" title="Premi&egrave;re variable, par exemple u=-3..3" rows=1>u=-3..3</textarea><br>
  2&egrave;me variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparam2vary" title="Deuxi&egrave;me variable, par exemple v=-3..3" rows=1>v=-3..3</textarea><br>
  ustep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparam2varxstep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.25</textarea><br>
  vstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotparam2varystep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.25</textarea>
  <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_plotparam').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('plotparam2exprx').value='';document.getElementById('plotparam2expry').value='';document.getElementById('plotparam2exprz').value='';document.getElementById('plotparam2varx').value='u';document.getElementById('plotparam2vary').value='v';document.getElementById('plotparam2varxstep').value='';document.getElementById('plotparam2varystep').value='';">Effacer</button>
  <button class="bouton" onclick="document.getElementById('plotparam2exprx').value='v*cos(u)';document.getElementById('plotparam2expry').value='v*sin(u)';document.getElementById('plotparam2exprz').value='v';document.getElementById('plotparam2varx').value='u=-pi..pi';document.getElementById('plotparam2vary').value='v=-3..3';document.getElementById('plotparam2varxstep').value='pi/32';document.getElementById('plotparam2varystep').value='0.25';">Exemple</button>
  <button class="bouton" onclick="UI.assistant_plotparam2var_ok();"><strong>OK</strong></button> 
</div>

</div>

<div id="assistant_plotimplicit" style="display:none">
  f(x,y)= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotimplicitexprf" title="Expression, par exemple x^3+x-y^2-1" rows=1></textarea><br>
  Variable x<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotimplicitvarx" title="Premi&egrave;re variable, par exemple x=-3..3" rows=1>x=-3..3</textarea><br>
  Variable y<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotimplicitvary" title="Deuxi&egrave;me variable, par exemple y=-3..3" rows=1>y=-3..3</textarea><br>
  xstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotimplicitvarxstep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.25</textarea><br>
  ystep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotimplicitvarystep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.25</textarea><br>
  niveaux=<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotimplicitlevel" title="Niveaux &agrave; tracer: laisser vide pour 0 ou mettre une liste" rows=1></textarea>
  <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_plotimplicit').style.display='none'">Annuler</button>
  <button class="bouton" 
      onclick="document.getElementById('plotimplicitexprf').value='';document.getElementById('plotimplicitvarx').value='x';document.getElementById('plotimplicitvary').value='y';document.getElementById('plotimplicitvarxstep').value='';document.getElementById('plotimplicitvarystep').value='';document.getElementById('plotimplicitlevel').value=''">Effacer</button>
  <button class="bouton" onclick="document.getElementById('plotimplicitexprf').value='x^3-x-y^2-1';document.getElementById('plotimplicitvarx').value='x=-3..3';document.getElementById('plotimplicitvary').value='y=-3..3';document.getElementById('plotimplicitvarxstep').value='0.02';document.getElementById('plotimplicitvarystep').value='0.02';document.getElementById('plotimplicitlevel').value=''">Exemple 1</button>
  <button class="bouton"  onclick="document.getElementById('plotimplicitexprf').value='x^2-y^2';document.getElementById('plotimplicitvarx').value='x=-3..3';document.getElementById('plotimplicitvary').value='y=-3..3';document.getElementById('plotimplicitvarxstep').value='0.02';document.getElementById('plotimplicitvarystep').value='0.02';document.getElementById('plotimplicitlevel').value='[-3,-2,-1,0,1,2,3]'">Exemple 2</button>
  <button class="bouton" onclick="UI.assistant_plotimplicit_ok();"><strong>OK</strong></button> 
</div>


<div id="assistant_plotfield" style="display:none">
  Champ des tangentes pour une &eacute;quation dy/dt=f(t,y) ou un
  syst&egrave;me autonome 2-d d[x,y]/dt=f(x,y)<br>
  f=<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfieldexprf" title="Expression, par exemple x^3+x-y^2-1" rows=1></textarea><br>
  Variable t (ou x)<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfieldvarx" title="Premi&egrave;re variable, par exemple x=-3..3" rows=1>t=-3..3</textarea><br>
  Variable y<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfieldvary" title="Deuxi&egrave;me variable, par exemple y=-3..3" rows=1>y=-3..3</textarea><br>
  xstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfieldvarxstep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.25</textarea><br>
  ystep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfieldvarystep" title="Pas entre 2 &eacute;valuations successives de l'expression" rows=1>0.25</textarea><br>
  init=<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
  id="plotfieldinit" title="Liste de conditions initiales optionnelles" rows=1></textarea>
  <br>
<button class="bouton"
  onclick="UI.focused=UI.savefocused;document.getElementById('assistant_plotfield').style.display='none'">Annuler</button>
  <button class="bouton"
      onclick="document.getElementById('plotfieldexprf').value='';document.getElementById('plotfieldvarx').value='x';document.getElementById('plotfieldvary').value='y';document.getElementById('plotfieldvarxstep').value='';document.getElementById('plotfieldvarystep').value='';document.getElementById('plotfieldinit').value=''">Effacer</button>
  <button class="bouton" onclick="document.getElementById('plotfieldexprf').value='sin(t*y)';document.getElementById('plotfieldvarx').value='t=-3..3';document.getElementById('plotfieldvary').value='y=-3..3';document.getElementById('plotfieldvarxstep').value='0.25';document.getElementById('plotfieldvarystep').value='0.25';document.getElementById('plotfieldinit').value='[[0,1],[0,2]]'">Exemple 1d</button>
  <button class="bouton" onclick="document.getElementById('plotfieldexprf').value='[[0.2,-1],[1,0.2]]*[x,y]';document.getElementById('plotfieldvarx').value='x=-3..3';document.getElementById('plotfieldvary').value='y=-3..3';document.getElementById('plotfieldvarxstep').value='0.25';document.getElementById('plotfieldvarystep').value='0.25';document.getElementById('plotfieldinit').value='seq([0,j],j,-3,3)'">Exemple a 2d</button>
  <button class="bouton" onclick="document.getElementById('plotfieldexprf').value='[[0.2,0.5],[0.5,0.2]]*[x,y]';document.getElementById('plotfieldvarx').value='x=-3..3';document.getElementById('plotfieldvary').value='y=-3..3';document.getElementById('plotfieldvarxstep').value='0.25';document.getElementById('plotfieldvarystep').value='0.25';document.getElementById('plotfieldinit').value='seq([0,j],j,-3,3)'">Exemple b 2d</button>
  <button class="bouton" onclick="UI.assistant_plotfield_ok();"><strong>OK</strong></button> 
</div>

<div contextmenu="cmdmenu" title="F1: aide sur le mot-clef avant le curseur.">
  
  <button style="width:35px;height:35px" id="button_util" onmousedown="event.preventDefault()"
onclick="UI.show_menu();"
  title="Montrer ou cacher les assistants">menu</button>  

  <button style="width:35px;height:35px" id="button_123" onmousedown="event.preventDefault()" 
  onclick="if (document.getElementById('keyboard').style.display=='inline') document.getElementById('keyboard').style.display='none'; else UI.kbdonfuncoff(); if (UI.focusaftereval){ UI.focused.focus(); }"
  title="Montrer ou cacher le clavier scientifique">123</button>

  <button style="width:33px;height:35px;" id="button_gauche" onmousedown="event.preventDefault()" onClick="UI.move_caret_or_focus(UI.focused,-1)"   title="Deplace vers la gauche le curseurC"></button>
  <button type="button" style="width:29px;height:35px;" id="button_droit" onmousedown="event.preventDefault()" onClick="UI.move_caret_or_focus(UI.focused,1)" title="Deplace vers la droite le curseur"></button>

  <button style="width:33px;height:35px;" name="select_button"
  id="select_button" onmousedown="event.preventDefault()"
  onClick="if (UI.focusaftereval) UI.focused.focus(); if (UI.focused.type!='textarea'){UI.focused.execCommand('selectAll'); } else {UI.focused.select(); UI.selection=UI.focused.value;}" title="Selectionne la ligne de commande">sel</button>
  
  <button style="width:33px;height:35px;" id="button_del"
  onmousedown="event.preventDefault()"
onClick="UI.backspace(UI.focused);"
title="Efface 1 caract&egrave;re">del</button>

  <button style="width:37px;height:35px" id="button_cmd" onmousedown="event.preventDefault()"
  onclick="document.getElementById('keyboardfunc').style.display='none'; document.getElementById('keyboard').style.display='none'; UI.assistant_close(); var tmp=document.getElementById('progbuttons'); if(tmp.style.display=='none') tmp.style.display='block'; else {tmp.style.display='none'; UI.focused=cmentree;cmentree.focus();} UI.resizetextarea(cmentree);"
  title="Programmation">prg</button>


<button style="width:35px;height:35px" id="button_help" onmousedown="event.preventDefault()" onClick="UI.completion(cmentree)" title="Donne une aide courte et quelques exemples d'utilisation d'une commande.">?</button>

<button style="width:35px;height:35px;color:green" id="button_ok" onclick="if (UI.assistant_ok()) return; if (UI.focused==cmentree || UI.focused==entree) UI.eval_cmdline(); else {UI.reeval(UI.focused,'');}" title="Evaluer la ligne de commande">
  <strong>ok</strong></button>
&nbsp;
<button id="stop_button" style="height:35px;visibility:hidden" onclick="if (UI.webworker && confirm('Voulez-vous vraiment terminer la session ?')){ UI.webworker.terminate(); UI.busy=0;UI.webworker=0; alert('Session redemarree. Toutes les variables ont ete effacees.');}" title="Termine la session en cours">STOP</button>
<br>
<textarea name="entree" id="entree" title="Taper une commande ici puis Entree pour valider" style="font-size:18px;width:98%"
rows=1 onclick="UI.focused=this;" onkeypress="UI.focused=this; if (event.keyCode!=13 || event.shiftKey) return true;UI.eval_cmdline1(value,true); return false;"></textarea>
</div>
<hr>
<div id="consolediv" style="display:none">
<h1>Console</h1>
<button class="bouton" title="Effacer la console" onclick="var field=document.getElementById('output');field.innerHTML='';document.getElementById('consolediv').style.display='none';">Efface</button>
<button class="bouton" title="Augmenter le nombre de lignes" onclick="var field=document.getElementById('output');var s=field.style.maxHeight; s=s.substr(0,s.length-2);s=eval(s)+20 ;s=s+'px';field.style.maxHeight =s ;">+</button>
<button class="bouton" title="Diminuer le nombre de lignes" onclick="var field=document.getElementById('output');var s=field.style.maxHeight; s=s.substr(0,s.length-2);s=Math.max(eval(s)-20,40) ;s=s+'px';field.style.maxHeight =s ;">-</button>
</div>
<div id="output" style="max-height: 200px; overflow:auto"></div>

<div id="table_3d"  style="display:none">
  <hr>
<table border="0" align="left" summary="">
  <tr>
    <td><button id="boutons_3d0" class="bouton" onclick="
      if(document.getElementById('table_3d').style.display=='none'){
      document.getElementById('table_3d').style.display='inherit';
      }
      else {
      document.getElementById('table_3d').style.display='none';
      }"
      title="Montre ou cache le graphe 3d">Graphe 3d</button>
      <span id="boutons_3d">
      <button class="bouton" onclick="UI.giac_renderer('-')">out</button>
      <button class="bouton" onclick="UI.giac_renderer('+')">in</button>
      <button class="bouton" onclick="UI.giac_renderer('l')"></button>
      <button class="bouton" onclick="UI.giac_renderer('r')"></button>
      <button class="bouton" onclick="UI.giac_renderer('u')"></button>
      <button class="bouton" onclick="UI.giac_renderer('d')"></button>
      </span>
    </td>
  </tr>
  <tr>
    <td> 
      <canvas id='canvas' width=0 height=0
      onmousedown="UI.canvas_pushed=true;UI.canvas_lastx=event.clientX; UI.canvas_lasty=event.clientY;"
      onmouseup="UI.canvas_pushed=false;"   >
      </canvas>
    </td>
  </tr>
</table>
</div>

<div class="emscripten" id="status">Downloading...</div>
<div class="emscripten">
  <progress value="0" max="100" id="progress" hidden=1></progress>  
</div>


<script src="w3data.js"></script>
<div w3-include-html="menufr.js"></div>


<script src="FileSaver.js"></script>

<script src="codemirror.js"></script>
<link rel="stylesheet" href="codemirror.css">
<link rel="stylesheet" href="show-hint.css">
<script src="xcasmode.js"></script>
<script src="matchbrackets.js"></script>
<script src="show-hint.js"></script>
  <style type="text/css">
  .CodeMirror {border: 1px solid black;  height:auto}
  dt {font-family: monospace; color: #666;}
  </style>
  
  <script type='text/javascript'>
  var UI ={
  focusaftereval:true,
  docprefix:"http://www-fourier.ujf-grenoble.fr/%7eparisse/giac/doc/fr/cascmd_fr/",
  base_url:"http://www-fourier.ujf-grenoble.fr/%7eparisse/",
  focused:entree,
  savefocused:entree,
  usecm:true,
  kbdshift:false,
  usemathjax:false,
  prettyprint:true,
  qa:false,
  histcount:0,
  selection:'',
  langue:-1,
  canvas_lastx:0,
  canvas_lasty:0,
  canvas_pushed:false,
  initconfigstring:'',
  xtn:'x', // var name, depends on last app
  sleep:function(miliseconds) {
     var currentTime = new Date().getTime();
     while (currentTime + miliseconds >= new Date().getTime()) {
     }
  },
  is_touch_device:function() {
   return (('ontouchstart' in window)
      || (navigator.MaxTouchPoints > 0)
      || (navigator.msMaxTouchPoints > 0));
  },
  assistant_list:['pour','tantque','solve','rsolve','fixe','test','prog','seq','plotpolar','series','limit','int','sum','diff','tabvarfunc','tabvarparam','plotfunc1var','plotfunc2var','plotparam','plotparam2var','plotimplicit','plotfield','desolve','matr','rand'
    ],
  assistant_close:function(){
    var t=UI.assistant_list;
    var s=t.length;
    for (var i=0;i<s;i++){
      document.getElementById('assistant_'+t[i]).style.display='none';
    }
  },
  assistant_ok:function(){
    var t=UI.assistant_list;
    var s=t.length;
    for (var i=0;i<s;i++){
      var tmp=document.getElementById('assistant_'+t[i]);
      if (tmp.style.display=='block'){
        tmp='UI.assistant_'+t[i]+'_ok()';
        //console.log(tmp);
        eval(tmp); return true;
      }
    }
    return false;
  },
  assistant_pour_ok:function(){
UI.focused=UI.savefocused;var tmp='\npour '+document.getElementById('pourvarname').value+' de '+document.getElementById('pourvarmin').value+' jusque '+document.getElementById('pourvarmax').value; console.log(tmp);UI.insert(UI.focused,tmp);UI.indentline(UI.focused);tmp=document.getElementById('pourvarstep').value; if(tmp.length) UI.insert(UI.focused,' pas '+tmp); UI.insert(UI.focused,' faire\n\nfpour;'); UI.indentline(UI.focused); UI.moveCaretUpDown(UI.focused,-1);UI.indentline(UI.focused);document.getElementById('assistant_boucle').style.display='none';},
  assistant_tantque_ok:function(){
UI.focused=UI.savefocused;UI.insert(UI.focused,'\ntantque '+document.getElementById('tantquecond').value+' faire\n\nftantque;');UI.indentline(UI.focused);UI.moveCaretUpDown(UI.focused,-1);UI.indentline(UI.focused);UI.moveCaretUpDown(UI.focused,-1);UI.indentline(UI.focused);UI.moveCaretUpDown(UI.focused,1);UI.kbdonfuncoff(); document.getElementById('assistant_boucle').style.display='none';},
  assistant_solve_ok:function(){
UI.focused=UI.savefocused;if(document.getElementById('solveC').style.display=='inline' ) UI.insert(UI.focused,'c');if(document.getElementById('solvenum').style.display=='inline' ) UI.insert(UI.focused,'f');UI.insert(UI.focused,'solve('+document.getElementById('solveeq').value);UI.indentline(UI.focused);var tmp=document.getElementById('solvevar').value; if (tmp.length) UI.insert(UI.focused,','+tmp);UI.insert(UI.focused,')'); document.getElementById('assistant_solve').style.display='none';},
  assistant_rsolve_ok:function(){
UI.focused=UI.savefocused;UI.insert(UI.focused,'rsolve('+document.getElementById('rsolveeq').value+','+document.getElementById('rsolvevar').value);var tmp=document.getElementById('rsolveinit').value; if (tmp.length) UI.insert(UI.focused,',['+tmp+']');UI.insert(UI.focused,')'); document.getElementById('assistant_rsolve').style.display='none';document.getElementById('assistant_suites').style.display='none';},
  assistant_desolve_ok:function(){
UI.focused=UI.savefocused;var tmpeq=document.getElementById('desolveeq').value ;var tmpt=document.getElementById('desolvevar').value ;var tmpy=document.getElementById('desolvey').value ; var tmp=document.getElementById('desolveinit').value; if (tmp.length) tmp='desolve(['+tmpeq+','+tmp+']'; else tmp='desolve('+tmpeq; tmp+=','+tmpt+','+tmpy+')';UI.insert(UI.focused,tmp); document.getElementById('assistant_desolve').style.display='none';},
  assistant_fixe_ok:function(){
UI.focused=UI.savefocused;var tmp= document.getElementById('rsolvef').value ;if (tmp.length){tmp+=':='+ document.getElementById('rsolvevarf').value+'->'+document.getElementById('rsolveexpr').value+';\nplotseq('+tmp+'('+document.getElementById('rsolvevarf').value+')';} else tmp='plotseq('+document.getElementById('rsolveexpr').value; tmp+=','+document.getElementById('rsolvevarf').value+'=';var tmp1=document.getElementById('rsolvemin').value;if (tmp1.length) tmp+='['+document.getElementById('rsolveu0').value+','+tmp1+','+document.getElementById('rsolvemax').value+']'; else tmp+=document.getElementById('rsolveu0').value;tmp+=','+document.getElementById('rsolven').value+')'; UI.insert(UI.focused,tmp);document.getElementById('assistant_fixe').style.display='none'; document.getElementById('assistant_suites').style.display='none';},
  assistant_test_ok:function(){UI.focused=UI.savefocused;UI.insert(UI.focused,'\nsi '+document.getElementById('sicond').value+' alors '+document.getElementById('sialors').value);UI.indentline(UI.focused);var tmp=document.getElementById('sisinon').value; if (tmp.length) UI.insert(UI.focused,' sinon '+tmp);UI.insert(UI.focused,' fsi;\n');UI.indentline(UI.focused);UI.kbdonfuncoff(); document.getElementById('assistant_test').style.display='none';},
  assistant_prog_ok:function(){UI.focused=UI.savefocused;var loc=document.getElementById('localvars').value; var fc=document.getElementById('funcname').value; var argu=document.getElementById('argsname').value; var ret=document.getElementById('returnedvar').value;if (loc.length==0) UI.insert(UI.focused,fc+'('+argu+'):='+ret+';'); else { UI.insert(UI.focused,'fonction '+fc+'('+argu+')\n  local '+loc+';\n  \n  retourne '+ret+';\nffonction:;\n');UI.moveCaretUpDown(UI.focused,-3);UI.moveCaret(UI.focused,2);} document.getElementById('assistant_prog').style.display='none';},
  assistant_seq_ok:function(){UI.focused=UI.savefocused;var tmp='seq('+document.getElementById('seqexpr').value+','+document.getElementById('seqvarname').value+','+document.getElementById('seqvarmin').value+','+document.getElementById('seqvarmax').value; UI.insert(UI.focused,tmp);tmp=document.getElementById('seqvarstep').value; if(tmp.length) UI.insert(UI.focused,','+tmp); UI.insert(UI.focused,')');document.getElementById('assistant_seq').style.display='none';},
  assistant_plot_polar:function(){UI.focused=UI.savefocused;var tmp='plotpolar('+document.getElementById('plotpolarexpr').value+','+document.getElementById('plotpolarvarname').value+','+document.getElementById('plotpolarvarmin').value+','+document.getElementById('plotpolarvarmax').value; UI.insert(UI.focused,tmp);tmp=document.getElementById('plotpolarvarstep').value; if(tmp.length) UI.insert(UI.focused,',tstep='+tmp); UI.insert(UI.focused,')');document.getElementById('assistant_plotpolar').style.display='none';},
  assistant_series_ok:function(){UI.focused=UI.savefocused;var tmp='series('+document.getElementById('seriesexpr').value+','+document.getElementById('seriesvarname').value+'='+document.getElementById('seriesvarlim').value+','+document.getElementById('seriesvarorder').value; UI.insert(UI.focused,tmp);tmp=document.getElementById('seriesvarstep').value; if(tmp.length) UI.insert(UI.focused,','+tmp); UI.insert(UI.focused,')');document.getElementById('assistant_series').style.display='none';},
  assistant_limit_ok:function(){UI.focused=UI.savefocused;var tmp='limit('+document.getElementById('limitexpr').value+','+document.getElementById('limitvarname').value+','+document.getElementById('limitvarlim').value; UI.insert(UI.focused,tmp);tmp=document.getElementById('limitvardir').value; if(tmp.length) UI.insert(UI.focused,','+tmp); UI.insert(UI.focused,')');document.getElementById('assistant_limit').style.display='none';},
  assistant_int_ok:function(){UI.focused=UI.savefocused;var tmp=document.getElementById('intexpr').value;if (tmp.length){ tmp='int('+tmp+','+document.getElementById('intvarname').value; UI.insert(UI.focused,tmp);tmp=document.getElementById('intvarmin').value; if(tmp.length) UI.insert(UI.focused,','+tmp+','+document.getElementById('intvarmax').value); UI.insert(UI.focused,')');}else UI.insert(UI.focused,'int(');document.getElementById('assistant_int').style.display='none';},
  assistant_diff_ok:function(){UI.focused=UI.savefocused;var tmp=document.getElementById('diffexpr').value;if (tmp.length){ tmp='diff('+tmp+','+document.getElementById('diffvarname').value; UI.insert(UI.focused,tmp);tmp=document.getElementById('diffnumber').value; if(tmp.length) UI.insert(UI.focused,','+tmp); UI.insert(UI.focused,')');}else UI.insert(UI.focused,'diff(');document.getElementById('assistant_diff').style.display='none';},
  assistant_sum_ok:function(){UI.focused=UI.savefocused;var tmp=document.getElementById('sumexpr').value;if (tmp.length){ tmp='sum('+tmp+','+document.getElementById('sumvarname').value; UI.insert(UI.focused,tmp);tmp=document.getElementById('sumvarmin').value; if(tmp.length) UI.insert(UI.focused,','+tmp+','+document.getElementById('sumvarmax').value); UI.insert(UI.focused,')');}else UI.insert(UI.focused,'sum(');document.getElementById('assistant_sum').style.display='none';},
  assistant_tabvarfunc_ok:function(){UI.focused=UI.savefocused;document.getElementById('assistant_tabvar').style.display='none';document.getElementById('assistant_tabvarfunc').style.display='none'; var tmp=document.getElementById('tabvarfuncname').value;if (tmp.length){tmp+=':='+document.getElementById('tabvarfuncvarname').value+'->'+document.getElementById('tabvarfuncexpr').value+';\n';};tmp=tmp+'tabvar('+document.getElementById('tabvarfuncexpr').value+','+document.getElementById('tabvarfuncvarname').value+','+document.getElementById('tabvarfuncvarmin').value+','+document.getElementById('tabvarfuncvarmax').value;var tmp1=document.getElementById('tabvarfuncopt').value; if(tmp1.length) tmp+=','+tmp1; tmp1=document.getElementById('tabvarfuncvarstep').value; if(tmp1.length) tmp=tmp+',xstep='+tmp1; tmp+=',plot)';UI.insert(UI.focused,tmp);},
  assistant_tabvarparam_ok:function(){UI.focused=UI.savefocused;document.getElementById('assistant_tabvar').style.display='none'; document.getElementById('assistant_tabvarparam').style.display='none'; var varname=document.getElementById('tabvarparamvarname').value; var exprx=document.getElementById('tabvarparamexprx').value ; var expry=document.getElementById('tabvarparamexpry').value ;var tmp=document.getElementById('tabvarparamnamex').value;if (tmp.length) tmp=tmp+':='+varname+'->'+exprx+';\n'+document.getElementById('tabvarparamnamey').value+':='+varname+'->'+expry+';\n';tmp=tmp+'tabvar(['+exprx+','+expry+'],'+varname+'='+document.getElementById('tabvarparamvarmin').value+'..'+document.getElementById('tabvarparamvarmax').value;var tmp1=document.getElementById('tabvarparamvarstep').value; if(tmp1.length) tmp=tmp+',tstep='+tmp1; tmp+=',plot)';UI.insert(UI.focused,tmp);},
  assistant_plotfunc1var_ok:function(){UI.focused=UI.savefocused;document.getElementById('assistant_plotfunc').style.display='none'; document.getElementById('assistant_plotfunc1var').style.display='none'; var tmp='plotfunc('+document.getElementById('plotfuncexpr').value+','+document.getElementById('plotfuncvarname').value+','+document.getElementById('plotfuncvarmin').value+','+document.getElementById('plotfuncvarmax').value;var tmp1=document.getElementById('plotfuncvarstep').value; if(tmp1.length) tmp=tmp+',xstep='+tmp1; tmp+=')';UI.insert(UI.focused,tmp);},
  assistant_plotfunc2var_ok:function(){UI.focused=UI.savefocused;document.getElementById('assistant_plotfunc').style.display='none'; document.getElementById('assistant_plotfunc2var').style.display='none'; var tmp='plotfunc('+document.getElementById('plotfunc2expr').value+',['+document.getElementById('plotfunc2varx').value+','+document.getElementById('plotfunc2vary').value+']';var tmp1=document.getElementById('plotfunc2varxstep').value; if(tmp1.length) tmp=tmp+',xstep='+tmp1;tmp1=document.getElementById('plotfunc2varystep').value; if(tmp1.length) tmp=tmp+',ystep='+tmp1; tmp+=')';UI.insert(UI.focused,tmp);},
  assistant_plotparam_ok:function(){UI.focused=UI.savefocused;document.getElementById('assistant_plotparam').style.display='none';document.getElementById('assistant_plotparam1var').style.display='none'; var tmp='plotparam(['+document.getElementById('plotparamexprx').value+','+document.getElementById('plotparamexpry').value+'],'+document.getElementById('plotparamvarname').value+','+document.getElementById('plotparamvarmin').value+','+document.getElementById('plotparamvarmax').value;var tmp1=document.getElementById('plotparamvarstep').value; if(tmp1.length) tmp=tmp+',tstep='+tmp1; tmp+=',display=cap_flat_line)';UI.insert(UI.focused,tmp);},
  assistant_plotparam2var_ok:function(){UI.focused=UI.savefocused;document.getElementById('assistant_plotparam').style.display='none';document.getElementById('assistant_plotparam2var').style.display='none'; var tmp='plotparam(['+document.getElementById('plotparam2exprx').value+','+document.getElementById('plotparam2expry').value+','+document.getElementById('plotparam2exprz').value+'],['+document.getElementById('plotparam2varx').value+','+document.getElementById('plotparam2vary').value+']';var tmp1=document.getElementById('plotparam2varxstep').value; if(tmp1.length) tmp=tmp+',ustep='+tmp1;tmp1=document.getElementById('plotparam2varystep').value; if(tmp1.length) tmp=tmp+',vstep='+tmp1; tmp+=')';UI.insert(UI.focused,tmp);},
  assistant_plotimplicit_ok:function(){UI.focused=UI.savefocused;document.getElementById('assistant_plotimplicit').style.display='none'; var ctr=document.getElementById('plotimplicitlevel').value; var tmp=document.getElementById('plotimplicitexprf').value+',['+document.getElementById('plotimplicitvarx').value+','+document.getElementById('plotimplicitvary').value+']'; if(ctr.length) tmp='plotcontour('+tmp+','+ctr; else tmp='plotimplicit('+tmp; var tmp1=document.getElementById('plotimplicitvarxstep').value; if(tmp1.length) tmp=tmp+',xstep='+tmp1;tmp1=document.getElementById('plotimplicitvarystep').value; if(tmp1.length) tmp=tmp+',ystep='+tmp1; tmp+=')';UI.insert(UI.focused,tmp);},
  assistant_plotfield_ok:function(){UI.focused=UI.savefocused;document.getElementById('assistant_plotfield').style.display='none'; var ctr=document.getElementById('plotfieldinit').value; var tmp=document.getElementById('plotfieldexprf').value+',['+document.getElementById('plotfieldvarx').value+','+document.getElementById('plotfieldvary').value+']'; if(ctr.length) tmp='plotfield('+tmp+',plotode='+ctr; else tmp='plotfield('+tmp; var tmp1=document.getElementById('plotfieldvarxstep').value; if(tmp1.length) tmp=tmp+',xstep='+tmp1;tmp1=document.getElementById('plotfieldvarystep').value; if(tmp1.length) tmp=tmp+',ystep='+tmp1; tmp+=')';UI.insert(UI.focused,tmp);},
  assistant_plotpolar_ok:function(){UI.focused=UI.savefocused;var tmp='plotpolar('+document.getElementById('plotpolarexpr').value+','+document.getElementById('plotpolarvarname').value+','+document.getElementById('plotpolarvarmin').value+','+document.getElementById('plotpolarvarmax').value; UI.insert(UI.focused,tmp);tmp=document.getElementById('plotpolarvarstep').value; if(tmp.length) UI.insert(UI.focused,',tstep='+tmp); UI.insert(UI.focused,')');document.getElementById('assistant_plotpolar').style.display='none';},
  assistant_rand_setdisplay:function(){
    var form=document.getElementById('assistant_rand');
    if (form.rand_int.checked){
      document.getElementById('chooselawdiv').style.display='none';
      document.getElementById('rand_intdiv').style.display='block';
    } else {
      document.getElementById('chooselawdiv').style.display='block';
      document.getElementById('law_arg').style.display='none';
      document.getElementById('rand_intdiv').style.display='none';
    }
  },
  assistant_matr_maxrows:40,
  assistant_matr_maxcols:6,
  assistant_matr_textarea:-1,
  assistant_matr_source:[], // JS array for spreadsheet, if length==0 matrix
  is_sheet:true,
  sheet_recompute:function(){ // convert to CAS sheet, eval and convert back
    var R=UI.assistant_matr_maxrows;
    if (!UI.is_sheet || R==0) return;
    var s='spreadsheet[';
    for (var i=0;i<R;i++){
      var C=UI.assistant_matr_maxcols;
      s += '[';
      for (var j=0;j<C;j++){
        var field=document.getElementById('matr_case'+i+'_'+j);
        var tmp='['+field.value;
        if (tmp.length==1) tmp += '""';
        s += tmp+',0,0],';
      }
      s +='],';
    }
    s += ']';
    //console.log(s);
    s=UI.caseval_noautosimp(s);
    //console.log(s);
    s=eval(s);
    UI.assistant_matr_source=s;
    //console.log(s);
    if (R>s.length) R=s.length;
    // dispatch to UI
    for (var i=0;i<R;i++){
      var r=s[i];
      var C=r.length;
      if (C>UI.assistant_matr_maxcols) C=UI.assistant_matr_maxcols;
      for (var j=0;j<C;j++){
        var field=document.getElementById('matr_span'+i+'_'+j);
        //console.log(i,j,field,r);
        var tmp=r[j];
        if (tmp === undefined) continue;
        if (r[j].length>1) tmp=tmp[1]; else tmp=tmp[0];
        if (r[j].length==3) tmp=r[j][2];
        // console.log(i,j,tmp);
        if (tmp=='""') tmp='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        field.innerHTML=tmp;
        //console.log(i,j,tmp,field.innerHTML);
        // field.style.display='inline';
      }
    }
    return 1;
  },
  matrix2spreadsheet:function(){
    // convert matrix headers to spreadsheet and store source formulae
    var l=UI.assistant_matr_maxrows;
    var c=UI.assistant_matr_maxcols;
    //console.log(l,c);
    if (c>26){ UI.assistant_matr_maxcols=c=26; }
    for (var j=0;j<c;j++){
      document.getElementById('matr_head_'+j).innerHTML=String.fromCharCode(65+j);
    }
    UI.is_sheet=true;
    UI.sheet_recompute();
    for (var i=0;i<l;i++){
      for (var j=0;j<c;j++){
        //console.log(i,j);
        var field=document.getElementById('matr_span'+i+'_'+j);
        field.style.display='inline';
        field.previousSibling.style.display='none';
      }
    }
  },
  spreadsheet2matrix:function(evaled){
    var l=UI.assistant_matr_maxrows;
    var c=UI.assistant_matr_maxcols;
    if (c>26){ UI.assistant_matr_maxcols=c=26; }
    for (var j=0;j<c;j++){
      document.getElementById('matr_head_'+j).innerHTML=''+j;
    }
    for (var i=0;i<l;i++){
      ligne=UI.assistant_matr_source[i];
      for (var j=0;j<c;j++){
        var tmp=ligne[j][1];
        if (tmp=='""') tmp='';
        var field=document.getElementById('matr_case'+i+'_'+j);
        if (evaled) field.value=tmp;
        field.style.display='inline';
        field.nextSibling.style.display='none';
      }
    }
    UI.is_sheet=false;
  },
  sheet_onfocus:function(field){
   //console.log(field.id,field.previousSibling.id);
   field=field.previousSibling;
   field.style.display='inline';
   field.focus();
   UI.focused=field;
  },
  sheet_set:function(field,value){
    field.value=value;
  },
  assistant_matr_setmatrix:function(l,c){
    // Code de creation de la matrice
    if (l*c>10000){ l=100; c=100;}
    var mydiv=document.getElementById('matr_casediv');
    mydiv.style.maxHeight=window.innerHeight/2+'px';
    mydiv.style.maxWidth=(window.innerWidth-50)+'px';
    mydiv.style.overflow="auto";
    UI.assistant_matr_maxrows=l;
    UI.assistant_matr_maxcols=c;
    var s='<table>\n';
    var h = '<tr><th>@</th>';
    for (var j=0;j<c;++j){
      h+='<th id="matr_head_'+j+'" style="text-align:center">'+j+'</th>';
    }
    h += '</tr>\n';
    s += h;
    for (var i=0;i<l;++i){
      s += '<tr id="matr_ligne'+i+'">';
      s += '<td>'+i+'</td>';
      for (var j=0;j<c;++j){
        var field=document.getElementById('matr_case'+i+'_'+j);
        var oldval='';
        //console.log(i,j,field.value);
        if (field!==null) oldval=field.value;
        if (UI.assistant_matr_textarea>0)
          s+='<td class="matrixcell"><textarea class="matrixcell" \
	    onkeypress="if (event.keyCode!=13) return true; UI.cb_matr_enter(this); return false;" \
	    onclick="UI.focused=this;" onblur="style.display=\'none\';nextSibling.style.display=\'inline\'" onfocus="nextSibling.style.display=\'none\'" \
	    id="matr_case'+i+'_'+j+'">'+oldval+'</textarea><div class="matrixcell" style="display:none;width:20px" onclick="UI.sheet_onfocus(this);" id="matr_span'+i+'_'+j+'"></div></td>';
	else
	  s+='<td class="matrixcell" onclick="UI.sheet_onfocus(lastChild);"><input class="matrixcell" onkeypress="if (event.keyCode!=13) return true; UI.cb_matr_enter(this); return false;" onclick="UI.focused=this;" onblur="style.display=\'none\';nextSibling.style.display=\'inline\'" onfocus="nextSibling.style.display=\'none\'" id="matr_case'+i+'_'+j+'" value="'+oldval+'" /><div class="matrixcell" style="display:none;width:20px" onclick="UI.sheet_onfocus(this);"  id="matr_span'+i+'_'+j+'"></div></td>';
      }
      s += '</tr>\n';
    }
    s += '</table>';
    //console.log(s);
    mydiv.innerHTML=s;
    if (document.getElementById('matr_or_sheet').checked){ UI.matrix2spreadsheet();}
    //console.log(mydiv.innerHTML);
    //mydiv.style.display='none';
  },
  cb_matr_enter:function(field){
    var s='csv2gen("'+field.value+'",string)';
    //console.log(s);
    var se=UI.caseval_noautosimp(s);
    if (se.length>8 && se.substr(0,8)=='matrix[[')
      se=se.substr(6,se.length-6);
    //console.log(se);
    s=field.id;
    var l=s.length,i,j,err;
    for (i=8;i<l;++i){ if (s[i]=='_') break; }
    j=eval(s.substr(i+1,l-i-1));
    i=eval(s.substr(9,i-9));
    var form=document.getElementById('assistant_matr'),nr=form.matr_nrows.value,nc=form.matr_ncols.value;
    try { se=eval(se); } catch(err){ se=UI.caseval_noautosimp(field.value); }
    // console.log(i,j); // position dans la matrice
    if (!Array.isArray(se)){
       UI.sheet_set(field,se);
       i++;
       if (i>=nr){
        i=0; j++; if (j>=nc) j=0; 
       }
       UI.sheet_recompute();
       var tmp='matr_span'+i+'_'+j; // console.log(tmp);
       document.getElementById(tmp).click();
       return;
    }
    else {
      l=se.length;
      if (l==0) return;
      var cell=se[0];
      if (Array.isArray(cell)){
        // remplissage style matrice
        var iend=i+l,j0=j,ishift=i,extend=false;
        if (iend>=UI.assistant_matr_maxnrows) iend=UI.assistant_matr_maxnrows;
        if (iend>form.matr_nrows.value){ extend=true; form.matr_nrows.value=iend;}
        for (;i<iend;++i){
          var ligne=se[i-ishift];
          if (Array.isArray(ligne)){
            var j_=j,jend=j+ligne.length;
            if (jend>=UI.assistant_matr_maxncols) jend=UI.assistant_matr_maxncols;
            if (jend>form.matr_ncols.value){ extend=true;  form.matr_ncols.value=jend; }
            for (;j_<jend;++j_) UI.sheet_set(document.getElementById('matr_case'+i+'_'+j_),ligne[j_-j]);
          }
          else
            UI.sheet_set(document.getElementById('matr_case'+i+'_'+j),ligne);
        }
        if (extend){
          UI.assistant_matr_setdisplay();
          UI.sheet_recompute();
        }
        else {
          //console.log(iend,j0);
          if (iend>=nr) iend=0; if (j0>=nc) j0=0;
          UI.sheet_recompute();
          tmp='matr_span'+iend+'_'+j0;
          document.getElementById(tmp).click();
        }
        return;
      }
      // remplissage ligne i, colonnes j -> j+l-1
      var jend=j+l,shift=j;
      if (jend>=UI.assistant_matr_maxncols) jend=UI.assistant_matr_maxncols;
      for (;j<jend;++j)
        UI.sheet_set(document.getElementById('matr_case'+i+'_'+j),se[j-shift]);
      UI.sheet_recompute();
    }
  },
  adequation:function(form){
   var test;
   for (test=0;test<7;++test){
    if (form.adequation[test].checked) break;
   }
   if (test==6 || test==7){
     document.getElementById('matr').style.display='none';
     document.getElementById('matr_matr').style.display='none';
   }
   else {
    document.getElementById('matr').style.display='block';
     document.getElementById('matr_matr').style.display='block';
   }
  },
  assistant_rand_ok:function(){
document.getElementById('assistant_rand').style.display='none';
document.getElementById('chooselawdiv').style.display='none';
UI.focused=UI.savefocused;
var nr=document.getElementById('rand_nrows').value;
var nc=document.getElementById('rand_ncols').value,tmp;
if (nc<=0)
  tmp='rand(';
else {
  if (nr<=0)
    tmp='ranv('+nc+',';
  else
   tmp='ranm('+nr+','+nc+',';
}
var form=document.getElementById('assistant_rand');
var entier=form.rand_int.checked;
if (entier){
 var nm=document.getElementById('rand_maxint').value;
 tmp += nm+')';
}
else {
   form=document.getElementById('chooselawform');
  tmp += form.rand_law.value;
  if (form.rand_law1.style.display!='none')
    tmp += ','+form.rand_law1.value;
  if (form.rand_law2.style.display!='none')
    tmp += ','+form.rand_law2.value;
  tmp += ')';
}
//console.log(tmp);
UI.insert(UI.focused,tmp);
  },
  assistant_matr_ok:function(){
var stats=document.getElementById('matr_stats').style.display!='none';
var stat12=document.getElementById('matr_stat12').style.display!='none';
var stathyp=document.getElementById('matr_testhyp').style.display!='none';
var fluctu=document.getElementById('risque_alpha').style.display!='none';
document.getElementById('assistant_matr').style.display='none';
document.getElementById('chooselawdiv').style.display='none';
document.getElementById('risque_alpha').style.display='none';
UI.focused=UI.savefocused;
var tmp; 
if (stats && !stat12 && !stathyp){
  var form=document.getElementById('chooselawform');
  tmp=form.rand_law.value;
  if (fluctu) tmp +='_icdf';
  tmp += '(';
  if (form.rand_law1.style.display!='none')
    tmp += form.rand_law1.value+',';
  if (form.rand_law2.style.display!='none')
    tmp += form.rand_law2.value+',';
  if (fluctu){
   var alpha=0.05;
   var alphaf=document.getElementById('adequation_alpha');
   //console.log(alphaf.value); return;
   if (alphaf.value.length) alpha=eval(alphaf.value);
   tmp = tmp+alpha/2+'),'+tmp+(1-alpha/2)+');';
  }
  else {
   var argu=document.getElementById('law_arg');
   tmp += argu.value+')';
  }
  UI.insert(UI.focused,tmp);
  return;
}
var form=document.getElementById('assistant_matr');
var mat=form.matr_name.value;
if (stats && mat.length==0) mat='m_s';
 var nrows=document.getElementById('matr_nrows');
 var ncols=document.getElementById('matr_ncols');
 var maxrows=40,maxcols=6;
 if (ncols.value>maxcols) ncols.value=maxcols;
 if (nrows.value>maxrows) nrows.value=maxrows;
 if (mat.length) tmp=mat+':=';
 if (form.matr_formule.checked){
   tmp+='matrix('+nrows.value+','+ncols.value+',';
   tmp+='(j,k)->';
   var expr=document.getElementById('matr_expr').value;
   //console.log(expr);
   if (!form.matr_start0.checked) expr=UI.caseval('subst('+expr+',[j,k],[j+1,k+1])');
   tmp += expr;
   tmp +=')';
 }
 else {
  tmp += '[';
  for (var i=0;i<nrows.value;i++){
   tmp += '[';
   for (var j=0;j<ncols.value;j++){
     //console.log(j,tmp);
     var val=document.getElementById('matr_case'+i+'_'+j).value;
     if (UI.is_sheet && i<UI.assistant_matr_source.length){
       var ligne=UI.assistant_matr_source[i];
       if (j<ligne.length){
         ligne=ligne[j];
         if (ligne.length>1){
           ligne=ligne[1];
           if (ligne!='""') val=ligne;
         }
       }
     }
     if (val.length>0) tmp+=val; else tmp+='0';
     if (j<ncols.value-1) tmp+=',';
   }
   tmp += ']';
   if (i<nrows.value-1) tmp+=',\n';
  }
  tmp += ']'; 
 }
if (stats){
  tmp += ':;\n';
  var submat=mat+'['+form.stat_lmin.value+'..'+form.stat_lmax.value+','+form.stat_cmin.value+'..'+form.stat_cmax.value+']';
  if (stat12){
   if (form.stat_mean.checked) tmp+='mean('+submat+');';
   if (form.stat_stddev.checked) tmp+='stddev('+submat+');';
   if (form.stat_quartiles.checked) tmp+='quartiles('+submat+');';
   if (form.stat_histo.checked) tmp+='histogram('+submat+',0,1);';
   if (form.stat_moustache.checked) tmp+='moustache('+submat+');';
   if (form.stat_scatter.checked) tmp+='scatterplot('+submat+');';
   if (form.stat_polygonscatter.checked) tmp+='polygonscatterplot('+submat+');';
   if (form.stat_linreg.checked) tmp+='linear_regression_plot('+submat+');';    
  }
  else {
   var alpha=0.05,test,hyp,mu=form.adequation_mu.value,sigma=0,dof=1;
   if (form.adequation_alpha.value.length)
     alpha=form.adequation_alpha.value;
   if (form.adequation_sigma.value.length)
     sigma=form.adequation_sigma.value;
   for (test=0;test<7;++test){
    if (form.adequation[test].checked) break;
   }
   for (hyp=0;hyp<3;++hyp){
     if (form.adequation_alt[hyp].checked) break;
   }
   if (test==0) tmp += 'chisquaret(';
   if (test==1) tmp += 'kolmogorovt(';
   if (test==2) tmp += 'wilcoxont(';
   var l1=form.stat_lmin.value,l2=form.stat_lmax.value,
       c1=form.stat_cmin.value,c2=form.stat_cmax.value;
   if (test>=0 && test<=2){
     if (l2-l1>c2-c1){ // lines
        tmp += mat+'['+l1+'..'+l2+','+c1+'],';
        tmp += mat+'['+l1+'..'+l2+','+c2+']';
        dof=l2-l1;
     }
     else {
        tmp += mat+'['+l1+','+c1+'..'+c2+'],';
        tmp += mat+'['+l2+','+c1+'..'+c2+']';
        dof=c2-c1;
     }
     if (test==2){
      if (hyp==0) tmp += ',\'<\'';
      if (hyp==1) tmp += ',\'!=\'';
      if (hyp==2) tmp += ',\'>\'';
      tmp += ','+alpha;
     }
     tmp += ');';
   }
   if (test==0) tmp += 'chisquare_icdf('+dof+','+(1-alpha)+');';
   if (test==3) tmp += 'normalt(';
   if (test==4) tmp += 'studentt(';
   if (test==6){
     var n=form.confiance_n.value,p=form.confiance_p.value;
     var coeff='1/2';
     if (n>100) coeff='sqrt('+(n/(n-1)*p*(1-p))+')';
     tmp='p:='+p+';sigma:='+coeff+'*normald_icdf(0,1,'+(1-alpha/2)+')/sqrt('+n+');';
     tmp +='[p-sigma,p+sigma];';
     if (n*p<5 || n*(1-p)<5) tmp="Erreur : n*p et n*(1-p) doivent etre plus grand que 5"; 
     UI.insert(UI.focused,tmp);
     return;
   }
   if (test==7){
      var n=form.confiance_n_.value,mu=form.confiance_mu.value,sigma=form.confiance_sigma.value;
      tmp = 'mu:='+mu+'; sigma:='+sigma+';';
      tmp += 'delta:=sigma/sqrt('+n+')*student_icdf('+n+','+(1-alpha/2)+');';
      tmp += '[mu-delta,mu+delta]';
   }
   if (test==5){
      tmp += 'mu:=mean(flatten('+submat+'));'
      dof=(c2-c1+1)*(l2-l1+1)-1;
      tmp += 'delta:=stddevp(flatten('+submat+'))/sqrt('+dof+')*student_icdf('+dof+','+(1-alpha/2)+');';
      tmp += '[mu-delta,mu+delta]';
   }
   if (test==3 || test==4){
     tmp += 'flatten('+submat+'),'+mu+',';
     if (sigma>0)
       tmp += sigma+',';
     if (hyp==0) tmp += '\'<\'';
     if (hyp==1) tmp += '\'!=\'';
     if (hyp==2) tmp += '\'>\'';
     tmp += ','+alpha+')';
   }
  }
}
//console.log(tmp);
UI.insert(UI.focused,tmp);
},
  assistant_matr_setdisplay:function(){
    document.getElementById('matr_matr').style.display='block';
    document.getElementById('chooselawdiv').style.display='none';
    var form=document.getElementById('assistant_matr');
    if (form.matr_nrows.value<0) form.matr_nrows.value=0;
    if (form.matr_ncols.value<0) form.matr_ncols.value=0;
    if (document.getElementById('matr_stats').style.display!='none'){
      if (form.matr_nrows.value<1) form.matr_nrows.value=1;
      if (form.matr_ncols.value<1) form.matr_ncols.value=1;
      if (form.stat_lmax.value>=form.matr_nrows.value)
        form.stat_lmax.value=form.matr_nrows.value-1;
      if (form.stat_lmin.value>=form.matr_nrows.value)
        form.stat_lmin.value=form.matr_nrows.value-1;
      form.stat_lmax.max=form.matr_nrows.value-1;
      form.stat_lmin.max=form.matr_nrows.value-1;
      if (form.stat_cmax.value>=form.matr_ncols.value)
        form.stat_cmax.value=form.matr_ncols.value-1;
      if (form.stat_cmin.value>=form.matr_ncols.value)
        form.stat_cmin.value=form.matr_ncols.value-1;
      form.stat_cmax.max=form.matr_ncols.value-1;
      form.stat_cmin.max=form.matr_ncols.value-1;
    }
    form.matr_ncols.max=UI.assistant_matr_maxncols;
    form.matr_nrows.max=UI.assistant_matr_maxnrows;
    if (form.matr_formule.checked){
      document.getElementById('matr_formulediv').style.display='block';
      UI.set_focus('matr_expr');
      document.getElementById('matr').style.display='none';
    } else {
      document.getElementById('matr_formulediv').style.display='none';
      document.getElementById('matr').style.display='block';
      var nrows=document.getElementById('matr_nrows');
      var ncols=document.getElementById('matr_ncols');
      var maxrows=UI.assistant_matr_maxrows,maxcols=UI.assistant_matr_maxcols;
      //console.log(nrows.value,maxrows,ncols.value,maxcols);
      if (ncols.value<1) ncols.value=1;
      if (ncols.value>maxcols) ncols.value=maxcols;
      if (nrows.value<1) nrows.value=1;
      if (nrows.value>maxrows) nrows.value=maxrows;
      //console.log("matr",nrows.value,ncols.value);
      var matr=[];
      matr.length=maxrows;
      for (var j=0;j<maxcols;j++){
        var tmp=document.getElementById('matr_head_'+j);
        if (j<ncols.value) tmp.style.visibility='visible'; else tmp.style.visibility='hidden';
      }
      for (var i=0;i<maxrows;i++){
        //document.getElementById('matr_ligne'+i).style.visibility='hidden';
        document.getElementById('matr_ligne'+i).style.display='none';
        var ligne=[];
        ligne.length=maxcols;
        for (var j=0;j<maxcols;j++){
          ligne[j]=document.getElementById('matr_case'+i+'_'+j);
          ligne[j].style.display='none';
          //console.log(j,ligne[j].parentNode.style.display);
          ligne[j].parentNode.style.display='none';
          ligne[j].nextSibling.style.display='none';
        }
        matr[i]=ligne;
      }
      for (var i=0;i<nrows.value;i++){
        //document.getElementById('matr_ligne'+i).style.visibility='visible';
        document.getElementById('matr_ligne'+i).style.display='table-row';
        if (UI.is_sheet){
         for (var j=0;j<ncols.value;j++){
           matr[i][j].nextSibling.style.display='inline';
           matr[i][j].parentNode.style.display='';
         }
        }
        else {
         for (var j=0;j<ncols.value;j++){
           matr[i][j].style.display='inline';
           matr[i][j].parentNode.style.display='';
         }
        }
      }
      //UI.set_focus(matr[0][0]);
    }
  },
  toggleshift:function(){
    UI.kbdshift=!UI.kbdshift;
    if (UI.kbdshift){
      document.getElementById('shift_key').style.backgroundColor="white";
      document.getElementById('add_ln').value="exp";
      document.getElementById('add_sin').value="asin";
      document.getElementById('add_cos').value="acos";
      document.getElementById('add_tan').value="atan";
      document.getElementById('add_newline').value="\\n";
      document.getElementById('add_,').value="'";
      document.getElementById('add_:').value="!";
      document.getElementById('add_semi').value="\"";
      document.getElementById('add-=').value="_";
      document.getElementById('add_inferieur').value=">";
      document.getElementById('add_sqrt').value="^2";
      document.getElementById('add_left_[').value="{ }";
      document.getElementById('add_/').value="%";
    }
    else {
      document.getElementById('shift_key').style.backgroundColor="cyan";
      document.getElementById('add_ln').value="ln";
      document.getElementById('add_sin').value="sin";
      document.getElementById('add_cos').value="cos";
      document.getElementById('add_tan').value="tan";
      document.getElementById('add_newline').value=" ";
      document.getElementById('add_,').value=",";
      document.getElementById('add_:').value=":=";
      document.getElementById('add_semi').value=";";
      document.getElementById('add-=').value="=";
      document.getElementById('add_inferieur').value="<";
      document.getElementById('add_sqrt').value="√";
      document.getElementById('add_left_[').value="[ ]";
      document.getElementById('add_/').value="/";
    }
  },
  switchcm:function(){
  if (UI.usecm){
    if (cmentree==entree){
     // cmentree may be released with cmentree.toTextArea();
     cmentree=CodeMirror.fromTextArea(entree,{
      matchBrackets: true,
      lineNumbers: true,
      viewportMargin: Infinity
    });
     //console.log(entree.type);
     //cmentree.setSize(window.innerWidth-20,40);
     cmentree.on("focus",function(cm){ UI.set_focused(cm); });
     cmentree.on("blur",function(cm) { if (cm.getSelection().length > 0){UI.selection=cm.getSelection();} });
     cmentree.setValue(entree.value);
     UI.changefontsize(cmentree,18);
     cmentree.setOption("extraKeys", {
      Enter: function(cm){
      UI.eval_cmdline();
     },
     F1: function(cm) {
      UI.completion(cm);
     },
     Tab: function(cm) {
      UI.completion(cm);
     },
    });
   } // if (UI.usecm)
  } else { if (cmentree!=entree) cmentree.toTextArea(); cmentree=entree; }
   cmentree.focus();
 },
  kbdonfuncoff:function() {
     UI.savefocused=UI.focused;
    document.getElementById('keyboard').style.display='inline';
    document.getElementById('keyboardfunc').style.display='none';
  },
  restorefrom:function(c){
    var s=UI.readCookie(c);
    //console.log(s);
    UI.restoresession(s,document.getElementById('mathoutput'),true,false);
    document.getElementById('loadfile_cookie').innerHTML='';
  },
  listCookies:function() { // list cookies with name begin == ' xcas__'
    var theCookies = document.cookie.split(';');
    var aString = '';
    for (var i = 0 ; i < theCookies.length; i++) {
        // console.log(i,theCookies[i].substr(0,7));
        var tmp=theCookies[i];
        var pos=tmp.search('=');
        if (pos>7 && tmp.substr(0,7)==' xcas__' ){
          var tmpname=tmp.substr(7,pos-7);
          aString += "<button onclick=\"UI.restorefrom('"+tmp.substr(1,pos-1)+"')\">"+tmpname+"</button>\n";
        }
    }
    aString += "<button onclick=document.getElementById('loadfile_cookie').innerHTML=''>annuler</button>\n"
    //console.log(aString);
    return aString;
  },
  createCookie:function(name,value,days) {
	if (days) {
	  var date = new Date();
	  date.setTime(date.getTime()+(days*24*60*60*1000));
	  var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
  },
  readCookie:function(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
          var c = ca[i];
	  while (c.charAt(0)==' ') c = c.substring(1,c.length);
	  if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
  },
  eraseCookie:function(name) {
	createCookie(name,"",-1);
  },
  detectmob:function() { 
 if( navigator.userAgent.match(/Android/i)
 || navigator.userAgent.match(/webOS/i)
 || navigator.userAgent.match(/iPhone/i)
 || navigator.userAgent.match(/iPad/i)
 || navigator.userAgent.match(/iPod/i)
 || navigator.userAgent.match(/BlackBerry/i)
 || navigator.userAgent.match(/Windows Phone/i)
 ) return true;
 else 
    return false;
},
  browser_type: function(){
   var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
   var isFirefox = typeof InstallTrigger !== 'undefined';   // Firefox 1.0+
   var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
   var isChrome = !!window.chrome && !isOpera;              // Chrome 1+
   var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
   if (isFirefox) return 1;
   if (isSafari) return 2;
   if (isChrome) return 3;
   if (isIE) return 4;
   if (isOpera) return 5;
   return 0;
  },
  lowercase1: function(text){
   var value=text;
   if (value.length && value.charCodeAt(0)>64 && value.charCodeAt(0)<90)
     value = value.substr(0,1).toLowerCase()+value.substr(1,value.length-1);
   return value;
  },
  caseval: function(text){
   var docaseval = Module.cwrap('caseval',  'string', ['string']);
   var value=text;
   value=value.replace(/%22/g,'\"'); 
   var n=value.search(';');
   if (n<0 || n>=value.length)
     value='add_autosimplify('+value+')';
   var s,err;
   try {s=docaseval(value); } catch(err){ console.log(err); }
   // Module.print(text+ ' '+s);
   return s;
  },
  caseval_noautosimp: function(text){
   var docaseval = Module.cwrap('caseval',  'string', ['string']);
   var value=text;
   value=value.replace(/%22/g,'\"'); 
   var s,err;
   try {s=docaseval(value); } catch(err){ console.log(err); }
   return s;
  },
  webworker:0,
  withworker:0,
  busy:0,
  casevalcb: function(text,callback,args){
   // prepare for webworker: casevalcb will run docaseval in a worker
   // 3d plotting does not work...
   if (UI.withworker && !!window.Worker) {
     if (!UI.webworker){
      UI.webworker = new Worker("giacworker.js");
      console.log('worker created ');
      UI.webworker.onmessage =  function(e){
       var s=e.data[1];
       if (e.data[0]=='cas') Module.print(s);
       if (e.data[0]=='print') Module.print(s);
      }
     }
     // the worker will do the evaluation and post s
     UI.webworker.onmessage =  function(e){
       var s=e.data[1]; UI.busy=0;
       if (e.data[0]=='cas') callback(s,args);
       if (e.data[0]=='print') Module.print(s);
     }
     UI.busy=1;
     UI.webworker.postMessage(['eval',text]);
     return;
     // STOP: myWorker.terminate()
   }
   var docaseval = Module.cwrap('caseval',  'string', ['string']);
   var value=text;
   var n=value.search(';');
   if (n<0 || n>=value.length)
     value='add_autosimplify('+value+')';
   var s,err;
   try {s=docaseval(value); } catch(err){ }
   // Module.print(text+ ' '+s);
   callback(s,args);
  },
  ckenter: function(event,field){
    var key = event.keyCode;
    if (key != 13 || event.shiftKey) return true;
    UI.reeval(field,'');
    return false;
  },
restoresession: function(chaine,hist,asked,doexec){
//console.log(chaine);
var hashParams=chaine.split('&');
 if (hashParams.length==0) return;
 for(var i = 0; i < hashParams.length; i++){
    var s = hashParams[i];
    if (s.length)  document.getElementById('startup_restore').style.display='none';
    s=decodeURIComponent(s); //console.log(s);
    // s=s.replace('%0a','\n','g');
    s=s.replace(/%3b/g,';'); 
    // s=s.replace('%3b',';','g'); 
    // s=s.replace('%3C','<','g'); 
    // s=s.replace('%3e','>','g');
    // s=s.replace('%5e','^','g');
    // s=s.replace('%20',' ','g');
    // s=s.replace('%27','\'','g');
    // s=s.replace('%22','\"','g');
    // s=s.replace('%C3%A9','é','g'); 
    // s=s.replace('%C3%A8','è','g'); 
    if (s.length && s.charAt(0)=='+'){
       if (!asked) doexec=true;
       s=s.substr(1);
       if (s.length) UI.eval_cmdline1(s,false);
       continue;
    }
    if (s.length && s.charAt(0)=='*'){
       if (!asked) doexec=true;
       var pos=s.search(',');
       var name=s.substr(1,pos-1);
       // Module.print(name);
       s=s.substr(pos+1,s.length-pos-1);
       pos=s.search(',');
       var value=s.substr(0,pos);
       // Module.print(value);
       s=s.substr(pos+1,s.length-pos-1);
       pos=s.search(',');
       var mini=s.substr(0,pos);
       // Module.print(mini);
       s=s.substr(pos+1,s.length-pos-1);
       pos=s.search(',');
       var maxi=s.substr(0,pos);
       // Module.print(maxi);
       s=s.substr(pos+1,s.length-pos-1);
       UI.addcurseur(name,value,mini,maxi,s);
       continue;
    }
    var p = s.split('=');
    if (p[0]=='') continue;
    if (p[0]=='entree' || p[0]=='cmentree'){
      cmentree.setValue( decodeURIComponent(p[1]));
      continue;
    }
    if (p[0]=='codemirror'){
      if (p[1]=='0') { document.getElementById('config').usecm.checked=false;  UI.set_config();}
      if (p[1]=='1') { document.getElementById('config').usecm.checked=true;  UI.set_config();}
      continue;
    }
    document.getElementById(p[0]).value = decodeURIComponent(p[1]);
  } // end for (i=...)
 if (doexec) UI.exec(hist,0);
 },
  link: function(start){
   var s=UI.makelink(start);
   //console.log(s);
   UI.createCookie('xcas_session',s,365);
   if (s.length>0){
     s = UI.base_url+"xcasfr.html#"+s;
     //Module.print(s);
     document.getElementById('thelink').innerHTML='<a href="'+s+'" target="_blank">Cloner</a>';
     document.getElementById('themailto').innerHTML='<a href="mailto:?subject=session Xcas&body=Bonjour%0d%0aVeuillez suivre ce lien : '+UI.rewritestring(s)+'">E-mail</a>';
   }
  },
  rewritestring: function(s){
    var res,i,l;
    l=s.length; res='';
    for (i=0;i<l;++i){
      if (s[i]=='&'){ res += "%26"; continue; }
      if (s[i]=='#'){ res += "%23"; continue; }
      res += s[i];
    }
    return res;
  },
  makelink: function(start){
    var s='';
    var cur=document.getElementById('mathoutput').firstChild;
    var i=0;
    for (;cur;i++){
     if (i>=start){
       var field=cur.firstChild;
       field=field.firstChild;
       field=UI.skip_buttons(field);
       var fs=field.innerHTML;
       if (fs.length>5){
         var fs1=fs.substr(0,5);
         if (fs1=="<form") {
          //Module.print(fs);
          var pos1=fs.search("<input");
          fs=fs.substr(pos1,fs.length-pos1);
          var pos1=fs.search("value=");
          pos1 += 7;
          fs=fs.substr(pos1,fs.length-pos1);
          var pos2=fs.search("\"");
          fs1=fs.substr(0,pos2); // cursor name
          var pos1=fs.search("value=");
          pos1 += 7;
          fs=fs.substr(pos1,fs.length-pos1);
          var pos2=fs.search("\"");
          fs1 += ','+fs.substr(0,pos2); // current value
          var pos1=fs.search("value="); 
          pos1 += 7;
          fs=fs.substr(pos1,fs.length-pos1);
          var pos1=fs.search("value=");
          pos1 += 7;
          fs=fs.substr(pos1,fs.length-pos1);
          var pos2=fs.search("\"");
          fs1 += ','+fs.substr(0,pos2); // min
          var pos1=fs.search("value=");
          pos1 += 7;
          fs=fs.substr(pos1,fs.length-pos1);
          var pos1=fs.search("value=");
          pos1 += 7;
          fs=fs.substr(pos1,fs.length-pos1);
          var pos1=fs.search("value=");
          pos1 += 7;
          fs=fs.substr(pos1,fs.length-pos1);
          var pos2=fs.search("\"");
          fs1 += ','+fs.substr(0,pos2); //max
          var pos1=fs.search("value=");
          pos1 += 7;
          fs=fs.substr(pos1,fs.length-pos1);
          var pos2=fs.search("\"");
          fs1 += ','+fs.substr(0,pos2); // step
          s += '*' + fs1 +'&';
          cur=cur.nextSibling;
          continue;
         }
       }
       var pos=fs.search("<textarea");
       if (pos>=0 && pos<fs.length){
         // var tmp=field.firstChild.value.replace(/\n/g,'%0a'); tmp=tmp.replace(';','%3b','g');
         // s += '+' + tmp.replace('&&',' and ','g') + '&';
         var tmp=encodeURIComponent(field.firstChild.value);
         s += '+' + tmp + '&';
         cur=cur.nextSibling;
         continue;
       }
       pos = fs.search("UI.addhelp");
       if (pos>=0 && pos<fs.length){ cur=cur.nextSibling; continue; }
       s += '+//'+fs+'&';
     }
     cur=cur.nextSibling;
   }
   // Module.print(s);
   s=s.replace(/\"/g,'%22');
   s=s.replace(/>/g,'%3e');
   return s;
  },
  canvas_mousemove:function(event,no){
    if (UI.canvas_pushed){
      // Module.print(event.clientX);
      if (UI.canvas_lastx!=event.clientX){
        if (event.clientX>UI.canvas_lastx)
          UI.giac_renderer('r'+no);
        else
          UI.giac_renderer('l'+no);
        UI.canvas_lastx=event.clientX;
      }
      if (UI.canvas_lasty!=event.clientY){
        if (event.clientY>UI.canvas_lasty)
          UI.giac_renderer('d'+no);
        else
          UI.giac_renderer('u'+no);
        UI.canvas_lasty=event.clientY;
      }
    }
  },
show_menu:function(){
 if (document.getElementById('keyboardfunc').style.display=='inline'){
  document.getElementById('keyboardfunc').style.display='none';
 }
 else {
  document.getElementById('keyboardfunc').style.display='inline';
  document.getElementById('keyboard').style.display='none';
  document.getElementById('progbuttons').style.display='none';
  var tab=['boucle','seq','rand','series','int','sum','limit','plotfunc','plotparam',
           'plotpolar','plotimplicit','plotfield','tabvar','test','prog','solve',
           'rsolve','diff','matr','suites','desolve'];
  var s=tab.length,k;
  for (k=0;k<s;++k){
    var tmp=document.getElementById('assistant_'+tab[k]);
    if (tmp.style.display=='block'){
      tmp.style.display='none';
      UI.focused=UI.savefocused;
    }
  }
 }
 if (UI.focusaftereval){ UI.focused.focus(); }
},
  show_config:function(){
    var form=document.getElementById('config');
    form.style.display='inline';
  },
  set_config_width:function(){
   var form=document.getElementById('config');
   var hw=window.innerWidth,hh=window.innerHeight;
   if (hw>=1000){ hw=hw-50; UI.focusaftereval=true;}
   if (hw<=500){ UI.focusaftereval=false; document.getElementById('exportbutton').style.display='none';}
   form.history_width.value=hw;
   form.outdiv_width.value=Math.floor(hw/2);
   document.getElementById('mathoutput').style.maxWidth=hw;
   document.getElementById('divoutput').style.maxHeight=form.history_height.value;
   var w=form.outdiv_width.value,h;
   // Module.print(hw);Module.print(w);
   if (w>hw-300) w=hw-300;
   var hi=hw-w-200;
   if (!UI.qa){ hi=hw-130; w=hi; }
   var hb=25; if (hh>=400) hb=29; if (hh>=500) hb=33; if (hh>600) hb=37;
   s='h1,h2,h3 { display:inline; font-size:1em;}\ninput[type="number"] { width:40px;}\n .outdiv { width:'+w+'px; max-height: '+form.outdiv_height.value+'px;  overflow: auto;}\n.filenamecss {width:120px;height:20px}\n.historyinput {width:'+hi+'px;}\n.bouton{height:'+hb+'px;}';
   // console.log(s);// Module.print(s);
   var st=document.getElementById('document_style');
   st.innerHTML=s;
var kbd_l=["add_newline","add_left_paren",
"add_i","add_7" ,"add_8" ,"add_9" ,"add_/",
"add_semi" ,"add_left_[" ,"add_pi" ,
"add_4" ,"add_5" ,"add_6" ,"add_*" ,"add_beg","add_end","add_:",
"add_,","add_∞","add_1" ,"add_2" ,
"add_3" ,"add_-" ,"copy_button" ,"curseur_up","add-=" ,
"add_right_paren","add_ln","add_e","add_0" ,"add_." ,
"add_+" ,"add_inferieur","curseur_down" ,"shift_key" ,"add_sin" ,"add_cos",
"add_tan","add_sqrt","add_^"];
var kbd_cmd=["button_ok","button_help","button_123","button_util","button_cmd",
"button_gauche","button_droit","select_button","button_del"];
var kbd_util=["add_simplify" ,"add_matr",
"add_factor" ,"add_stats","add_tcollect","add_texpand","add_solve","add_polar",
"add_linsolve","add_rand" ,"add_desolve" ,"add_rsolve" ,"add_sum","add_diff",
"add_integrate" ,"add_limit","add_series","add_seq","add_tabvar","add_plot",
"add_plotparam" ,"add_plotfield","add_plotimplicit","add_curseur",
"add_//","add_space","add_nlprog","add_indent","add_test",
"add_boucle","add_function","add_debug"];
   w=Math.floor(hw/12); w=w+"px"; 
   h=Math.floor(hh/20); if (h<30) h=30; h=h+"px"; // console.log(hw,w,hh,h);
   for (var i=0;i<kbd_l.length;i++){
     document.getElementById(kbd_l[i]).style.width=w;
     document.getElementById(kbd_l[i]).style.height=h;
   }
   w=Math.floor(hw/11)-1; if (w<33) w=33; w=w+"px"; 
   h=Math.floor(hh/20); if (h<35) h=35; h=h+"px"; // console.log(hw,w,hh,h);
   for (var i=0;i<kbd_cmd.length;i++){
     document.getElementById(kbd_cmd[i]).style.width=w;
     document.getElementById(kbd_cmd[i]).style.height=h;
   }
   w=Math.floor(hw/10); if (w<34) w=34; w=w+"px"; 
   h=Math.floor(hh/20); if (h<35) h=35; h=h+"px"; // console.log(hw,w,hh,h);
   for (var i=0;i<kbd_util.length;i++){
     document.getElementById(kbd_util[i]).style.width=w;
     document.getElementById(kbd_util[i]).style.height=h;
   }
  },
  config_string:function(){
   var form=document.getElementById('config');
   if (form.qa.checked) UI.qa=true; else UI.qa=false;
   if (form.usecm.checked) UI.usecm=true; else UI.usecm=false; UI.switchcm();
   UI.set_config_width();
   var s;
   var st=document.getElementById('document_style');
   if (form.online_doc.checked)
     UI.docprefix=UI.base_url+'giac/doc/fr/cascmd_fr/';
   else
     UI.docprefix="file://"+form.doc_path.value;
   if (form.prettyprint.checked) UI.prettyprint=true; else UI.prettyprint=false;
   if (form.worker_mode.checked){
     if (!UI.withworker) alert('Session redemarree (variables remises a 0). Les calculs seront faits par un worker.'); UI.withworker=true;
   } else {
     if (UI.withworker) alert('Session redemarree (variables remises a 0).');
     UI.withworker=false;
   }
   if (UI.withworker) document.getElementById('stop_button').style.visibility='visible'; else document.getElementById('stop_button').style.visibility='hidden';
   UI.caseval("autosimplify("+form.autosimp_level.value+")");
   //Module.print(st.innerHTML);
   s='Digits:=';
   s += form.digits_mode.value;
   s += '; angle_radian:=';
   if (form.angle_mode.checked) s += 1; else s += 0;
   s += '; complex_mode:=';
   if (form.complex_mode.checked) s += 1; else s += 0;
   s += '; with_sqrt(';
   if (form.sqrt_mode.checked) s += 1; else s += 0;
   s += '); step_infolevel(';
   if (form.step_mode.checked) s += 1; else s += 0;
   s += ');';
   // Module.print(s);
   return s;
  },
  set_config:function(){
   var form=document.getElementById('config');
   var s=UI.config_string();
   //console.log(s);
   UI.addhelp(' ',s);
   document.getElementById('config').style.display='none';
   if (UI.focusaftereval) UI.focused.focus();
   UI.createCookie('xcas_digits',form.digits_mode.value,10000);
   UI.createCookie('xcas_angle_radian',form.angle_mode.checked?1:-1,10000);
   UI.createCookie('xcas_complex_mode',form.complex_mode.checked?1:-1,10000);
   UI.createCookie('xcas_with_sqrt',form.sqrt_mode.checked?1:-1,10000);
   UI.createCookie('xcas_step_infolevel',form.step_mode.checked?1:-1,10000);
   UI.createCookie('xcas_autosimplify',form.autosimp_level.value,10000);
   UI.createCookie('xcas_docprefix',UI.docprefix,10000);
   UI.createCookie('xcas_withworker',UI.withworker?1:-1,10000);
   UI.createCookie('xcas_prettyprint',UI.prettyprint?1:-1,10000);
   UI.createCookie('xcas_qa',UI.qa?1:-1,10000);
   UI.createCookie('xcas_usecm',UI.usecm?1:-1,10000);
   UI.createCookie('xcas_history_width',form.history_width.value,10000);
   UI.createCookie('xcas_history_height',form.history_height.value,10000);
   UI.createCookie('xcas_outdiv_width',form.outdiv_width.value,10000);
   UI.createCookie('xcas_outdiv_height',form.outdiv_height.value,10000);
   UI.createCookie('xcas_matrix_maxrows',form.matr_cfg_rows.value,10000);
   UI.createCookie('xcas_matrix_maxcols',form.matr_cfg_cols.value,10000);
   UI.createCookie('xcas_matrix_textarea',form.matr_textarea.checked?1:-1,10000);
   UI.assistant_matr_setmatrix(form.matr_cfg_rows.value,form.matr_cfg_cols.value);
   UI.assistant_matr_setdisplay();
  },
  savesession:function(i){
    // console.log('save_session',i);
    var s;
    filename=document.getElementById("outputfilename").value;
    if (i==2) {
      UI.createCookie('xcas__'+filename,UI.makelink(0),9999);
      console.log(UI.listCookies());
      return;
    }
    if (i==1){
      s=document.getElementById("fulldocument").innerHTML;
      s='<html id="fulldocument" manifest="xcas.appcache">'+s+'</html>';
    }
    else {
      s=document.getElementById("mathoutput").innerHTML;
    }
    var blob = new Blob([s], {type: "text/plain;charset=utf-8"});
    if (i==1) filename += ".html"; else filename += ".xw";
    saveAs(blob,filename);
  },
  show_history123:function(){
    document.getElementById('history1').style.display='inline';
    //document.getElementById('history2').style.display='block';
    document.getElementById('history4').style.display='block';
    document.getElementById('startup').style.display='none';
    document.getElementById('startup1').style.display='none';
    document.getElementById('startup2').style.display='none';
  },
  loadfile:function(oFiles){
    var nFiles = oFiles.length;
    for (var nFileId = 0; nFileId < nFiles; nFileId++) {
      // Module.print(oFiles[nFileId].name);
      var reader = new FileReader();
      reader.readAsText(oFiles[nFileId]);
      var s;
      reader.onloadend = function(e){		
	s = e.target.result;
        if (s.length>7 && s.substr(0,7)=='<tbody>'){
         UI.show_history123();
         document.getElementById("mathoutput").innerHTML += s;
         if (confirm('Voulez-vous executer les commandes de l\'historique?'))
           UI.exec(document.getElementById('mathoutput'),0);
         // Module.print(s);
	}
	else alert('Format de document invalide');
	if (UI.focusaftereval) UI.focused.focus();
      }
    }
  },
  show_level_answers: function(level,b){
    var cur=level.firstChild;
    cur=cur.firstChild;
    cur=UI.skip_buttons(cur); // skip buttons
    var s=cur.innerHTML;
    var pos=s.search("<textarea");
    if (pos<0 || pos>=s.length) return;
    cur=cur.nextSibling; // skip entry field
    if (b)
      cur.style.display='inherit';
    else
      cur.style.display='none';
  },
  show_answers: function(b){
   var out=document.getElementById('mathoutput');
   var cur=out.firstChild;
   while (cur){
     UI.show_level_answers(cur,b);
     cur=cur.nextSibling;
   }
   if (UI.focusaftereval) UI.focused.focus();
  },
  is_alphan:function(c){
    return (c>=48 && c<=57) || (c>=65 && c<=91) || (c>=97 && c<=123) || c==95;
  },
  erase_button:function(){
    return '<td><button style="width:30px;height:30px;" onclick=\'UI.erase(this)\' title="placer ce niveau dans la corbeille">del</button></td></tr>';
  },
  move_buttons:function(newline){
   var s='<tr onmouseenter="UI.switch_buttons(this,true)" onmouseleave="UI.switch_buttons(this,false)">';
   s += '<td><button style="width:20px;height:30px;" onclick=\'UI.moveup(this)\' title="d&eacute;placer vers le haut">↑</button>';
   if (newline)
     s += '<br><button style="width:20px;height:30px;" onclick=\'UI.movedown(this)\' title="d&eacute;placer vers la bas">↓</button></td><td></td>';
   else
     s += '</td><td><button style="width:20px;height:30px;" onclick=\'UI.movedown(this)\' title="d&eacute;placer vers la bas">↓</button></td>';
   return s;
  },
   skip_buttons:function(field){
     return field.nextSibling.nextSibling;
   },
   addplotfunc:function(){
  },
  paramname:97,
  curseurhtml:function(name,mini,maxi,step,value){
   var s=UI.move_buttons(!UI.qa);
   s += '<td colspan=3>';
   s += '<form onsubmit="setTimeout(function() { rangename.value=valname.value; rangename.step=stepname.value; valname.step=stepname.value;rangename.min=minname.value; rangename.max=maxname.value;UI.eval_below(name.form,name.value,rangename.value);}); return false;">';
   s += '<input class="bouton" type="text" name="name" size="1" value=\''+name+'\'>';
   s += '='+'<input class="bouton" type="number" name="valname" onchange="valname.innerHTML=valname.value" value=\''+value+'\' step=\''+step+'\'>';
   s += '<input class="bouton" type="submit" value="ok">'
   s += '&nbsp;<input class="bouton" type="number" name="minname" value=\''+mini+'\' step=\''+step+'\'>';
   s += '<input class="bouton" type="range" name="rangename" onclick="valname.value=value;UI.eval_below(form,form.name.value,value);" value='+value+' min='+mini+' max='+maxi+' step=' + step +'>';
   s += '<input class="bouton" type="number" name="maxname" value=\''+maxi+'\' step=\''+step+'\'>&nbsp;';
   s += '(pas <input class="bouton" type="number" name="stepname" value=\''+step+'\' step=\''+step/100+'\'>)';
   s += '&nbsp;<input style="height:30px" type="button" value="--" onclick="valname.value -= 10*stepname.value;UI.eval_below(form,form.name.value,valname.value);">';
   s += '&nbsp;<input style="height:30px" type="button" value="- " onclick="valname.value -= stepname.value;UI.eval_below(form,form.name.value,valname.value);">';
   s += '&nbsp;<input style="height:30px" type="button" value="+ " onclick="valname.value -= -stepname.value;UI.eval_below(form,form.name.value,valname.value);">';
   s += '&nbsp;<input style="height:30px" type="button" value="++" onclick="valname.value -= -10*stepname.value;UI.eval_below(form,form.name.value,valname.value);">';
   s += '</form>';
   s += '</td>';
   s += UI.erase_button();
   return s;
  },
  addcurseur: function(name,value,mini,maxi,step){
         UI.show_history123();
   UI.caseval('assume('+name+'='+value+')');
   var s=UI.curseurhtml(name,mini,maxi,step,value);
   var out=document.getElementById('mathoutput');
   //Module.print(s);
   out.innerHTML += s;
   UI.link(0);
   UI.scrollatend(out.parentNode);
   if (UI.focusaftereval) UI.focused.focus();
  },
  exec_history: function(){alert('Historique!');},
  svg_counter:0,
  savesvg: function(field){
    var s=field.innerHTML;
    s='<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n'+s;
    var blob = new Blob([s], {type: "text/plain;charset=utf-8"});
    filename=document.getElementById("outputfilename").value;
    ++UI.svg_counter;
    filename += UI.svg_counter+".svg";
    saveAs(blob,filename);
  },
   zoom: function(field,scale){
   var prev=field.parentNode.previousSibling.lastChild;
   var ps=prev.innerHTML;
   if (ps.length>22 && ps.substr(0,17)==' <canvas id=\"gl3d'){
     ps=ps.substr(18,7);
     var pos=ps.search('"');
     if (pos>0 && pos<7){
       ps=ps.substr(0,pos);
       if (scale>1) UI.giac_renderer('-'+ps); else UI.giac_renderer('+'+ps);
       return;
     }
   }
   if (prev.firstChild) prev=prev.firstChild;
   // firstChild not required with all browsers
   var box = prev.viewBox.baseVal;
    var w=box.width/1.2,h=box.height/1.2;
    var x=box.x+w/10,y=box.y+h/10;
    //Module.print('current w/h '+w+','+h);
    var cx=x+w/2,cy=y+h/2; // center
    w=scale*w; h=scale*h; // new scales
    // Module.print('new center'+cx+','+cy);
    // Module.print('new w/h'+w+','+h);
    x=cx-w/2; y=cy-h/2;
    cx=x+w; cy=y+h;
    // reeval commandline with gl_x=x..cx and gl_y=y..cy
    var postcmd=';gl_x='+x+'..'+cx+';gl_y='+y+'..'+cy+';';
   //Module.print(prev.parentNode.parentNode.previousSibling.innerHTML);
   //Module.print(postcmd);
   if (prev.parentNode.previousSibling){
     //Module.print(prev.parentNode.parentNode.firstChild.innerHTML);
     UI.reeval(prev.parentNode.parentNode.firstChild,postcmd);
   }
   else
    UI.reeval(prev.parentNode.parentNode.previousSibling.firstChild,postcmd);
  },
  eval_cmdline: function(){
   var value;
   document.getElementById('keyboardfunc').style.display='none'; document.getElementById('keyboard').style.display='none';
   if (cmentree.type!='textarea') value=cmentree.getValue(); else value=entree.value;
   UI.eval_cmdline1(value,true);
  },
  eval_cmdline1:function(value,docaseval){
  UI.set_locale();
  // value=UI.lowercase1(value);
  var out;
  // suppress leading non ascii char
  var n=0;
  for (;n<value.length;n++){
    if (value.charCodeAt(n)>32) break;
  }
  value=value.substr(n,value.length-n);
  for (n=value.length-1;n>=0;n--){
    if (value.charCodeAt(n)>32) break;
  }
  value=value.substr(0,n+1);
  if (cmentree.type!='textarea') cmentree.setValue(value); else entree.value=value;
  var s=' ';
  if (value.length >= 2 && value.substr(0,2)=='//'){
   out=value;
  } else {
    if (docaseval) {
      if (UI.busy) {out=' Le moteur de calcul est occupe.'; s=out;}
      else {out=UI.casevalcb(value,UI.eval_cmdline1cb,value); return;}
    }
    else { out=' Non evalue. Cliquer sur Exec pour evaluer. '; s=out; }
  }
  UI.eval_cmdline1end(value,out,s);
  },
  eval_cmdline1end:function(value,out,s){
  var add=UI.addinput(value,out,s);
  //var s=UI.caseval('mathml(quote('+value+'),1)');
  //add += '&nbsp;&nbsp;'+s.substr(1,s.length-2);
  //Module.print(value+'  ->  '+out);
  if (UI.focusaftereval) cmentree.focus();
  if (cmentree.type!='textarea') cmentree.execCommand('selectAll');
  else {var f=document.activeElement; cmentree.select(); f.focus(); UI.selection=cmentree.value;}
  //document.getElementById('canvas').focus();
  var mathoutput=document.getElementById('mathoutput');
  var tr=document.createElement("TABLE"); 
  tr.innerHTML += add;
  mathoutput.appendChild(tr.firstChild);
  // mathoutput.innerHTML += add;
  UI.render_canvas(mathoutput.lastChild);
  UI.scrollatend(mathoutput.parentNode);
  UI.link(0);
  if (UI.prettyprint && UI.usemathjax && UI.histcount>0)
    //console.log('"hist'+(UI.histcount-1)+'"');
    MathJax.Hub.Queue(["Typeset",MathJax.Hub,'"hist'+(UI.histcount-1)+'"']);
  },
  eval_cmdline1cb: function(out,value){
   var s;
   if (out.substr(1,4)=='<svg' || out.substr(0,5)=='gl3d ') {
     s=out; out='Done_graphic';
   }
   else {
       if (UI.prettyprint){
         if (UI.usemathjax)
           s='latex(quote('+out+'))';
         else
           s='mathml(quote('+out+'),1)'; //Module.print(s);
         //console.log(s);
         s=UI.caseval(s);
        } else s=out;
   }
   UI.eval_cmdline1end(value,out,s);
  },
  set_locale: function(){
  if (UI.langue==-1){ 
    var out=UI.caseval('set_language(1); evalf(1,30);');
    //UI.langue=1; // commente sinon la langue n'est pas toujours reconnue
  }
  if (UI.initconfigstring!=''){
    UI.caseval(UI.initconfigstring);
    UI.initconfigstring=''    
  }
 },
  switch_buttons: function(field,onoff){
    var f=field.firstChild;
    if (onoff) f.style.visibility='visible'; else f.style.visibility='hidden';
    f = f.nextSibling;
    if (onoff) f.style.visibility='visible'; else f.style.visibility='hidden';
    f=field.lastChild;
    if (onoff) f.style.visibility='visible'; else f.style.visibility='hidden';
  },
  exec: function(field,start){
  UI.set_locale();
  var cur=field.firstChild;
  var i=0;
  for (;cur;i++){
   if (i>=start)
     UI.eval_level(cur);
   cur=cur.nextSibling;
   }
   if (UI.focusaftereval) UI.focused.focus();
  },
  eval_below: function(field,name,value){
  //Module.print(name+':='+value);
  UI.caseval('assume('+name+'='+value+')');
  var cur=field.parentNode.parentNode.parentNode;
  cur=cur.nextSibling;
  //Module.print(cur.innerHTML);
  for (;cur;){
   UI.eval_level(cur);
   cur=cur.nextSibling;
  }
  },
 editcomment : function(field){
   var prev=field.parentNode.previousSibling;
   var s=prev.innerHTML;
   s='<td colspan="2"><textarea rows="2" columns="60">'+s+'</textarea>';
   s+='<button onclick="UI.editcomment_end(this)">ok</button></td>';
   prev.innerHTML=s;
   field.parentNode.style.display='none';
 },
 editcomment_end: function(field){
  var prev=field.previousSibling;
  var s='<td colspan="2" onclick="UI.editcomment(this)">'+prev.value+'</td>';
  var par=field.parentNode;
  par.innerHTML=s;
  var l1=par.nextSibling;
  l1.style.display='block';
 },
  eval: function(text,textin){
   UI.set_locale();
   var out=UI.caseval(text);
   var s=' ';
   if (out.substr(1,4)=='<svg' || out.substr(0,5)=='gl3d '){
     // Module.print(text+' -> Done');
     s=out; out='Done_graphic';
   }
   else {
     // Module.print(text+' -> '+out);
     if (UI.prettyprint){
      if (UI.usemathjax)
        s=UI.caseval('latex(quote('+out+'))');
      else
        s=UI.caseval('mathml(quote('+out+'),1)');
     } else s=out;
   }
   s=UI.addinput(textin,out,s);
   return s;
  },
  render_canvas:function(field){
   // return; // does not work, 
   var n=field.id;
   if (n && n.length>5 && n.substr(0,5)=='gl3d_'){
    Module.print(n);
    var n3d=n.substr(5,n.length-5);
   //Module.print(n3d);
    //Module.canvas=document.getElementById(n);
    UI.giac_renderer(n3d);
    //Module.canvas=document.getElementById('canvas');
    return;
   }
   var f=field.firstChild;
   for (;f;f=f.nextSibling){
     UI.render_canvas(f);
   }
  },
  reeval: function(field,postcmd){
  // field=field.previousSibling;
  if (field.type!='textarea'){ var t=field.getTextArea(); t.value=field.getValue();field=t;}
  var s=field.value;
  //console.log(s);
  var par=field.parentNode;
  par=par.parentNode;
  if (s.length && s[s.length-1]==';' && postcmd.length && postcmd[0]==';') postcmd=postcmd.substr(1,postcmd.length-1);
  s=UI.eval(s+postcmd,s);
  par.innerHTML=s;
  UI.render_canvas(par);
  UI.link(0);
  if (UI.prettyprint && UI.usemathjax && UI.histcount>0){
    //console.log('"hist'+(UI.histcount-1)+'"');
    MathJax.Hub.Queue(["Typeset",MathJax.Hub,'"hist'+(UI.histcount-1)+'"']);
  }
  if (UI.focusaftereval){
    par=par.parentNode.nextSibling;
    if (par==null) cmentree.focus(); // console.log(par);
    else {
      par=par.firstChild.firstChild.nextSibling.nextSibling.firstChild;
      par.focus();
    }
   }
  },
  eval_level: function(field){
   // ? use cur.nodeType instead of search?
   var s=field.innerHTML;
   var pos=s.search("<textarea");
   if (pos<0 || pos>=s.length){
    pos=s.search("<form");
    if (pos>0 && pos<s.length){
      var level=field.firstChild;
      var cur=level.firstChild;
      cur=UI.skip_buttons(cur);
      //Module.print(cur.innerHTML);
       cur=cur.firstChild;
       // Module.print(cur.name.value+':='+cur.rangename.value);
       UI.caseval(cur.name.value+':='+cur.rangename.value);
       var s=UI.curseurhtml(cur.name.value,cur.minname.value,cur.maxname.value,cur.stepname.value,cur.valname.value);
       level.innerHTML=s;
    }
    return;
  }
    var cur=field.firstChild;
    cur=cur.firstChild;
    cur=UI.skip_buttons(cur);
    cur=cur.firstChild;
    var s=cur.value;
    s=UI.eval(s,s);
    field.innerHTML=s;
    UI.render_canvas(field);
    if (UI.prettyprint && UI.usemathjax ){
      //console.log(s);
      MathJax.Hub.Queue(["Typeset",MathJax.Hub,field]);
    }
  },
  before: function(field){
  var s='';
  while ((field=field.previousSibling)){
    s += field.innerHTML;
  }
   return s;
  },
  after: function(field){
  var s='';
  while ((field=field.nextSibling)){
    s += field.innerHTML;
  }
   return s;
  },
addcomment: function(text){
         UI.show_history123();
  var s=UI.move_buttons(!UI.qa);
  s += '<td colspan="2">'+text.substr(2,text.length-2)+'</td>';
  s += '<td> <button onclick="UI.editcomment(this);">edit</td>';
  s += UI.erase_button();
  return s;
  },
  prepare_cm: function(txt,h,cm){
  var pos=txt.selectionStart;
  cm.setCursor({line:0,ch:pos}); cm.refresh();
  cm.setSize(null,h+20);
  cm.on("focus",function(cm){ UI.set_focused(cm); });
  cm.on("blur",function(cmf) {
  if (cmf.getSelection().length > 0){UI.selection=cmf.getSelection();}
  cmf.toTextArea();
  });
  cm.setOption("extraKeys", {
   Enter: function(cm){
     var txt=cm.getTextArea();
     cm.toTextArea();
     UI.reeval(txt,'');
   },
  F1: function(cm) {
     UI.completion(cm);
   },
  Tab: function(cm) {
    UI.completion(cm);
    //cm.toTextArea();  
   }
  });
  },
  count_newline: function(text){
   var k=0,r=0;
   for (;k<text.length;++k){
     if (text.charCodeAt(k)==10)
       ++r;
   }
   return r;
  },
  addinput: function(textin,textout,mathmlout){
  document.getElementById('startup_restore').style.display='none'
  //console.log(textout,mathmlout); 
  if (mathmlout.length>=5 && mathmlout.substr(0,5)=='gl3d '){ document.getElementById('table_3d').style.display='inherit';}
  if (textin.length > 2 && textin.substr(0,2)=='//') return UI.addcomment(textin);
         UI.show_history123();
// document.getElementById('mathoutput').style.listStyleType = 'none';
  var is_svg=mathmlout.substr(1,4)=='<svg';
  var is_3d=mathmlout.substr(0,5)=='gl3d ';
  var s=UI.move_buttons(!UI.qa);
  var delbut=false;
  if (textin.charCodeAt(0)==63)
    s += '<td colspan="2">'+UI.renderhelp(textout)+'</td><td>';
  else {
    if (UI.qa)
      s += '<td>';
    else
      s += '<td colspan=2>';	
    s += '<textarea class="historyinput" ';
    if (is_svg && UI.qa)
	s+='rows=8 style="font-size:large"';
    else
	//s += 'rows='+(UI.count_newline(textin)+1) +' style="font-size:large"';
	s += 'style="height:'+(20+16*UI.count_newline(textin))+'px; font-size:large"';
    s += ' title="Shift-Enter: saut de ligne, Enter: eval" onkeypress="UI.ckenter(event,this)" onblur="UI.updatelevel(this);" onfocus="if (UI.usecm){var h=offsetHeight;var cm=CodeMirror.fromTextArea(this,{ matchBrackets: true}); UI.prepare_cm(this,h,cm);UI.changefontsize(cm,16); UI.set_focused(cm);} else UI.set_focused(this);" onselect="if (UI.getsel(this).length>0) UI.selection=UI.getsel(this);">'+textin+'</textarea>';
    if (UI.qa) s += '</td>'; 
    if (is_svg || is_3d){
      if (UI.qa) s += '<td>'; else s+='<br>';
      if (is_svg)
        s += '<div style="text-align:center">'+mathmlout.substr(1,mathmlout.length-2)+'</div></td>';
      else {
	var n3d=mathmlout.substr(5,mathmlout.length-5);
	// Module.print(n3d);
	if (0)
	s += '<div style="text-align:center"> 3d </div></td>';
	else s += '<div style="text-align:center"> <canvas id="gl3d_'+n3d+'" onmousedown="UI.canvas_pushed=true;UI.canvas_lastx=event.clientX; UI.canvas_lasty=event.clientY;" onmouseup="UI.canvas_pushed=false;" onmousemove="UI.canvas_mousemove(event,'+n3d+')" width=400 height=250></canvas></div></td>';
        //Module.print(s);
      }
      s += '<td><button class="bouton" onclick="UI.zoom(this,1.414)">out</button><br>';
      s += '<button class="bouton" onclick="UI.zoom(this.previousSibling,0.707)">in</button><br>';
      if (is_svg) s += '<button class="bouton" onclick="UI.savesvg(parentNode.previousSibling)">sav</button><br>';
      s += '<br><button style="height:25px;" onclick=\'UI.erase(this)\' title="placer ce niveau dans la corbeille">del</button>'; delbut=true;
      s += '</td>';
    }
    else {
      if (UI.qa) s += '<td>';
      s += '<div style="color:blue; text-align:center" title="Double clic: voir en mode texte (utile pour copier-coller)" class="outdiv" ondblclick="nextSibling.style.display=\'inherit\';this.nextSibling.select();UI.selection=nextSibling.value;this.style.display=\'none\';this.nextSibling.nextSibling.style.display=\'inherit\';" id="hist'+UI.histcount+'">';
      UI.histcount++;
      if (UI.prettyprint){
       if (UI.usemathjax)
        s += '$$'+mathmlout.substr(1,mathmlout.length-2)+'$$';
       else
        s += mathmlout.substr(1,mathmlout.length-2);
      } else s += mathmlout;
      s += '</div>';
      s += '<textarea class="outdiv" onfocus="UI.set_focused(this)" onselect="if (UI.getsel(this).length>0) UI.selection=UI.getsel(this);" style="display:none">'+textout+'</textarea>';
      s += '<button style="display:none" onclick="previousSibling.previousSibling.style.display=\'block\'; previousSibling.style.display=\'none\';this.style.display=\'none\'">cancel</button>';
      s += '</td>';
      s += '<td><button style="width:20px;height:30px;" onclick=\'UI.insert(UI.focused,"evalf('+textin+')")\' title="Valeur approch&eacute;e" style="color:blue">~</button>';
    if (!UI.qa) { s += '<button style="height:25px;" onclick=\'UI.erase(this)\' title="placer ce niveau dans la corbeille">del</button>'; delbut=true; }
      s +='</td>';
    }
  }
  if (delbut) s += '</tr>'; else s += UI.erase_button();
  // console.log(s);
  return s;
},
giac_renderer: function(text){
var gr = Module.cwrap('_ZN4giac13giac_rendererEPKc','number', ['string']);
gr(text);
},
  xcascmd:["ABS","ACOS","ACOSH","ACOT","ACSC","ADDCOL","ADDROW","ALOG","ARC","ARG","ASEC","ASIN","ASINH","ATAN","ATANH","Airy_Ai","Airy_Bi","Ans","Archive","BINOMIAL","BesselI","BesselJ","BesselK","BesselY","Beta","Bezier","BlockDiagonal","CEILING","CHOOSE","COLNORM","COMB","CONCAT","COND","CONJ","COS","COSH","COT","CROSS","CSC","Celsius2Fahrenheit","Ci","Ci0","Circle","ClrDraw","ClrGraph","ClrIO","CopyVar","CyclePic","DEGXRAD","DELCOL","DELROW","DET","DISP","DOT","DROP","DUP","DelFold","DelVar","Det","Dirac","DispG","DispHome","DrawFunc","DrawInv","DrawParm","DrawPol","DrawSlp","DrwCtour","EDITMAT","EIGENVAL","EIGENVV","EXP","EXPM1","EXPORT","Ei","Ei0","Ei_f","Eta","Exec","FLOOR","FNROOT","Factor","Fahrenheit2Celsius","Fill","GETKEY","GF","Gamma","Gcd","Gcdex","Get","GetCalc","GetFold","Graph","HMSX","Heaviside","IDENMAT","IFTE","IM","INPUT","INVERSE","ISOLATE","ITERATE","Input","InputStr","Int","Inverse","JordanBlock","LINE","LN","LNP1","LOG","LQ","LSQ","LU","Line","LineHorz","LineTan","LineVert","MAKELIST","MAKEMAT","MANT","MAX","MAXREAL","MIN","MINREAL","MOD","MSGBOX","NOP","NORMALD","NTHROOT","NewFold","NewPic","Nullspace","OVER","Output","Ox_2d_unit_vector","Ox_3d_unit_vector","Oy_2d_unit_vector","Oy_3d_unit_vector","Oz_3d_unit_vector","PERM","PICK","PIECEWISE","PIXOFF","PIXON","POISSON","POLYCOEF","POLYEVAL","POLYFORM","POLYROOT","POS","PRINT","Pause","Phi","Pictsize","PopUp","Prompt","Psi","Psi_minus_ln","PtOff","PtOn","PtText","PxlOff","PxlOn","QR","QUAD","QUOTE","Quo","RADXDEG","RANDMAT","RANDOM","RANDSEED","RANK","RCL","RE","RECT","RECURSE","REDIM","REPLACE","REVERSE","ROUND","ROWNORM","RREF","RandSeed","Rank","RclPic","Rem","Resultant","RplcPic","Rref","SCALE","SCALEADD","SCHUR","SEC","SIGN","SIN","SINH","SIZE","SORT","SPECNORM","SPECRAD","SUB","SVD","SVL","SWAP","SWAPCOL","SWAPROW","SetFold","Si","SiCi_f","SiCi_g","SortA","SortD","StoPic","Store","Sum","TAN","TANH","TAYLOR","TRACE","TRN","TRUNCATE","TeX","UTPC","UTPF","UTPN","UTPT","Unarchiv","VIEWS","WAIT","XHMS","XPON","Zeta","ZoomRcl","ZoomSto","a2q","abcuv","about","abs","abscissa","accumulate_head_tail","acos","acos2asin","acos2atan","acosh","acot","acsc","add","add_language","additionally","adjoint_matrix","affix","algvar","alog10","alors","altitude","and","angle","angleat","angleatraw","animate","animate3d","animation","ans","append","apply","approx","arc","arcLen","area","areaat","areaatraw","areaplot","arg","array","array_sto","as_function_of","asc","asec","asin","asin2acos","asin2atan","asinh","assign","assume","atan","atan2acos","atan2asin","atanh","atrig2ln","augment","avance","avgRC","background","baisse_crayon","bar_plot","barycenter","basis","bernoulli","bezout_entiers","binomial","binomial_cdf","binomial_icdf","binprint","bisector","bitand","bitmap","bitor","bitxor","black","blockmatrix","blue","border","bounded_function","boxwhisker","break","breakpoint","by","c1oc2","c1op2","cFactor","cSolve","cZeros","cache_tortue","calc_mode","camembert","canonical_form","cap","cas_setup","cat","cd","ceil","ceiling","cell","center","center2interval","centered_cube","centered_tetrahedron","cfactor","changebase","char","charpoly","chinrem","chisquare","chisquare_cdf","chisquare_icdf","cholesky","choosebox","chrem","circle","circumcircle","classes","click","close","coeff","coeffs","col","colDim","colNorm","coldim","collect","colnorm","color","colspace","comDenom","comb","combine","comment","common_perpendicular","companion","compare","complexroot","concat","cone","conic","conj","cont","contains","content","contourplot","convert","convertir","convexhull","coordinates","copy","correlation","cos","cos2sintan","cosh","cot","cote","count","count_eq","count_inf","count_sup","courbe_parametrique","courbe_polaire","covariance","covariance_correlation","cpartfrac","crationalroot","crayon","cross","crossP","cross_ratio","crossproduct","csc","csolve","csv2gen","cube","curvature","cumSum","cumulated_frequencies","curl","current_sheet","curve","cyan","cycle2perm","cycleinv","cycles2permu","cyclotomic","cylinder","de","deSolve","debug","debug_infolevel","debut_enregistrement","decrement","degree","delcols","delrows","deltalist","denom","densityplot","deriver","desolve","dessine_tortue","det","det_minor","developper","developper_transcendant","dfc","dfc2f","diag","diff","dim","display","disque","disque_centre","distance","distance2","distanceat","distanceatraw","div","divcrement","divergence","divide","divis","division_point","divisors","divpc","dodecahedron","dot","dotP","dotprod","droit","droite_tangente","dsolve","e2r","ecart_type","ecart_type_population","ecris","efface","egcd","egv","egvl","eigVc","eigVl","eigenvals","eigenvalues","eigenvectors","eigenvects","element","ellipse","entry","envelope","epsilon2zero","equal2diff","equal2list","equation","equilateral_triangle","erase3d","erf","erfc","erfs","et","euler","euler_mac_laurin","eval","eval_level","evala","evalb","evalc","evalf","evalm","even","evolute","exact","exbisector","excircle","execute","exp","exp2list","exp2pow","exp2trig","expexpand","exponential_regression","exponential_regression_plot","expr","extract_measure","ezgcd","f2nd","fMax","fMin","fPart","faces","facteurs_premiers","factor","factor_xn","factorial","factoriser","factoriser_entier","factoriser_sur_C","factoriser_xn","factors","faire","fclose","fcoeff","ffonction","fft","fieldplot","filled","fin_enregistrement","findhelp","fisher","fisher_cdf","fisher_icdf","float","float2rational","floor","fonction","fonction_derivee","fopen","format","fourier_an","fourier_bn","fourier_cn","fprint","frac","fracmod","frame_2d","frame_3d","froot","fsolve","funcplot","function_diff","fxnd","gauche","gauss","gaussjord","gbasis","gcd","gcdex","genpoly","geo2d","geo3d","getDenom","getKey","getNum","getType","giac","goto","grad","gramschmidt","graph2tex","graph3d2tex","graphe","graphe3d","graphe_suite","greduce","green","groupermu","hadamard","half_cone","half_line","halftan","halftan_hyp2exp","halt","hamdist","harmonic_conjugate","harmonic_division","has","hasard","head","heap_mult","hermite","hessenberg","hessian","heugcd","hexagon","hexprint","hidden_name","hilbert","histogram","hold","homothety","horner","hp38","hyp2exp","hyperbola","hyperplan","hypersphere","hypersurface","iPart","iabcuv","ibasis","ibpdv","ibpu","ichinrem","ichrem","icontent","icosahedron","id","identity","idivis","idn","iegcd","ifactor","ifactors","ifft","igcd","igcdex","ihermite","ilaplace","im","imag","image","implicitplot","implicitplot3d","inString","in_ideal","incircle","increment","indets","inequationplot","input","inputform","insmod","int","intDiv","integer_format","integrate","integrer","inter","interactive","interactive_odeplot","interactive_plotode","interp","interval2center","inv","inverse","inversion","invlaplace","invztrans","iquo","iquorem","iratrecon","irem","isPrime","is_collinear","is_concyclic","is_conjugate","is_coplanar","is_cycle","is_element","is_equilateral","is_harmonic","is_harmonic_circle_bundle","is_harmonic_line_bundle","is_orthogonal","is_parallel","is_parallelogram","is_permu","is_perpendicular","is_prime","is_pseudoprime","is_rectangle","is_rhombus","is_square","ismith","isobarycenter","isom","isopolygon","isprime","ithprime","jacobi_symbol","jordan","jusque","ker","kernel","keyboard","kill","l1norm","l2norm","label","lagrange","laguerre","laplace","laplacian","latex","lcm","lcoeff","ldegree","left","legend","legendre","legendre_symbol","length","leve_crayon","lgcd","lhs","ligne_polygonale","ligne_polygonale_pointee","limit","limite","lin","line","line_inter","line_segments","linear_interpolate","linear_regression","linear_regression_plot","lineariser","lineariser_trigo","linsolve","lis","lis_phrase","list2mat","listplot","lll","ln","lnGamma_minus","lname","lncollect","lnexpand","locus","log10","logarithmic_regression","logarithmic_regression_plot","logb","logistic_regression","logistic_regression_plot","lsmod","lu","lvar","mRow","mRowAdd","magenta","makelist","makemat","makemod","makesuite","makevector","map","maple2mupad","maple2xcas","maple_ifactors","maple_mode","mat2list","mathml","matpow","matrix","max","maxnorm","mean","median","median_line","member","mid","midpoint","min","mkisom","mksa","modgcd","modgcd_cachesize","modp","mods","montre_tortue","moustache","moyal","moyenne","mpzclass_allowed","mul","mult_c_conjugate","mult_conjugate","multcrement","multiplier_conjugue","multiplier_conjugue_complexe","multiply","mupad2maple","mupad2xcas","nCr","nDeriv","nInt","nPr","nSolve","ncols","newList","newMat","newton","nextperm","nextprime","nodisp","non","non_recursive_normal","nop","nops","norm","normal","normal_cdf","normal_icdf","normald","normald_cdf","normald_icdf","normalize","nrows","nuage_points","nullspace","numer","octahedron","octprint","odd","odeplot","odesolve","op","open","open_polygon","or","ord","order_size","ordinate","orthocenter","orthogonal","os_version","ou","output","p1oc2","p1op2","pa2b2","pade","padic_linsolve","parabola","parabolic_interpolate","parallel","parallelepiped","parallelogram","parameq","parameter","paramplot","pari","pari_unlock","part","partfrac","pas","pas_de_cote","pcar","pcar_hessenberg","pcoeff","perimeter","perimeterat","perimeteratraw","perm","perminv","permu2cycles","permu2mat","permuorder","perpen_bisector","perpendicular","peval","piecewise","pivot","pixoff","pixon","plane","plot","plot3d","plot_style","plotarea","plotcontour","plotdensity","plotfield","plotfunc","plotimplicit","plotinequation","plotlist","plotode","plotparam","plotpolar","plotseq","pmin","pnt","point","point2d","point3d","pointer","poisson","poisson_cdf","poisson_icdf","polar","polar2rectangular","polar_coordinates","polar_point","polarplot","pole","poly2symb","polyEval","polygone_rempli","polygonplot","polygonscatterplot","polyhedron","polynomial_regression","polynomial_regression_plot","position","potential","pour","pow2exp","power_regression","power_regression_plot","powermod","powerpc","powexpand","powmod","prepend","preval","prevperm","prevprime","primpart","print","printpow","prism","product","prog_eval_level","projection","proot","propFrac","propfrac","psrgcd","ptayl","purge","pwd","pyramid","q2a","qr","quadric","quadrilateral","quantile","quartile1","quartile3","quartiles","quaternion","quest","quo","quorem","quote","r2e","radical_axis","radius","ramene","rand","randMat","randNorm","randPoly","randexp","randmatrix","randperm","randpoly","randvector","rank","ranm","rassembler_trigo","rat_jordan","rat_jordan_block","rationalroot","ratnormal","rdiv","re","read","readrgb","readwav","real","realroot","reciprocation","rectangle","rectangle_plein","rectangular2polar","rectangular_coordinates","recule","red","reduced_conic","reduced_quadric","ref","reflection","rem","remain","remove","remove_language","reorder","repete","reset_solve_counter","residue","resoudre","resoudre_dans_C","resoudre_systeme_lineaire","restart","restart_modes","restart_vars","resultant","reverse_rsolve","revert","revlist","rhombus","rhs","right","right_triangle","rm_a_z","rm_all_vars","rmbreakpoint","rmmod","rmwatch","romberg","rond","rootof","roots","rotate","rotation","round","row","rowAdd","rowDim","rowNorm","rowSwap","rowdim","rownorm","rowspace","rref","rsolve","saute","sauve","save_history","scalarProduct","scalar_product","scatterplot","sec","segment","select","semi_augment","seq","seqplot","seqsolve","series","shift","shift_phase","show_language","si","sialorssinon","sign","signature","signe","similarity","simp2","simplex_reduce","simplifier","simplify","simult","sin","sin2costan","sincos","single_inter","singular","sinh","sinon","size","sizes","slope","slopeat","slopeatraw","smod","snedecor","snedecor_cdf","snedecor_icdf","solve","solve_zero_extremum","somme","sommet","sort","sphere","spline","split","spread2mathml","spreadsheet","sq","sqrfree","sqrt","square","srand","sst","sst_in","stdDev","stddev","stddevp","sto","string","student","student_cdf","student_icdf","sturm","sturmab","sturmseq","subMat","submatrix","subst","substituer","sum","sum_riemann","suppress","surd","svd","switch_axes","sylvester","symb2poly","syst2mat","tCollect","tExpand","table","tablefunc","tableseq","tabvar","tail","tan","tan2cossin2","tan2sincos","tan2sincos2","tangent","tangente","tanh","tantque","taylor","tchebyshev1","tchebyshev2","tcoeff","tcollect","testfunc","tests","tetrahedron","texpand","textinput","threads_allowed","throw","time","tlin","to","tourne_droite","tourne_gauche","trace","tran","translation","transpose","triangle","triangle_plein","trig2exp","trigcos","trigexpand","trigsin","trigtan","trn","trunc","truncate","tsimplify","type","ufactor","unapply","unarchive","unarchive_ti","unitV","unquote","usimplify","valuation","vandermonde","variance","vector","vers","version","vertices","vertices_abc","vertices_abca","vpotential","watch","whattype","when","white","widget_size","with_sqrt","write","writergb","writewav","xcas_mode","xyztrange","yellow","zeros","zip","ztrans"],
  dicho_find:function(tableau,s){
    var l=tableau.length,debut=0,fin=l,milieu;
    if (l==0) return false;
    if (s<tableau[0] || s>tableau[l-1]) return false;
    // s>=tableau[debut] and s<=tableau[fin-1]
    for (;debut<fin-1;){
      milieu=Math.floor((debut+fin)/2);
      // console.log(debut,fin,milieu,tableau[milieu]) 
      if (s>=tableau[milieu]) debut=milieu; else fin=milieu;
    }
    // console.log(s,tableau[debut]);
    if (s==tableau[debut]) return true;
    return false;
  },
  unique_completion:function(tableau,s){
    var l=tableau.length,debut=0,fin=l,milieu;
    if (l==0 || s>tableau[l-1]) return "";
    if (s<tableau[0]) return s==tableau[0].substr(s.length);
    // s>=tableau[debut] and s<=tableau[fin-1]
    for (;debut<fin-1;){
      milieu=Math.floor((debut+fin)/2);
      // console.log(debut,fin,milieu,tableau[milieu]) 
      if (s>=tableau[milieu]) debut=milieu; else fin=milieu;
    }
    //console.log(s,tableau[debut],tableau[debut+1],tableau[debut+2]);
    // s>=tableau[debut]
    if (s==tableau[debut]){
      if (debut+1<l && s==tableau[debut+1].substr(0,s.length) ) return "";
      return s;
    }
    // now s>tableau[debut] and s is supposed to be shorter, hence s!=begin of tableau[debut]
    if (debut+1<l && s!=tableau[debut+1].substr(0,s.length)) return "";
    if (debut+2<l && s==tableau[debut+2].substr(0,s.length)) return "";
    return tableau[debut+1];
  },
  completion:function(cm){
    var s,k;
    if (cm.type=='textarea'){
      k = cm.selectionStart;
      s=cm.value;
    }
    else {
     var pos=cm.getCursor();
     k=pos.ch;
     s=cm.getLine(pos.line);
    }
    var kstart=k;
     // skip at cursor
     for (;k>0;k--){
       var c=s.charCodeAt(k);
       if (UI.is_alphan(c))
         break;
     }
     var kend=k;
     for (;k>=0;k--){
       var c=s.charCodeAt(k);
       if (!UI.is_alphan(c))
         break;
     }
     for (;k<kend;k++){
       var c=s.charCodeAt(k+1);
       if (c>64) break;
     }
     //Module.print(s); Module.print(k); Module.print(kend);
     s=s.substr(k+1,kend-k);
     if (s.length<2){ UI.insert(UI.focused,'?'); return;}
     var sc=UI.unique_completion(UI.xcascmd,s);
     if (cm.type=='textarea'){
       cm.selectionStart=k+1;
       cm.selectionEnd=kstart;
       if (sc!=""){
         UI.insert(cm,sc);
         s=sc;
         cm.selectionStart=k+1;
         cm.selectionEnd=k+1+sc.length;
       }
     } else {
       if (sc!=""){
         cm.setSelection({line:pos.line,ch:k+1},{line:pos.line,ch:pos.ch});
         UI.insert(cm,sc);
         cm.setSelection({line:pos.line,ch:k+1},{line:pos.line,ch:k+1+sc.length});
         s=sc;
       }
       else {
          cm.showHint();
       }
     }
     UI.addhelp('?',s);
  },
  isie:false,    
  scrollatend:function(field){
    if (!UI.isie)
      field.scrollTop=field.scrollHeight;    
  },    
  addhelp: function(prefixe,text){
  document.getElementById('helptxt').value=text;      
  var input=prefixe+text;
  var out=UI.eval(input,input);
  var add=out;
  var helpoutput=document.getElementById('helpoutput');
  helpoutput.innerHTML += add;  
  UI.scrollatend(helpoutput.parentNode); // focus at end
  if (UI.focusaftereval) UI.focused.focus();
  },
  clean:function(text,quote){
    var cmd=text;
    if (quote) cmd=cmd.replace(/\'/g,'\\\'');
    cmd=cmd.replace(/>/g,'&gt;');
    cmd=cmd.replace(/</g,'&lt;');
    return cmd;
  },
  renderhelp: function(text){
  var s=text.substr(1,text.length-2);
  var pos0=s.search("</b>");
  var found=(s.substr(pos0+7,20)!="Best match has score");
  var lh=s.substr(3,pos0-3);
  if (found)
    lh=' (<a href="'+UI.docprefix+eval('longhelp.'+lh)+'" target="_blank">+ de d&eacute;tails</a>)';
  //Module.print(lh);
  var sorig=s;  
  pos1=s.search("<br>");
  if (pos1<0) return sorig;
  var explication=s.substr(0,pos1);
  s=s.substr(pos1+4,s.length-pos1-4);
  pos1=s.search("<br>");
  if (pos1<0) return sorig;
  var syntaxe=s.substr(0,pos1);
  s=s.substr(pos1+4,s.length-pos1-4);
  pos1=s.search("<br>");
  if (pos1<0) return sorig;
  var voiraussi=s.substr(0,pos1);
  var examples=s.substr(pos1+4,s.length-pos1-4);
  if (found)
    s = explication+lh+'<br><tt>'+syntaxe+'</tt><br>Voir aussi: ';
  else
    s = explication.substr(0,pos0);
  while (true){
    pos1=voiraussi.search(',');
    if (pos1 < 0) break;
    var cmd=UI.clean(voiraussi.substr(0,pos1),false);
    if (found)
      s += '<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.addhelp(\'?\',\''+cmd+'\')">'+cmd+'</button>';
    else
      s += '<button class="bouton" onmousedown="event.preventDefault()" onclick="document.getElementById(\'helptxt\').value=\''+cmd+'\';UI.insert(UI.focused,\''+UI.clean(cmd,true)+'(\')">'+cmd+'</button>';
   voiraussi = voiraussi.substr(pos1+1,voiraussi.length-pos1-1);
  }
  if (found)
    s += '<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.addhelp(\'?\',\''+voiraussi+'\')">'+voiraussi+'</button>';
  else 
    s += '<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert(UI.focused,\''+voiraussi+'(\')">'+voiraussi+'</button>';
  pos1=examples.search(';');
  if (pos1>=0){
   s += '<br>Exemples: ';
   while (true){
    pos1=examples.search(';');
    if (pos1<0) break;
    var cmd=examples.substr(0,pos1);
    cmd=UI.clean(cmd,false);
    s += '<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert(UI.focused,\''+UI.clean(cmd,true)+'\')">'+cmd+'</button>';
    examples = examples.substr(pos1+1,examples.length-pos1-1);
   }
  }
  s += '<button class="bouton" onmousedown="event.preventDefault()" onclick="UI.insert(UI.focused,\''+UI.clean(examples,true)+'\')">'+examples+'</button>';
  //console.log(s);
  return s;
  },
getsel:function(field){
 var startPos = field.selectionStart;
var endPos = field.selectionEnd;
    var selectedText = field.value.substring(startPos, endPos);
  return selectedText;
  },
move_caret_or_focus:function(field,n){
 UI.moveCaret(field,n); return;
 if (UI.detectmob()){ UI.moveCaret(field,n); return; }
 while(n>=1){ UI.move_focus(field,1); n--; }
 while(n<=-1){ UI.move_focus(field,-1); n++; }
},
 set_focused: function(field){ UI.focused=field;},
 set_focus:function(s){
  var tmp=document.getElementById(s);
  UI.focused=tmp;
  if (!UI.is_touch_device()) tmp.focus();
 },
move_focus:function(field,n){
 // focus on next or previous history level
 if (n>0){
  if (field==cmentree) return;
  if (field.type!="textarea")
   field=field.getTextArea();
  if (field.previousSibling==null){
   var par=field.parentNode;
   UI.switch_buttons(par.parentNode,true)
   par=par.nextSibling;
   par=par.firstChild;
   if (par.nextSibling==null){
     par=par.parentNode.parentNode.parentNode.nextSibling;
     if (par==null) cmentree.focus(); // console.log(par);
     else {
      UI.switch_buttons(par.firstChild,true) 
      par=par.firstChild.firstChild.nextSibling.nextSibling.firstChild;
      par.focus();
     }
     return;
   }
   par.style.display='none';
   par=par.nextSibling;
   par.style.display='inherit';
   par.select();
   UI.set_focused(par);
   par.focus();
   return;
  }
  var bidon=field.previousSibling;
  if (bidon.style.display!='none') return;
  bidon.style.display='block';
  field.style.display='none';
  var par=field.parentNode.parentNode.parentNode.nextSibling;
  if (par==null) {
   UI.set_focused(cmentree); cmentree.focus();
   //  console.log(par);
  }
  else {
    UI.switch_buttons(par.firstChild,true) 
    par=par.firstChild.firstChild.nextSibling.nextSibling.firstChild;
    par.focus();
   }
  return;
 }
 if (field==cmentree){
  var par=document.getElementById('mathoutput').lastChild;
  if (par==null) return;
   UI.switch_buttons(par.firstChild,true) 
   par=par.firstChild.firstChild.nextSibling.nextSibling.nextSibling.firstChild;
   if (par.nextSibling==null){
    par=par.parentNode.previousSibling.firstChild;
    par.focus(); return;
   } 
   //console.log(par.innerHTML);
   par.style.display='none';
   par=par.nextSibling;
   par.style.display='inherit';
   par.select();
   UI.set_focused(par);
   par.focus();
   return;
 }
  if (field.type!="textarea")
   field=field.getTextArea();
  if (field.previousSibling==null){
   var par=field.parentNode.parentNode.parentNode.previousSibling;
   UI.switch_buttons(par.firstChild,true) 
   par=par.firstChild.firstChild.nextSibling.nextSibling.nextSibling.firstChild;
   if (par.nextSibling==null){
    //console.log(par.nextSibling);
    par=par.parentNode.previousSibling.firstChild;
    par.focus(); return;
   } 
   par.style.display='none';
   par=par.nextSibling;
   par.style.display='inherit';
   par.select();
   UI.set_focused(par);
   par.focus();
   return;
  }
  var bidon=field.previousSibling;
  if (bidon.style.display!='none') return;
  bidon.style.display='block';
  field.style.display='none';
  var par=field.parentNode.previousSibling.firstChild;
  par.focus();
  UI.switch_buttons(par.parentNode.parentNode,true) 
},
selline:0,
selch:0,
setselbeg:function(field){
  if (field.type!="textarea"){
    var pos=field.getCursor(); // save position
    UI.selline=pos.line; UI.selch=pos.ch;
    //console.log(UI.selline,UI.selch);
    return;
  }
  UI.selch=field.selectionStart;
},
setselend:function(field){
  if (field.type!="textarea"){
    var startpos=field.getCursor(); // current position
    field.setSelection({line: UI.selline,ch:UI.selch },startpos);
    field.refresh();
    UI.selection=field.getSelection();
    return;
  }
  var pos1=field.selectionStart;
  var pos2=UI.selch;
  if (pos2>field.value.length) pos2=field.value.length;
  if (pos1>pos2){ var tmp=pos1; pos1=pos2; pos2=tmp; }
  field.setSelectionRange(pos1,pos2);
  UI.selection=field.value.substr(pos1,pos2-pos1);
},
indentline:function(field){
 if (field.type!='textarea') field.execCommand('indentAuto');
},
moveCaret: function(field, charCount) {
  if (field.type!="textarea"){
    var pos=field.getCursor();
    pos.ch = pos.ch+charCount;
    field.setCursor(pos);
    field.refresh();
    // UI.show_curseur();
    return;
  }
  var pos=field.selectionStart;
  pos = pos+charCount;
  if (pos<0) pos=0;
  if (pos>field.value.length) pos=field.value.length;
  field.setSelectionRange(pos,pos);
  },
show_curseur:function(){
  document.getElementsByClassName("CodeMirror-cursors")[0].style.visibility = "visible";
  var cursors = document.getElementsByClassName("CodeMirror-cursor");
  for (var i = 0; i < cursors.length; i++) {
     cursors[i].style.visibility = "visible";
   }
},
moveCaretUpDown: function(field, Count) {
  if (field.type!="textarea"){
    var pos=field.getCursor();
    pos.line = pos.line+Count;
    field.setCursor(pos);
    field.refresh();
    //UI.show_curseur();
    return;
  }
  if (Count<-1){
    var i;
    for (i=0;i>Count;i--)
     UI.moveCaretUpDown(field,-1);
    return;
  }
  if (Count>1){
    var i;
    for (i=0;i<Count;i++)
     UI.moveCaretUpDown(field,1);
    return;
  }
  var pos=field.selectionStart;
  var s=field.value;
  var cur=pos,shift=pos+1,pos1;
  cur--;
  if (cur>=s.length) cur--;
  for (;cur>=0;cur--){
    if (s.charCodeAt(cur)==10){ shift=pos-cur; break; }
  }
  if (Count==-1){
   if (cur<0) return;
   pos1=cur;cur--;
   for (;cur>=0;cur--){
     if (s.charCodeAt(cur)==10) break;
   }
   //console.log(cur,shift);
   pos=cur+shift;
   if (pos>pos1) pos=pos1;
  }
  if (Count==1){
    cur=pos;
    for (;cur<s.length;cur++){
      if (s.charCodeAt(cur)==10) break;
    }
    pos=cur+shift;
    if (pos>=s.length) return;
    pos1=pos;
    for (;pos1>cur;pos1--){
      if (s.charCodeAt(pos1)==10) pos=pos1;
    }
  }
  if (pos<0) pos=0;
  if (pos>field.value.length) pos=field.value.length;
  field.setSelectionRange(pos,pos);
  },
  erase: function(field){
  var par=field.parentNode;
  par=par.parentNode;
  //par.style.display='none';
  par.style.visibility='hidden';
  if (UI.focusaftereval) UI.focused.focus();
  par=par.parentNode;
  var list = par.parentNode;
  if (list.id=='helpoutput')
    list.removeChild(par);
  },
  erase_all_warn:1,
  erase_all: function(field){
    var cur=field.firstChild;
    while (cur){
     //cur.firstChild.style.display='none';
     cur.firstChild.style.visibility='hidden';
     cur=cur.nextSibling;
    }
    if (UI.erase_all_warn==1){
     alert('Pour annuler, cliquer sur Restaurer (Corbeille). Pour confirmer, cliquer sur Vider (Corbeille).');
     UI.erase_all_warn=0;
    }
    if (UI.focusaftereval) cmentree.focus();
  },
  restoretrash:function(){
  var hist=document.getElementById('mathoutput');
  var cur=hist.firstChild;
  while (cur){
    //if (cur.style.display=='none') cur.style.display='block';
    if (cur.firstChild.style.visibility=='hidden') cur.firstChild.style.visibility='visible';
    cur=cur.nextSibling;
  }
  },
  emptytrash:function(){
  var hist=document.getElementById('mathoutput');
  var cur=hist.firstChild;
  while (cur){
    var nxt=cur.nextSibling;
    //if (cur.firstChild.style.display=='none') hist.removeChild(cur);
    if (cur.firstChild.style.visibility=='hidden') hist.removeChild(cur);
   cur=nxt;
  }
   UI.link(0);
  },
updatelevel: function(field){
  var pos=field.selectionStart;
  field.innerHTML=field.value;
  if (pos>=0 && pos<field.value.length)
    field.setSelectionRange(pos,pos);
},
  moveup: function(field){
  var par=field.parentNode;
  par=par.parentNode;
  par=par.parentNode;
  var prev=par.previousSibling;
  var list = par.parentNode;
  list.removeChild(par);
  list.insertBefore(par,prev);
  if (UI.focusaftereval) UI.focused.focus();
  },
  movedown: function(field){
  var par=field.parentNode;
  par=par.parentNode;
  par=par.parentNode;
  var nxt=par.nextSibling;
  nxt=nxt.nextSibling;
  var list = par.parentNode;
  list.removeChild(par);
  list.insertBefore(par,nxt);
  },
  backspace: function(field){
    //if (UI.focusaftereval) field.focus();
    if (field.type!="textarea"){
      var start=field.getCursor('from');
      var end=field.getCursor('to');
      if (end.line!=start.line || end.ch!=start.ch)
        field.replaceSelection('');
      else {
        var c=start.ch; var l=start.line;
        if (start.ch==0 && start.line==0) return;
        if (c>0){ c--; field.replaceRange('',{line: l,ch:c},end); }
        else { l--; var s=field.getRange({line: l,ch:c},end); field.replaceRange('',{line: l,ch:s.length-1},end); }
      }
      var t=field.getTextArea(); t.value=field.getValue();
    } else {
      var pos = field.selectionStart;
      var pos2 = field.selectionEnd;
      var s=field.value;
      if (pos<pos2){
        field.value = s.substring(0, pos)+s.substring(pos2,s.length);
        if (pos<0) pos=0;
        if (pos>field.value.length) pos=field.value.length;
        field.setSelectionRange(pos,pos);
        UI.resizetextarea(field);
        return;
      }
      if (pos>0){
        field.value = s.substring(0, pos-1)+s.substring(pos,s.length);
        pos--;
        if (pos<0) pos=0;
        if (pos>field.value.length) pos=field.value.length;
        field.setSelectionRange(pos,pos);
        UI.resizetextarea(field);
      }
    }
  },
insert: function(myField, myValue) {
 //console.log(myField.type, myValue);
 if (UI.focusaftereval) myField.focus();
 if (myField.type!="textarea" && myField.type!="text"){
  myField.replaceSelection(myValue);
  myField.execCommand("indentAuto");
  var t=myField.getTextArea(); t.value=myField.getValue();
 }
 else {
  var pos=myField.selectionStart;
  pos=pos+myValue.length;
  //IE support
  if (document.selection) {
    if (UI.focusaftereval) myField.focus();
    var sel = document.selection.createRange();
    sel.text = myValue;
  }
  //MOZILLA and others
  else {
    var startPos = myField.selectionStart;
    var endPos = myField.selectionEnd;
    if (myField.selectionStart || myField.selectionStart == '0') {
        myField.value = myField.value.substring(0, startPos)
            + myValue
            + myField.value.substring(endPos, myField.value.length);
    } else {
        myField.value += myValue;
    }
  }
  myField.setSelectionRange(pos,pos);
  UI.resizetextarea(myField);
  }
// UI.show_curseur();
},
  resizetextarea:function(field){
    if (field.type!='textarea') return;
    var s=field.value;
    var N=0,i,n=s.length,c;
    for (i=0;i<n;i++){
      c=s.charCodeAt(i);
      if (c==10) N++;
    }
    field.rows=N+1;
  },
  changefontsize:function(field,size){
    field.getWrapperElement().style["font-size"] = size+"px";
    field.refresh();
  }
  }; // closing UI={
  // remove existing codemirror field
  prog=document.getElementById('prog');
  if (prog && prog.nextSibling){
    prog.parentNode.removeChild(prog.nextSibling);
  }
  if (entree && entree.nextSibling){
    entree.parentNode.removeChild(entree.nextSibling);
  }
  document.getElementById('canvas').onmousemove=function(event){ UI.canvas_mousemove(event,'');};
  document.getElementById('output').style.display='none';
  document.getElementById("config").reset();
  // connect to canvas  
 var Module = {
        worker:false,
        htmlcheck:true,
        htmlbuffer:'',
        preRun: [],
        postRun: [],
        print: (function() {
          var element = document.getElementById('output');
          element.innerHTML='';// element.value = ''; // clear browser cache
          return function(text) {
            //console.log(text.charCodeAt(0));
            if (text.length==1 && text.charCodeAt(0)==12){ element.innerHTML=''; return; }
            if (text.length>=1 && text.charCodeAt(0)==2) {console.log('STX');Module.htmlcheck=false; htmlbuffer='';return;}
            if (text.length>=1 && text.charCodeAt(0)==3) {console.log('ETX');Module.htmlcheck=true; element.style.display='inherit'; element.innerHTML += htmlbuffer;htmlbuffer='';element.scrollTop = 99999; return;}
            if (Module.htmlcheck){
            // These replacements are necessary if you render to raw HTML 
             text = ''+text;
             text = text.replace(/&/g, "&amp;");
             text = text.replace(/</g, "&lt;");
             text = text.replace(/>/g, "&gt;");
             text = text.replace(/\n/g, '<br>');
             text += '<br>'
             document.getElementById('consolediv').style.display='block';
             element.style.display='inherit';
             element.innerHTML += text; // element.value += text + "\n";
             element.scrollTop = 99999; // focus on bottom
            } else htmlbuffer += text;
          };
        })(),
        printErr: function(text) {
          if (0) { // XXX disabled for safety typeof dump == 'function') {
            dump(text + '\n'); // fast, straight to the real console
          } else {
            console.log(text);
          }
        },
        canvas: document.getElementById('canvas'),
        setStatus: function(text) {
          if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
          var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
          var statusElement = document.getElementById('status');
          var progressElement = document.getElementById('progress');
          if (m) {
            text = m[1];
            progressElement.value = parseInt(m[2])*100;
            progressElement.max = parseInt(m[4])*100;
            progressElement.hidden = false;
          } else {
            progressElement.value = null;
            progressElement.max = null;
            progressElement.hidden = true;
          }
          statusElement.innerHTML = text;
        },
        totalDependencies: 0,
        monitorRunDependencies: function(left) {
          this.totalDependencies = Math.max(this.totalDependencies, left);
          Module.setStatus(left ? 'Preparation... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'Telechargements termines.');
        }
      };
      Module.setStatus('T&eacute;l&eacute;chargement et pr&eacute;paration (peut prendre 1 ou 2 minutes la premi&egrave;re fois)');
</script>      
<script type='text/javascript'>
</script>

<script src="giac.js" async></script>
<script src="longhelp.js"></script>

<script language="javascript">
  CodeMirror.registerHelper("hintWords", "simplemode",UI.xcascmd);
  var ua = window.navigator.userAgent;
  var old_ie = ua.indexOf('MSIE ');
  var new_ie = ua.indexOf('Trident/');
  if ((old_ie > -1) || (new_ie > -1) || Boolean(window.chrome)){
 (function () {
  var script = document.createElement("script");
  script.type = "text/javascript";
  script.src  = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_CHTML";
  document.getElementsByTagName("head")[0].appendChild(script);
})();
}
</script>

<script language="javascript">
  document.getElementById('shift_key').style.backgroundColor="cyan";
  cmentree=entree;
  window.onresize=UI.set_config_width;
// En ajoutant async a la fin de script src=giac.js on accelere les chargements
// de la page nue (cache), mais pas si il y a un lien
  window.onload = function(e){
  //UI.caseval('abc(x=0); [x, y]; z+1;');
  var form=document.getElementById('config');
  var hw=window.innerWidth-50;
  var access=true;
  if (hw>=1000){ UI.qa=true; UI.usecm=true; form.qa.checked=true; form.usecm.checked=true; } else {UI.qa=false;UI.usecm=true; form.qa.checked=false; form.usecm.checked=true; access=false; document.getElementById('button_show_answers').style.display='none'; document.getElementById('button_hide_answers').style.display='none';}
  var ua = window.navigator.userAgent;
  var old_ie = ua.indexOf('MSIE ');
  var new_ie = ua.indexOf('Trident/');
  if (Boolean(window.chrome) && window.location.href.substr(0,4)!='file') UI.prettyprint=false;
  if ((old_ie > -1) || (new_ie > -1)) UI.isie=true;
  var bt=UI.browser_type();
  if (UI.isie || (bt!=1 && bt!=2)){
    UI.usemathjax=true;
    var alertmsg="Les calculs seraient plus rapides avec Firefox.";
    if (Boolean(window.chrome)){
      if (window.location.href.substr(0,4)=='file')
        alertmsg="Les cookies ne fonctionnent pas en local avec Chrome, la sauvegarde/restauration de sessions est impossible. "+alertmsg;
      else
        alertmgs="L'affichage 2d ne fonctionne pas en distant avec Chrome. "+alertmsg;
    }
    alert(alertmsg);
  }
  //console.log(window.location.href);
 if (!UI.is_touch_device()) w3IncludeHTML(); // contextmenu
 //if (bt==1 && hw>=1000 && window.location.href.substr(0,4)=="http") w3IncludeHTML();
 document.getElementById('apropos').style.display='none';
 document.getElementById('help').style.display='none';
 console.log("window.onload");
  // config in cookies
  var ck;
  ck=UI.readCookie('xcas_digits');
  if (ck) form.digits_mode.value=eval(ck);
  ck=UI.readCookie('xcas_angle_radian');
  if (ck) form.angle_mode.checked=(ck=='1');
  ck=UI.readCookie('xcas_complex_mode');
  if (ck) form.complex_mode.checked=(ck=='1');
  ck=UI.readCookie('xcas_with_sqrt');
  if (ck) form.sqrt_mode.checked=(ck=='1');
  ck=UI.readCookie('xcas_step_infolevel');
  if (ck) form.step_mode.checked=(ck=='1');
  ck=UI.readCookie('xcas_autosimplify');
  if (ck) form.autosimp_level.value=eval(ck);
  ck=UI.readCookie('xcas_docprefix');
  if (ck) UI.docprefix=ck;
  ck=UI.readCookie('xcas_withworker');
  if (ck) form.worker_mode.checked=(ck=='1');
  UI.withworker=form.worker_mode.checked;
  ck=UI.readCookie('xcas_prettyprint');
  if (ck) form.prettyprint.checked=(ck=='1');
  UI.prettyprint=form.prettyprint.checked;
  ck=UI.readCookie('xcas_qa'); 
  if (ck) form.qa.checked=UI.qa=(ck=='1');
  ck=UI.readCookie('xcas_usecm');
  if (ck) form.usecm.checked=UI.usecm=(ck=='1');
  ck=UI.config_string(); console.log(ck);
  // UI.sleep(1000);
  if (0) UI.caseval(ck); else UI.initconfigstring=ck; //UI.set_config_width();
  ck=UI.readCookie('xcas_matrix_maxrows');
  ck=eval(ck);
  if (ck>0 && ck<=1000){ UI.assistant_matr_maxrows=ck; document.getElementById('matr_cfg_rows').value=ck;}
  ck=UI.readCookie('xcas_matrix_maxcols');
  ck=eval(ck);
  if (ck>0 && ck<=100){ UI.assistant_matr_maxcols=ck; document.getElementById('matr_cfg_cols').value=ck;}
  ck=UI.readCookie('xcas_matrix_textarea');
  ck=eval(ck);
  if (ck>0 && ck<=100){ UI.assistant_matr_textarea=ck; document.getElementById('matr_textarea').checked=ck;}
  UI.assistant_matr_setmatrix(UI.assistant_matr_maxrows,UI.assistant_matr_maxcols);
 var hist=document.getElementById('mathoutput');
 var doexec=false;
 var asked=false;
 if (hist.firstChild){
  asked=true;
  if (!UI.withworker && confirm('Voulez-vous executer les commandes de l\'historique?')) {
   doexec=true;
  }
  // else {alert('Historique non execute');}
 }
 var hashParams = window.location.hash.substr(1);
 // substr(1) to remove the `#`
 if (UI.readCookie('xcas_session')!=null)
  {document.getElementById('startup_restore').style.display='inline'; document.getElementById('startup1').style.display='none';}
 //UI.restoresession(hashParams,hist,asked,doexec);
  window.setTimeout(UI.restoresession,200,hashParams,hist,asked,doexec);
 if (access)
  document.getElementById('startup2').style.display='block';
}
</script>

</body>
</html>