File: xcasen.html

package info (click to toggle)
giac 1.6.0.41%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 64,540 kB
  • sloc: cpp: 351,842; ansic: 105,138; python: 30,545; javascript: 8,675; yacc: 2,690; lex: 2,449; makefile: 1,243; sh: 579; perl: 314; lisp: 216; asm: 62; java: 41; sed: 16; csh: 7; pascal: 6
file content (3893 lines) | stat: -rw-r--r-- 287,260 bytes parent folder | download
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
<!DOCTYPE HTML>
<html id="fulldocument" lang="en">
<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, browser, computer algebra system, online, offline">
  <title>
    xcas or python
  </title>
  <style>
    html {
      background-color: #FFFFFF;
    }

    body {
      color: black;
      text-align: justify;
      background-color: #FFFFFF;
    }

    .curseur {
      min-width: 25px;
      height: 35px
    }

    .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">
    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: 80px;
      height: 20px
    }

    .historyinput {
      width: 400px;
    }
  </style>
  <style type="text/css">
    .matrixcell {
      font-size: 18px;
      width: 80px;
    }

    td.matrixcell {
      border: 1px solid;
    }

    input.matrixcell {
      width: 80px;
    }

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

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

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

    textarea.matrixcell {
      width: 80px;
      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>
  <script>
      // Redirect to HTTPS page if not testing locally
      if (location.protocol === 'http:' && location.hostname !== 'localhost' && location.hostname !== '127.0.0.1') {
          location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
      }
  </script>
  <script>
    function $id(id) { return document.getElementById(id); }
  </script>
</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 intShiftKey = winObj.shiftKey;
        var intAltKey = winObj.altKey;
        var intCtrlKey = winObj.ctrlKey;
        var done = false;
        if (intShiftKey && intKeyCode == KEY_ENTER) {
            UI.insert(UI.focused, '\n');
            done = true;
        }
        // raccourcis avec Alt
        // F1 aide, c cmdline, m menu,
        if (!done && (intAltKey || intCtrlKey)) {
            if (intKeyCode == KEY_D || intKeyCode == KEY_RIGHT) {
                UI.move_focus(UI.focused, 1);
                done = true;
            }
            if (intKeyCode == KEY_G || intKeyCode == KEY_LEFT) {
                UI.move_focus(UI.focused, -1);
                done = true;
            }
            if (intKeyCode == KEY_DOWN) {
                UI.move_focus(UI.focused, 1);
                UI.move_focus(UI.focused, 1);
                done = true;
            }
            if (intKeyCode == KEY_UP) {
                UI.move_focus(UI.focused, -1);
                UI.move_focus(UI.focused, -1);
                done = true;
            }
            if (intKeyCode == KEY_A) {
                var tmp = $id('helptxt');
                tmp.focus();
                tmp.scrollIntoView(false);
                done = true;
            }
            if (intKeyCode == KEY_C && intAltKey) {
                if (UI.focused != cmentree) {
                    if (UI.focused.type == 'textarea') UI.insert(cmentree, UI.focused.value);
                    if (UI.focused.getValue) UI.insert(cmentree, UI.focused.getValue());
                    cmentree.focus();
                }
                done = true;
            }
            if (intKeyCode == KEY_B) {
                cmentree.focus();
                done = true;
            }
            if (intKeyCode == KEY_M) {
                UI.show_menu();
                done = true;
            }
            if (intKeyCode == KEY_T) {
                $id('progbuttons').style.display = 'block';
                $id('boutons_tortue').style.display = 'block';
                UI.hide_show_xcas('boutons_tortue_xcas');
                done = true;
            }
            if (intKeyCode == KEY_P) {
                $id('prog_key').click();
                done = true;
            }
            if (intKeyCode == KEY_TAB || intKeyCode == KEY_PF1) {
                UI.completion(cmentree);
                done = true;
            }
            if (intKeyCode == KEY_E || intKeyCode == KEY_F) {
                UI.exec($id('mathoutput'), 0);
                done = true;
            }
            if (intKeyCode == KEY_N) {
                var field = $id('output');
                field.innerHTML = '';
                $id('consolediv').style.display = 'none';
                $id('settings').scrollIntoView();
                UI.set_config_width();
            }
        }
        if (done) {
            // --- Map the keyCode in another keyCode not used
            winObj.keyCode = REMAP_KEY_T;
            winObj.returnValue = false;
            return false;
        }
        return true;
    }

    document.onkeydown = applyKey;

</script>
<div id="startup2" style="display:none">
  <button onclick="if (UI.usecm){ $id('config').usecm.checked=false;  UI.set_config(false);} cmentree.focus();">Version
  </button>
  for visually impaired,
  <a href="xcasfr.html#lang=fr" target="_blank">version francaise</a>.
</div>
<div id="startup1">
  Welcome to Xcas for Firefox or compatible browser
  (c) 2020, B. Parisse and R. De Graeve, Institut Fourier,
  Universit&eacute; de Grenoble.
</div>
<div id="startup">
  If Xcas doesn't work
  <a
      href="https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache"
      target="_blank">clear your browser cache</a> and reload
  <span id="startup_restore" style="display:none">
            <br>
            Restore last session
            <button title="Load last session and execute it automatically"
                    onclick="var s=UI.readCookie('xcas_session');UI.restoresession(s,$id('mathoutput'),false,true);">evaled</button> or
            <button title="Load last session, you must execute it manually"
                    onclick="var s=UI.readCookie('xcas_session');UI.restoresession(s,$id('mathoutput'),false,false);">not</button>
            </span>
  <hr>
</div>
<form id="config" style="display:none" onsubmit="setTimeout(function(){
            UI.set_config(true);
            }); return false">
  <h3>Configuration</h3>
  <table>
    <tr>
      <td>
        personal e-mail <input class="bouton" type="text" name="from"
                               title="Fill with your personal email address"
                               value="">
        default to <input class="bouton" type="text" name="to"
                          title="Fill with the email address of the person who you are sending frequently sessions, for example the teacher email for a student"
                          value="">,
        help language
        <input type="radio" name="lang" value="radio" title="French">fr
        <input type="radio" name="lang" value="radio" title="English" checked>en
        <input type="radio" name="lang" value="radio" title="Spanish">sp
        <input type="radio" name="lang" value="radio" title="Greek">el
        <input type="radio" name="lang" value="radio" title="Deutsch">de
	<br> Export to
        <input type="radio" name="calc" value="radio" title="Casio" checked>Casio Prizm or Fx-9750GIII
        <input type="radio" name="calc" value="radio" title="Numworks">Numworks
        <input type="radio" name="calc" value="radio" title="Nspire">TI Nspire CX
      </td>
    </tr>
    <tr>
      <td>
        Digits:<input class="bouton" type="number" name="digits_mode"
                      title="Number of digits. If &gt; 14, computations are more accurate but slower"
                      value=12>
        Autosimplification: <input class="bouton"
                                   type="number" name="autosimp_level"
                                   title="0: none, 1: minimum, 2: maximum" value=1
                                   max=2 min=0>
        Syntax <input class="bouton" type="button" value="Python"
	onclick="python_mode.checked=!python_mode.checked;">
	<input
          class="bouton" type="checkbox" name="python_mode" title="Check to enable Python syntax compatibility">,
	MicroPython <input class="bouton" type="checkbox" name="python_xor"
	title="If checked, interpreter is MicroPython, otherwise Xcas">,
        <input class="bouton" type="button" title="Display Python alerts" value="warnings" onclick="warnpy_mode.checked=!warnpy_mode.checked">
        <input class="bouton" type="checkbox" name="warnpy_mode"
               title="Check to display Python alerts" checked>
      </td>
    </tr>
    <tr>
      <td>
        <input class="bouton" type="button"
               title="Choose angle unit: degrees or radians"
               value="Radians" onclick="angle_mode.checked=!angle_mode.checked;">
        <input class="bouton" type="checkbox" name="angle_mode"
               title="Check for radians, uncheck for degrees" checked>,
        <input class="bouton" type="button" title="Complex or real mode"
               value="Complex"
               onclick="complex_mode.checked=!complex_mode.checked"> <input
          class="bouton" type="checkbox" name="complex_mode" title="If checked, some commands like factor will work on C by default">,
        <input class="bouton" type="button" title="Factor degree 2 polynomials even if they are irreducible over Q" value=" √ " onclick="sqrt_mode.checked=!sqrt_mode.checked"> <input class="bouton" type="checkbox" name="sqrt_mode" title="Check if you want to factor degree 2 polynomials even if they are irreducible over Q">,
        <input class="bouton" type="button" title="Show intermediate steps" value="step" onclick="step_mode.checked=!step_mode.checked">
        <input class="bouton" type="checkbox" name="step_mode" title="Check if you want to display intermediate steps">,
        <input class="bouton" type="button" title="Run computations with a webworker" value="worker"
               onclick="worker_mode.checked=!worker_mode.checked"> <input
          class="bouton" type="checkbox" name="worker_mode" title="Check to run computations with a webworker">
        <input class="bouton" type="button" title="Use web-assembly if possible" value="wasm" onclick="wasm_mode.checked=!wasm_mode.checked"> <input class="bouton" type="checkbox" name="wasm_mode" title="Check to run computations with web-assembly">
      </td>
    </tr>
    <tr>
      <td>
        <input class="bouton" type="button" title="2d display switch" value="2d" onclick="prettyprint.checked=!prettyprint.checked"> <input class="bouton" type="checkbox" name="prettyprint"
                                                                                                                                            title="Check for 2d display" checked>,
        <input class="bouton" type="button"
               title="Questions and answers on the same line"
               value="Q/A on 1 line"
               onclick="qa.checked=!qa.checked"> <input class="bouton" type="checkbox" name="qa"
                                                        title="Check to have questions and answers on the same line"
      >,
        <input class="bouton" type="button"
               title="Syntax highlighting"
               value="Syntax highlighting"
               onclick="usecm.checked=!usecm.checked"> <input class="bouton" type="checkbox" name="usecm"
                                                              title="Check to have syntax highlighting"
      >
        <input class="bouton" type="button"
               title="Move and del buttons always visible"
               value="Del visible" onclick="fixeddel.checked=!fixeddel.checked"> <input class="bouton" type="checkbox" name="fixeddel"
                                                                                        title="Move and del buttons always visible"
                                                                                        checked>
      </td>
    </tr>
    <tr>
      <td>
        Turtle <input class="bouton" type="number" name="canvas_w" value=400
                      title="Turtle graph width">
        by <input class="bouton" type="number" name="canvas_h" value=300
                  title="Turtle graph height">
        Out <input class="bouton" type="number" name="outdiv_width" value=410
                   title="Max width for answer fields"
      >
        by <input class="bouton" type="number" name="outdiv_height" value=190
                  title="Max height for answer fields"
      >
      </td>
    </tr>
    <tr>
      <td>
        Maximal size for matrix assistant
        <input class="bouton" type="number" name="matr_cfg_rows" id="matr_cfg_rows"
               title="Lines number" value=40 min=1 max=1000>,
        <input class="bouton" type="number" name="matr_cfg_cols" id="matr_cfg_cols"
               title="Columns number" 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="Check for resizable cells"
        >
        resizable
      </td>
    </tr>
    <tr>
      <td>
        Documentation <input class="bouton" type="checkbox" name="online_doc"
                             title="Check if Xcas is not installed, documentation will be retrieved from Internet"
                             checked>online
        <input class="bouton" type="text" name="doc_path" size="60"
               value="/usr/share/giac/doc/en/cascmd_en/"
               title="Offline documentation path on linux, for Mac add /Applications prefix"
        >
      </td>
    </tr>
  </table>
  <input class="bouton" type="submit" title="ok" value="&#x2705;">
  <input class="bouton" type="button"
         title="Cancel configuration changes"
         value="&#x274C;" onclick="form.style.display='none';  UI.focused.focus();">
  <hr>
</form>
<button id="settings" class="bouton" onclick="UI.show_config()"
        title="Modify settings"
>
  <img WIDTH="28" HEIGHT="28" SRC="config.png" alt="Configuration" align="center">
  <span id='curcfg'></span>
</button>
<span id='themailto'></span>
<span id='thelink'></span>
<textarea id='theforumlink' style="display:none"></textarea>
<span id="history1" style="display:none">
        <button class="bouton"
                title="Click here to save history (filename in the next textfield)"
                onclick="if ($id('loadbutton_file').style.display=='none') UI.savesession(2); else UI.savesession(0);">&#x1f4be;</button>
        <textarea cols="7" id="outputfilename" class="filenamecss"
                  style="font-size:large"
                  title="Saving session filename.">session</textarea>
        <button id="exportbutton" class="bouton"
                title="Export session to KhiCas (Casio Prizm or Fx-9750GIII, Numworks, TI Nspire CX, to be configured in the Settings)"
                onclick='UI.savesession(1);'>Export</button>
        </span>
<button id="loadbutton_cookie" class="bouton"
        title="Load session"
        onclick="$id('loadfile_cookie').innerHTML=UI.listCookies();">Load
</button>
<span id="loadfile_cookie"></span>
<form id="loadbutton_file" style="display:none">
  <label for="loadfileinput">Load</label>
  <input id="loadfileinput" accept=".xw" type="file" title="Insert a session" onchange="UI.loadfile(this.files);this.value=''">
</form>
<span id="help" style="display:none">
        <ul>
            <li style="display:inline">
                <button class="bouton"
                        onclick="$id('help').style.display='none';">
                <em>Hide documentation</em></button>
            </li>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutointro'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Introduction</strong></button>
                <div id="tutointro" style="display:none">
                    Type a computation or program in the commandline, for
                    example <tt>1/3+1/6</tt>.
                    Helpers are available by pressing <tt>Math</tt>
                    or <tt>Prog</tt> or <tt>123</tt> (scientific keyboard).
                    Press enter or hit &#x2705; to run the computation.
                    <br>
                    Find commandnames with the helpers or by reading the sections
                    below or in the
                    <a
                        href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/en/cascmd_en"
                        target="_blank">Xcas manual</a>.
                    To get online help on a command, enter the commandname and press
                    the <tt>?</tt> button or F1 key.
                </div>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutonet'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Share</strong></button>
                <div id="tutonet" style="display:none">
                    You can share a session by clicking on the &#x282A; button.
                    You can exchange Xcas sessions by email. Fill in once the email
                    fields in the Settings (topleft button).
                    You can send a session by clicking on the &#x2709; link, modify the To
                    field if necessary (if you are using a webmail that is not gmail, copy
                    the x2 link content inside a mail or configure your browser settings for
                    this webmail).
                    When you receive an Xcas session by email, click on the link, this
                    should open the session in your browser. You can modify the
                    session and send it back with the &#x2709; link.
                    <br>
                    When you send a session by email, the filename of the session
                    will be modified by prefixing the sender email, except if the
                    sessionname contains @ (it remains unchanged, except if the filename begins
                    with @, then the leading @ is removed).
                    <br>
                    Example: a teacher sends to his students a session named
                    <tt>@exercise</tt> with a mail alias or by sharing on the forum (&#x282A;),
                    the students filename session will be <tt>exercise</tt>,
                    they do the work and send it back to the teacher (&#x2709; link),
                    the session received by the teacher is named with the email
                    address of the student prefixed, it's easy for him to know
                    who he is correcting. The teacher can send the session back,
                    the session name remains unchanged.
                </div>
            </li>
          </li>
          <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutoinst'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Install</strong></button>
                <div id="tutoinst" style="display:none">
                    You can optionally install Xcas on your device, in order to run it
                    in airplane mode (without Internet connection).
                    <br>
                    To install Xcas for Firefox on a mobile device, download
                    <a
                        href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/xcashtml.zip"
                        target="_blank">
                    xcashtml.zip</a>,
                    unzip it (for example with Androzip on Android),
                    search the <tt>xcasen.html</tt> file and open it with your
                    browser (Firefox recommended). You can create a shortcut
                    on your welcome screen for easy access.
                    <br>
                    On PC/Mac: if you have Xcas native &gt;1.4.9-57 already installed, Xcas for
                    Firefox is already installed, otherwise do like on mobile.
                    <ul>
                        <li> Windows: locate the file <tt>xcasen.html</tt>
                            in the <tt>doc</tt> subdirectory inside the install directory
                            of Xcas, by default <tt>c:\xcas</tt>.
                        <li> Mac:<a href="file:///Applications/usr/share/giac/doc/xcasen.html"
                                    target="_blank"><tt>/Applications/usr/share/giac/doc/xcasen.html</tt></a>,
                        <li> Linux: <a href="file:///usr/share/giac/doc/xcasen.html"
                                       target="_blank"><tt>/usr/share/giac/doc/xcasen.html</tt></a>,
                    </ul>
		    If Xcas for Firefox does not work locally with
		    Firefox, disable
		    <tt>security.fileuri.strict_origin_policy</tt>
		    in <tt>about:config</tt>.
                </div>
            </li>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutoex'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Examples (highschool)</strong></button>
                <div id="tutoex" style="display:none">
                    Sessions examples
                    <ul>
                        <li>Variables,
                            types, affectation, tests, loop, function, syntax
                            <a
                                href="#exec&python=0&+///Enter%20commandlines%20in%20algebraic%20syntax,%20take%20care%20of%20parenthesis.%20Implicit%20multiplication%20is%20not%20supported%20except%20for%20number*symbol.&+1.2%3B%202*3%2B4%3B%202*(3%2B4)&+expand((x%2B1)%5E2)%3B%0Afactor(x%5E2%2B4x%2B4)%3B%0Asin(pi%2F3)&+///Variables,%20infix%20:=%20stores%20a%20value%20in%20a%20variable.&+a%3A%3D2&+2*a%2B5&+a%3A%3D2%3B%20type(a)&+a%3A%3D2.3%3B%20type(a)&+a%3A%3D%22hello%22%3B%20type(a)&+///A%20test&+a%3A%3D1%3B%20%0Aif%20a%3E0%20then%20%22positive%22%3B%20%0Aelse%20%22negative%22%3B%20fi%3B&+///A%20loop%20with%20known%20number%20of%20iterations.%20The%20output%20of%20print%20is%20visible%20in%20the%20console%20at%20the%20bottom.%0a&+for%20j%20from%201%20to%2010%20do%0A%20%20print(j%2B%22%20squared%20is%20%22%2Bj%5E2)%3B%20%0Aod%3B&+///A%20while%20loop,%20number%20of%20iterations%20is%20not%20known%20at%20the%20beginning.%20Illustrates%20the%20test%20precision%20with%20approx%20numbers.&+j%3A%3D1.0%3B%20%0Awhile%20j-1!%3Dj%20do%20%0A%20%20j%3D2*j%3B%20%0Aod%3B&+///Creation%20of%20a%20simple%20function,%20for%20example%20the%20midpoint%20of%20$A$%20and%20$B$.%20We%20first%20construct%20the%20midpoint%20interactively.&+A%3A%3Dpoint(1%2C2)%3B%20B%3A%3Dpoint(-2%2C-2)&+Ax%3A%3Dabscissa(A)%3B%20%0AAy%3A%3Dordinate(A)%3B%0ABx%3A%3Dabscissa(B)%3B%20%0ABy%3A%3Dordinate(B)&+///Now%20we%20compute%20the%20coordinates%20of%20$M$%20and%20we%20display%20the%203%20points.&+M%3A%3Dpoint((Ax%2BBx)%2F2%2C(Ay%2BBy)%2F2)%3B%0AA%3B%0AB%3B&+///Then%20we%20regroup%20these%20instructions%20in%20a%20function%20and%20we%20test%20it.&+function%20Midpoint(A%2CB)%0A%20%20var%20Ax%2CAy%2CBx%2CBy%3B%0A%20%20Ax%3A%3Dabscissa(A)%3B%20%0A%20%20Ay%3A%3Dordinate(A)%3B%0A%20%20Bx%3A%3Dabscissa(B)%3B%20%0A%20%20By%3A%3Dordinate(B)%3B%20%0A%20%20return%20point((Ax%2BBx)%2F2%2C(Ay%2BBy)%2F2)%3B%0Affunction%3A%3B&+A%3BB%3BM%3A%3DMidpoint(A%2CB)&+///%3Ch1%3eExercice%3C/h1%3e%20%0aWrite%20a%20%3Ctt%3eCircle(A,B,C)%3C/tt%3e%20function%20that%20compute%20the%20circumcircle%20of%20a%20triangle%20$ABC$%20using%20the%20commands%20%3Ctt%3eperpen_bissector,%20single_inter,%20distance,%20circle(center,%20radius)%3C/tt%3e&"
                                target="_blank">
                            Xcas</a> or
                            <a
                                href="#exec&python=1&+///Enter%20commandlines%20in%20algebraic%20syntax,%20take%20care%20of%20parenthesis.%20Implicit%20multiplication%20is%20not%20supported%20except%20for%20number*symbol.&+%23%20%0A1.2%0A2*3%2B4%0A2*(3%2B4)&+%23%20symbolics%0Anormal((x%2B1)%5E2)%0Afactor(x%5E2%2B4x%2B4)%0Asin(pi%2F3)&+///Variables,%20infix%20:=%20stores%20a%20value%20in%20a%20variable.&+a%3D2&+2*a%2B5&+type(a)&+a%3D2.3&+type(a)&+%23%0Aa%3D%22%22%0Atype(a)&+///A%20test&+%23%0Aa%3D1%0Aif%20a%3E0%3A%20%0A%20%20%20%20%22positive%22%0Aelse%3A%0A%20%20%20%20%22negati%22&+///A%20loop%20with%20known%20number%20of%20iterations.%20The%20output%20of%20print%20is%20visible%20in%20the%20console%20at%20the%20bottom.%0a&+for%20j%20in%20range(10)%3A%0A%20%20%20%20print(j%2B%22%20square%20is%20%22%2Bj%5E2)&+///A%20while%20loop,%20number%20of%20iterations%20is%20not%20known%20at%20the%20beginning.%20Illustrates%20the%20test%20precision%20with%20approx%20numbers.&+%23%0Aj%3D1.0%0Awhile%20j-1!%3Dj%3A%0A%20%20%20%20j%3D2*j&+///Creation%20of%20a%20simple%20function,%20for%20example%20the%20midpoint%20of%20$A$%20and%20$B$.%20We%20first%20construct%20the%20midpoint%20interactively.&+%23%20create%202%20points%0AA%3Dpoint(1%2C2)%20%0AB%3Dpoint(-2%2C-2)&+%23%20compute%20coordinates%0AAx%3Dabscissa(A)%20%0AAy%3Dordinate(A)%0ABx%3Dabscissa(B)%0ABy%3Dordinate(B)&+%23%20compute%20M%20and%20display%20it%0AM%3Dpoint((Ax%2BBx)%2F2%2C(Ay%2BBy)%2F2)%0AA%0AB&+///Now%20we%20compute%20the%20coordinates%20of%20$M$%20and%20we%20display%20the%203%20points.&+def%20Midpoint(A%2CB)%3A%0A%20%20%20%20%23%20local%20Ax%2CAy%2CBx%2CBy%3B%0A%20%20%20%20Ax%3Dabscissa(A)%0A%20%20%20%20Ay%3Dordinate(A)%0A%20%20%20%20Bx%3Dabscissa(B)%0A%20%20%20%20By%3Dordinate(B)%0A%20%20%20%20return%20point((Ax%2BBx)%2F2%2C(Ay%2BBy)%2F2)&+%23%0AA%0AB%0AM%3DMidpoint(A%2CB)&+///%3Ch1%3eExercice%3C/h1%3e%20%0aWrite%20a%20%3Ctt%3eCircle(A,B,C)%3C/tt%3e%20function%20that%20compute%20the%20circumcircle%20of%20a%20triangle%20$ABC$%20using%20the%20commands%20%3Ctt%3eperpen_bissector,%20single_inter,%20distance,%20circle(center,%20radius)%3C/tt%3e&"
                                target="_blank">Python</a>
                        </li>
                        <li> Turtle
                            Click on      <button onclick="$id('tutotortue').style.display='block';$id('tutoprog').style.display='none' ">
                            <strong>Turtle</strong>
                            </button> for examples (not translated).
                        </li>
                        <li> Step by step curve, syntax
                            <a
                                href="#exec&python=0&+///Define%20$f$%20by%20$f(x)=-x^2-3$%20if%20$x%3C0$%20and%20$f(x)=x^2+1$%20otehrwise.&+f(x)%3A%3Dif%20x%3C0%20then%20-x%5E2-3%20%0A%20%20else%20x%5E2%2B1%20fi%3B&+///First%20do%20a%20table%20of%20values.&+L%3A%3D%5B%5D%3B%20%0Afor%20x%20from%20-3%20to%203%20step%200.5%20do%0A%20%20L.append(%5Bx%2Cf(x)%5D)%3B%0Aod%3B&+open_polygon(L)&+///There%20is%20a%20step%20in%20the%20representation,%20we%20should%20make%202%20polygonal%20lines,%20it's%20a%20good%20idea%20to%20make%20a%20function%20and%20call%20it%20twice.&+function%20tabval(f%2Cxmin%2Cxmax%2Cdx)%0A%20%20var%20x%2CL%3B%0A%20%20L%3A%3D%5B%5D%3B%0A%20%20for%20x%20from%20xmin%20to%20xmax%20step%20dx%20do%0A%20%20%20%20L.append(%5Bx%2Cf(x)%5D)%3B%0A%20%20od%3B%0A%20%20return%20L%3B%0Affunction%3A%3B&+open_polygon(tabval(f%2C-3%2C-0.1%2C0.1))%3B%0Aopen_polygon(tabval(f%2C0.1%2C3%2C0.1))%3B&"
                                target="_blank">
                            Xcas</a> or
                            <a
                                href="#exec&python=1&+///Define%20$f$%20by%20$f(x)=-x^2-3$%20if%20$x%3C0$%20and%20$f(x)=x^2+1$%20otehrwise.&+def%20f(x)%3A%0A%20%20%20%20if%20x%3C0%3A%0A%20%20%20%20%20%20%20%20return%20-x%5E2-3%20%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20return%20x%5E2%2B1&+///First%20do%20a%20table%20of%20values.&+%23%0AL%3D%5B%5D%0Afor%20j%20in%20range(13)%3A%0A%20%20%20%20x%3D-3%2B0.5*j%0A%20%20%20%20L.append(%5Bx%2Cf(x)%5D)&+open_polygon(L)&+///There%20is%20an%20ugly%20%20step%20in%20the%20representation,%20we%20should%20make%202%20polygonal%20lines,%20it's%20a%20good%20idea%20to%20make%20a%20function%20and%20call%20it%20twice.&+def%20tabval(f%2Ca%2Cb%2Cdx)%3A%0A%20%20%20%20%23%20local%20x%2Cj%2CL%3B%0A%20%20%20%20L%3D%5B%5D%3B%0A%20%20%20%20for%20j%20in%20range((b-a)%2Fdx%2B1)%3A%0A%20%20%20%20%20%20%20%20x%3Da%2Bj*dx%0A%20%20%20%20%20%20%20%20L.append(%5Bx%2Cf(x)%5D)%0A%20%20%20%20return%20L%3B&+open_polygon(tabval(f%2C-3%2C-0.1%2C0.1))%3B%0Aopen_polygon(tabval(f%2C0.1%2C3%2C0.1))%3B&"
                                target="_blank">Python</a>
                        </li>
                        <li> approximate curve arc length
                            <a href="#exec&python=1&+///Approx%20curve%20arc%20length%20with%20a%20polygonal%20line.%0a$1/x$%20may%20be%20replaced%20by%20another%20expression%20$f(x)$.&+plot(1%2Fx%2Cx%2C1%2C4%2Ccolor%3Dred)%3B%20open_polygon(seq(point(x%2C1%2Fx)%2Cx%2C1%2C4))&+def%20Distance(xa%2Cxb)%3A%0A%20%20%20%20%23%20local%20ya%2Cyb%0A%20%20%20%20ya%3D1%2Fxa%0A%20%20%20%20yb%3D1%2Fxb%0A%20%20%20%20return%20sqrt((xb-xa)%5E2%2B(yb-ya)%5E2)&+Distance(1%2C2)%2BDistance(2%2C3)%2BDistance(3%2C4)&+def%20Length(xa%2Cxb%2CN)%3A%0A%20%20%20%20%23%20local%20h%2Cd%2Ck%0A%20%20%20%20h%3D(xb-xa)%2FN%0A%20%20%20%20d%3D0%0A%20%20%20%20for%20k%20in%20range(N)%3A%0A%20%20%20%20%20%20%20%20d%3Dd%2BDistance(xa%2Bk*h%2Cxa%2B(k%2B1)*h)%0A%20%20%20%20return%20d&+l%3A%3DLength(1%2C4%2C10)&+arclen(1%2Fx%2C1.0%2C4)%3B%20evalf(l)&"
                               target="_blank">Python</a>
                        </li>
                        <li> Line equation
                            <a
                                href="#exec&python=0&+A%3A%3Dpoint(-2%2C3)%3B%20%0AB%3A%3Dpoint(1%2C-1)%3B%20%0AD%3A%3Dline(A%2CB)&+function%20eqline(A%2CB)%0A%20%20var%20Ax%2CAy%2CBx%2CBy%2Cm%3B%0A%20%20Ax%2CAy%3A%3Dcoordinates(A)%3B%0A%20%20Bx%2CBy%3A%3Dcoordinates(B)%3B%0A%20%20if%20Ax%3DBx%20then%20return%20%22x%3D%22%2BAx%3B%20fi%3B%0A%20%20m%3A%3D(By-Ay)%2F(Bx-Ax)%3B%0A%20%20%2F%2F%20m*Ax%2Bp%3DAy%0A%20%20return%20%22y%3D%22%2Bm%2B%22*x%2B%22%2B(Ay-m*Ax)%3B%0Affunction%3A%3B&+eqline(A%2CB)%3B%20equation(D)&"
                                target="_blank">Xcas</a>
                            or
                            <a
                                href="#exec&python=1&+%23%20%0AA%3Dpoint(-2%2C3)%0AB%3A%3Dpoint(1%2C-1)%3B%20%0AD%3A%3Dline(A%2CB)&+def%20eqline(A%2CB)%3A%0A%20%20%20%20%23%20local%20Ax%2CAy%2CBx%2CBy%2Cm%3B%0A%20%20%20%20Ax%2CAy%3Dcoordinates(A)%0A%20%20%20%20Bx%2CBy%3Dcoordinates(B)%0A%20%20%20%20if%20Ax%3D%3DBx%3A%0A%20%20%20%20%20%20%20%20return%20%22x%3D%22%2BAx%0A%20%20%20%20m%3D(By-Ay)%2F(Bx-Ax)%0A%20%20%20%20%23%20m*Ax%2Bp%3DAy%0A%20%20%20%20return%20%22y%3D%22%2Bm%2B%22*x%2B%22%2B(Ay-m*Ax)&+eqline(A%2CB)%3B%20equation(D)&"
                                target="_blank">
                            Python</a>
                        </li>
                        <li> Minimum by mean of a table of value
                            <a
                                href="#exec&python=0&+///Find%20a%20local%20minimum%20of%20a%20function%20$f$%20in%20$[a,b]$.%20Cut%20the%20interval%20in%2010,%20find%20the%20minimum.%20Do%20that%20again%20with%20the%20interval%20containing%20the%20minimum,%20until%20required%20precision%20is%20reached.&+function%20posmin10(f%2Ca%2Cb)%0A%20%20local%20j%2Cxcur%2Cxmin%2Cfxcur%2Cfxmin%2Ch%3B%0A%20%20h%3A%3D(b-a)%2F10.0%3B%0A%20%20xmin%3A%3Da%3B%0A%20%20fxmin%3A%3Df(xmin)%3B%0A%20%20for%20j%20from%201%20to%2010%20do%0A%20%20%20%20xcur%3A%3Da%2Bj*h%3B%0A%20%20%20%20fxcur%3A%3Df(xcur)%3B%0A%20%20%20%20if%20fxcur%3Cfxmin%20then%0A%20%20%20%20%20%20xmin%3A%3Dxcur%3B%0A%20%20%20%20%20%20fxmin%3A%3Dfxcur%3B%0A%20%20%20%20fi%3B%0A%20%20od%3B%0A%20%20return%20xmin%3B%0Affunction%3A%3B&+posmin10(cos%2C0%2C6)%0A&+function%20posmin(f%2Ca%2Cb%2Ceps)%0A%20%20local%20x%2Ch%3B%0A%20%20x%3A%3Da%3B%0A%20%20while%20b-a%3Eeps%20do%0A%20%20%20%20x%3A%3Dposmin10(f%2Ca%2Cb)%3B%0A%20%20%20%20h%3A%3D(b-a)%2F10.0%3B%0A%20%20%20%20if%20x!%3Da%20then%20a%3A%3Dx-h%3B%20fi%3B%0A%20%20%20%20if%20x!%3Db%20then%20b%3A%3Dx%2Bh%3B%20fi%3B%0A%20%20od%3B%0A%20%20return%20x%3B%0Affunction%3A%3B&+posmin(cos%2C0%2C6%2C1e-2)&"
                                target="_blank">Xcas</a>,
                            <a href="#exec&python=1&+///Find%20a%20local%20minimum%20of%20a%20function%20$f$%20in%20$[a,b]$.%20Cut%20the%20interval%20in%2010,%20find%20the%20minimum.%20Do%20that%20again%20with%20the%20interval%20containing%20the%20minimum,%20until%20required%20precision%20is%20reached.&+def%20posmin10(f%2Ca%2Cb)%3A%0A%20%20%20%20%23%20local%20j%2Cxcur%2Cxmin%2Cfxcur%2Cfxmin%2Ch%0A%20%20%20%20h%3D(b-a)%2F10.0%0A%20%20%20%20xmin%3Da%0A%20%20%20%20fxmin%3Df(xmin)%0A%20%20%20%20for%20j%20in%20range(11)%3A%0A%20%20%20%20%20%20%20%20xcur%3Da%2Bj*h%0A%20%20%20%20%20%20%20%20fxcur%3Df(xcur)%0A%20%20%20%20%20%20%20%20if%20fxcur%3Cfxmin%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20xmin%3Dxcur%0A%20%20%20%20%20%20%20%20%20%20%20%20fxmin%3Dfxcur%0A%20%20%20%20return%20xmin&+posmin10(cos%2C0%2C6)&+def%20posmin(f%2Ca%2Cb%2Ceps)%3A%0A%20%20%20%20%23%20local%20x%2Ch%0A%20%20%20%20x%3Da%0A%20%20%20%20while%20b-a%3Eeps%3A%0A%20%20%20%20%20%20%20%20x%3Dposmin10(f%2Ca%2Cb)%0A%20%20%20%20%20%20%20%20h%3D(b-a)%2F10.0%0A%20%20%20%20%20%20%20%20if%20x!%3Da%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20a%3Dx-h%0A%20%20%20%20%20%20%20%20if%20x!%3Db%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20b%3Dx%2Bh%0A%20%20%20%20return%20x&+posmin(cos%2C0%2C6%2C1e-2)&"
                               target="_blank">Python</a>
                        </li>
                        <li> Frequency in a sample
                            <a
                                href="#exec&python=0&+///Algorithm%20computing%20frequency%20of%20%3Ctt%3eval%3C/tt%3e%20in%20a%20sample.&+function%20freq(sampl%2Cval)%0A%20%20var%20j%2Ctotal%3B%0A%20%20total%3A%3D0%3B%0A%20%20for%20j%20from%201%20to%20dim(sampl)%20do%0A%20%20%20%20if%20sampl(j)%3Dval%20then%20%0A%20%20%20%20%20%20total%3A%3Dtotal%2B1%3B%20%0A%20%20%20%20fi%3B%0A%20%20od%3B%0A%20%20return%20total%2Fdim(sampl)%3B%0Affunction%3A%3B&+sampl%3A%3Dranv(100%2C2)&+freq(sampl%2C1)%3B%20%0Afreq(sampl%2C0)&+///Fluctuation%20of%20a%20frequency,%20here%200.4.%20We%20draw%20100%20samples%20of%20$N=200$%20values%20according%20to%20the%20binomial%20law%20and%20we%20return%20the%20frequency%20of%201.&+f%3A%3D0.4%3B%20N%3A%3D200%0A&+sampl%3A%3D%0Aranv(100%2Cbinomial%2CN%2Cf)%2FN&+count(x-%3E%0A%20%20abs(x-f)%3C1%2Fsqrt(N)%2Csampl)&+///If%20we%20do%20not%20want%20to%20call%20%3Ctt%3eranv%3C/tt%3e,%20we%20can%20simulate%20a%20frequency%20$f$%20with%20%3Ctt%3erand()%3C/tt%3e%20and%20compare%20with%20$f$&+rand()&+dr(f)%3A%3Drand()%3Cf&+seq(dr(f)%2C10)&+function%20simu(N%2Cf)%0A%20%20var%20j%2Cres%3B%0A%20%20res%3A%3D0%3B%0A%20%20for%20j%20from%201%20to%20N%20do%0A%20%20%20%20if%20dr(f)%20then%20res%3A%3Dres%2B1%3B%20fi%3B%0A%20%20od%3B%0A%20%20return%20res%2FN%3B%0Affunction%3A%3B&+simu(200%2C.4)&+l%3A%3Dseq(simu(200%2C.4)%2C100)%0A&+count(x-%3Eabs(x-f)%3C1%2Fsqrt(N)%2Cl)&+///Click%20on%20Exec%20to%20run%20again%20with%20different%20random%20input.&"
                                target="_blank">
                            Xcas</a> or
                            <a href="#exec&python=0&+///Algorithm%20computing%20frequency%20of%20%3Ctt%3eval%3C/tt%3e%20in%20a%20sample.&+def%20Freq(sampl%2Cval)%3A%0A%20%20%20%20%23%20local%20j%2Ctotal%3B%0A%20%20%20%20total%3D0%3B%0A%20%20%20%20for%20j%20in%20sampl%3A%0A%20%20%20%20%20%20%20%20if%20j%3D%3Dval%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20total%3Dtotal%2B1%0A%20%20%20%20return%20total%2Fdim(sampl)&+sampl%3Dranv(100%2C2)&+%23%0AFreq(sampl%2C1)%0AFreq(sampl%2C0)&+///Fluctuation%20of%20a%20frequency,%20here%200.4.%20We%20draw%20100%20samples%20of%20$N=200$%20values%20according%20to%20the%20binomial%20law%20and%20we%20return%20the%20frequency%20of%201.&+%23%0Af%3D0.4%0AN%3D200%0A&+sampl%3D%0Aranv(100%2Cbinomial%2CN%2Cf)%2FN&+def%20Ok(sampl%2Cf%2CN)%3A%0A%20%20%20%20%23%20local%20c%2Cx%0A%20%20%20%20c%3D0%0A%20%20%20%20for%20x%20in%20sampl%3A%0A%20%20%20%20%20%20%20%20if%20abs(x-f)%3C1%2Fsqrt(N)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20c%3Dc%2B1%0A%20%20%20%20return%20c&+Ok(sampl%2Cf%2CN)&+///If%20we%20do%20not%20want%20to%20call%20%3Ctt%3eranv%3C/tt%3e,%20we%20can%20simulate%20a%20frequency%20$f$%20with%20%3Ctt%3erand()%3C/tt%3e%20and%20compare%20with%20$f$&+random()&+def%20dr(f)%3A%0A%20%20%20%20return%20random()%3Cf&+seq(dr(f)%2C10)&+def%20Simu(N%2Cf)%3A%0A%20%20%20%20%23%20local%20j%2Cres%0A%20%20%20%20res%3D0%0A%20%20%20%20for%20j%20in%20range(N)%3A%0A%20%20%20%20%20%20%20%20if%20dr(f)%3A%20%0A%20%20%20%20%20%20%20%20%20%20%20%20res%3Dres%2B1%0A%20%20%20%20return%20res%2FN&+Simu(200%2C.4)&+l%3Dseq(Simu(200%2C.4)%2C100)&+Ok(l%2Cf%2CN)&+///Click%20on%20Exec%20to%20run%20again%20with%20different%20random%20input.&"
                               target="_blank">Python</a>
                        </li>
                        <li>
                            Trial division for prime factorization
                            <a href="#exec&python=0&+function%20tdiv(n)%0A%20%20local%20r%2Cj%3B%0A%20%20r%3A%3Dmakelist(0)%3B%0A%20%20for%20j%20from%202%20to%2010000%20do%0A%20%20%20%20if%20j*j%3En%20then%0A%20%20%20%20%20%20if%20n!%3D1%20then%20r.append(n)%3B%20fi%3B%0A%20%20%20%20%20%20return%20r%3B%20%0A%20%20%20%20fi%3B%0A%20%20%20%20while%20irem(n%2Cj)%3D0%20do%0A%20%20%20%20%20%20n%3A%3Dn%2Fj%3B%0A%20%20%20%20%20%20r.append(j)%3B%0A%20%20%20%20od%3B%0A%20%20%20%20if%20j%3E2%20then%20j%2B%2B%3B%20fi%3B%20%2F%2F%20step%202%0A%20%20fpour%3B%0A%20%20return%20%22Too%20large%22%3B%0Affunction%3A%3B&+tdiv(1007)&"
                               target="_blank">Xcas</a>,
                            <a
                                href="#exec&python=1&+def%20tdiv(n)%3A%0A%20%20%20%20%23%20local%20r%2Cj%0A%20%20%20%20r%3Dmakelist(0)%0A%20%20%20%20for%20j%20in%20range(2%2C10000)%3A%0A%20%20%20%20%20%20%20%20if%20j*j%3En%20%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20n%3C%3E1%20%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20r.append(n)%0A%20%20%20%20%20%20%20%20%20%20%20%20return(r)%0A%20%20%20%20%20%20%20%20while%20n%20%25j%20%3D%3D0%20%3A%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20n%3Dn%2Fj%0A%20%20%20%20%20%20%20%20%20%20%20%20r.append(j)%0A%20%20%20%20%20%20%20%20if%20j%3E2%20%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20j%2B%2B%0A%20%20%20%20return(%22Too%20large%22)%0A&+tdiv(1007)&"
                                target="_blank">Python</a>
                        </li>
                        <li> Second order equation
                            <a
                                href="#exec&python=0&+function%20resolution2(a%2Cb%2Cc)%0A%20%20var%20delta%3B%0A%20%20delta%3A%3Db%5E2-4*a*c%3B%0A%20%20if%20delta%3C0%20then%20return%20%22no%20roots%22%3B%20fi%3B%0A%20%20if%20delta%3D0%20then%20return%20-b%2F(2*a)%3B%20fi%3B%0A%20%20delta%3A%3Dsqrt(delta)%3B%0A%20%20return%20(-b-delta)%2F(2*a)%2C(-b%2Bdelta)%2F(2*a)%3B%0Affunction%3A%3B&+resolution2(1%2C2%2C3)&+resolution2(1%2C2%2C1)&+resolution2(1%2C1%2C-1)&"
                                target="_blank">
                            Xcas</a>,
                            <a
                                href="#exec&python=1&+def%20resolution2(a%2Cb%2Cc)%3A%0A%20%20%20%20%23%20local%20delta%2Cs%0A%20%20%20%20delta%3Db%5E2-4*a*c%0A%20%20%20%20if%20delta%3C0%3A%0A%20%20%20%20%20%20%20%20return%20%22no%20roots%22%0A%20%20%20%20if%20delta%3D%3D0%3A%0A%20%20%20%20%20%20%20%20return%20-b%2F(2*a)%0A%20%20%20%20s%3Dsqrt(delta)%0A%20%20%20%20return%20%5B(-b-s)%2F(2*a)%2C(-b%2Bs)%2F(2*a)%5D&+resolution2(1%2C2%2C3)&+resolution2(1%2C2%2C1)&+resolution2(1%2C1%2C-1)&"
                                target="_blank">Python</a>
                        </li>
                        <li> Sequences
                            <a
                                href="#exec&python=0&+///First%20terms%20of%20an%20explicit%20sequence%20(given%20by%20an%20expression)&+u(n)%3A%3D1%2Fn&+s%3A%3Dseq(u(n)%2Cn%2C1%2C10)&+seq(point(n%2Cu(n))%2Cn%2C1%2C10)&+///Computation%20of%20the%20first%20terms%20of%20a%20recurrent%20sequence%20$u[n+1]=f(u[n])$&+function%20nterms(f%2Cu0%2CN)%20%0A%20%20var%20n%2Cu%3B%0A%20%20u%3A%3D%5Bu0%5D%3B%0A%20%20for%20n%20from%201%20to%20N%20do%0A%20%20%20%20u%5Bn%5D%3A%3Df(u%5Bn-1%5D)%3B%0A%20%20od%3B%0A%20%20return%20u%3B%20%0A%20%20%2F%2F%20ou%20retourne%20u%5BN%5D%20pour%20le%20dernier%20terme%0Affunction%3A%3B&+f(x)%3A%3D1%2F2*(x%2B2%2Fx)&+nterms(f%2C1.0%2C1)&+U%3A%3Dnterms(f%2C1.0%2C5)&+nterms(f%2C1%2C5)&+seq(point(n%2CU%5Bn%5D)%2Cn%2C0%2Csize(U)-1)&"
                                target="_blank">Xcas
                            </a>,
                            <a
                                href="#exec&python=1&+///First%20terms%20of%20an%20explicit%20sequence%20(given%20by%20an%20expression)&+def%20u(n)%3A%0A%20%20%20%20return%201.0%2Fn%0A&+s%3D%5Bu(n)%20for%20n%20in%20range(1%2C11)%5D&+%5Bpoint(n%2Cu(n))%20for%20n%20in%20range(1%2C11)%5D&+///Computation%20of%20the%20first%20terms%20of%20a%20recurrent%20sequence%20$u[n+1]=f(u[n])$&+def%20nterms(f%2Cu0%2CN)%3A%0A%20%20%20%20%23%20local%20n%2Cu%0A%20%20%20%20u%3D%5Bu0%5D%3B%0A%20%20%20%20for%20n%20in%20range(N)%3A%0A%20%20%20%20%20%20%20%20u.append(f(u%5Bn%5D))%0A%20%20%20%20return%20u%20%0A%20%20%20%20%23%20ou%20retourne%20u%5BN%5D%20pour%20le%20dernier%20terme%0A&+def%20f(x)%3A%0A%20%20%20%20return%201%2F2*(x%2B2%2Fx)&+nterms(f%2C1.0%2C1)&+U%3Dnterms(f%2C1.0%2C5)&+nterms(f%2C1%2C5)&+%5Bpoint(n%2CU%5Bn%5D)%20for%20n%20in%20range(size(U))%5D%0A&"
                                target="_blank">Python</a>
                        </li>
                        <li> Binomial and truncated geometric law
                            <a
                                href="#exec&python=0&+python_compat(0)&+///$n$%20samples%20with%20success%20probability%20$p$&+function%20f(n%2Cp)%0A%20%20var%20total%2Cj%2Ch%3B%0A%20%20total%3A%3D0%3B%0A%20%20for%20j%20from%201%20to%20n%20do%0A%20%20%20%20h%3A%3Drand(0%2C1)%3B%0A%20%20%20%20if%20h%3C%3Dp%20then%20total%3A%3Dtotal%2B1%3B%20fi%3B%0A%20%20%20od%3B%0A%20%20return%20total%3B%0Affunction%3A%3B&+f(10%2C0.4)%0A&+///Histogram%20of%201000%20samples%20and%20comparison%20with%20the%20histogram%20of%20the%20binomial%20law.&+s%3A%3Dseq(f(10%2C0.4)%2C1000)&+histogram(s%2C-0.5%2C1%2Ccolor%3Dred)%3B%20%0Ahistogram(binomial%2C10%2C0.4)&+///Symmetric%20confidence%20interval%20for%20the%20binomial%20law.&+n%3A%3D100%3B%20p%3A%3D0.16%3B%20%0Axmin%3A%3Dbinomial_icdf(n%2Cp%2C0.025)%3B%0Axmax%3A%3Dbinomial_icdf(n%2Cp%2C0.975)&+gl_x%3D0..40%3B%20gl_y%3D0..0.15%3B%0Ahistogram(binomial%2Cn%2Cp)%3B%0Aline(x%3Dxmin%2Ccolor%3Dred)%3B%0Aline(x%3Dxmax%2Ccolor%3Dred)%3B&+///Algorithm%20to%20compute%20the%20confidence%20interval%20for%20the%20binomial%20law.&+function%20confidence(n%2Cp%2Cseuil)%0A%20%20var%20k%2Ctotal%3B%0A%20%20total%3A%3D0%3B%0A%20%20for%20k%20from%200%20to%20n%20do%0A%20%20%20%20total%3A%3Dtotal%2Bbinomial(n%2Cp%2Ck)%3B%0A%20%20%20%20if%20total%3E%3Dseuil%20then%20retourne%20k%3B%20fi%3B%0A%20%20od%3B%0Affunction%3A%3B&+confidence(100%2C.16%2C0.025)&+confidence(100%2C.16%2C0.975)&+///Comparison%20with%20$[p-1/sqrt(n),p+1/sqrt(n)]$&+n%3A%3D30%3Bplotfunc(%0A%5Bbinomial_icdf(30%2Cp%2C0.025)%2Fn%2C%0Abinomial_icdf(30%2Cp%2C0.975)%2Fn%2C%0Ap-sqrt(1%2Fn)%2Cp%2Bsqrt(1%2Fn)%5D%2C%0Ap%3D0..1%2Ccolor%3D%5Bred%2Cred%2Cblack%2Cblack%5D)%3B&+///Truncated%20geometric%20law%20(returns%20the%20first%20success%20or%200)&+function%20geo(n%2Cp)%0A%20%20var%20k%2Ct%3B%0A%20%20for%20k%20from%201%20to%20n%20do%0A%20%20%20%20t%3A%3Drand(0%2C1)%3B%0A%20%20%20%20if%20t%3C%3Dp%20then%20return%20k%3B%20fi%3B%0A%20%20od%3B%0A%20%20return%200%3B%0Affunction%3A%3B&+geo(10%2C.4)%0A&+s%3A%3Dseq(geo(10%2C.4)%2C1000)&+histogram(s%2C-0.5%2C1%2Ccolor%3Dred)%3B%20%0Ahistogram(geometric%2C0.4)&"
                                target="_blank">Xcas</a>,
                            <a
                                href="#exec&python=1&+///$n$%20samples%20with%20success%20probability%20$p$&+def%20f(n%2Cp)%3A%0A%20%20%20%20%23%20local%20total%2Cj%2Ch%0A%20%20%20%20total%3D0%0A%20%20%20%20for%20j%20in%20range(n)%3A%0A%20%20%20%20%20%20%20%20h%3Drandom()%0A%20%20%20%20%20%20%20%20if%20h%3C%3Dp%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20total%3Dtotal%2B1%0A%20%20%20%20return%20total%0A&+f(10%2C0.4)&+///Histogram%20of%201000%20samples%20and%20comparison%20with%20the%20histogram%20of%20the%20binomial%20law.&+s%3Dseq(f(10%2C0.4)%2C1000)&+histogram(s%2C-0.5%2C1%2Ccolor%3Dred)%3B%0Ahistogram(binomial%2C10%2C0.4)&+///Symmetric%20confidence%20interval%20for%20the%20binomial%20law.&+%23%0An%3D100%0Ap%3D0.16%0Axmin%3Dbinomial_icdf(n%2Cp%2C0.025)%0Axmax%3Dbinomial_icdf(n%2Cp%2C0.975)&+%23%0Agl_x%3D0..40%0Agl_y%3D0..0.15%0Ahistogram(binomial%2Cn%2Cp)%0Acolor(line(equal(x%2Cxmin))%2Cred)%0Acolor(line(equal(x%2Cxmax))%2Cred)&+///Algorithm%20to%20compute%20the%20confidence%20interval%20for%20the%20binomial%20law.&+def%20confidence(n%2Cp%2Cseuil)%3A%0A%20%20%20%20%23%20local%20k%2Ctotal%0A%20%20%20%20total%3D0%0A%20%20%20%20for%20k%20in%20range(n%2B1)%3A%0A%20%20%20%20%20%20%20%20total%3Dtotal%2Bbinomial(n%2Cp%2Ck)%0A%20%20%20%20%20%20%20%20if%20total%3E%3Dseuil%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20k%0A&+confidence(100%2C.16%2C0.025)&+confidence(100%2C.16%2C0.975)&+///comparison%20with%20$[p-1/sqrt(n),p+1/sqrt(n)]$&+%23%0An%3D30%0Aplotfunc(%5Bbinomial_icdf(30%2Cp%2C0.025)%2Fn%2Cbinomial_icdf(30%2Cp%2C0.975)%2Fn%2Cp-sqrt(1%2Fn)%2Cp%2Bsqrt(1%2Fn)%5D%2Cp%2C0%2C1)&+///Truncated%20geometric%20law%20(returns%20the%20first%20success%20or%200)&+def%20geo(n%2Cp)%3A%0A%20%20%20%20%23%20local%20k%2Ct%0A%20%20%20%20for%20k%20in%20range(n)%3A%0A%20%20%20%20%20%20%20%20t%3Drandom()%0A%20%20%20%20%20%20%20%20if%20t%3C%3Dp%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20k%2B1%0A%20%20%20%20return%200%0A&+geo(10%2C.4)&+s%3Dseq(geo(10%2C.4)%2C1000)&+%23%0Acolor(histogram(s%2C-0.5%2C1)%2Cred)%20%0Ahistogram(geometric%2C0.4)&"
                                target="_blank">Python</a>
                        </li>
                        <li> Pascal triangle
                            <a
                                href="#exec&python=0&+///Pascal%20triangle%20to%20compute%20binomial%20coefficients.&+function%20Pascal(n)%0A%20%20var%20tab%2Cj%2Ck%3B%0A%20%20tab%3A%3Dmatrix(n%2Cn)%3B%0A%20%20for%20j%20from%200%20to%20n-1%20do%0A%20%20%20%20tab%5Bj%2C0%5D%3A%3D1%3B%0A%20%20%20%20for%20k%20from%201%20to%20j%20do%0A%20%20%20%20%20%20tab%5Bj%2Ck%5D%3A%3Dtab%5Bj-1%2Ck-1%5D%2Btab%5Bj-1%2Ck%5D%3B%0A%20%20%20%20od%3B%0A%20%20od%3B%0A%20%20return%20tab%3B%0Affunction%3A%3B&+Pascal(6)&"
                                target="_blank">
                            Xcas</a>
                            <a
                                href="#exec&python=1&+///Pascal%20triangle%20to%20compute%20binomial%20coefficients.&+def%20Pascal(n)%3A%0A%20%20%20%20%23%20local%20tab%2Cj%2Ck%3B%0A%20%20%20%20tab%3Dmatrix(n%2Cn)%0A%20%20%20%20for%20j%20in%20range(n)%3A%0A%20%20%20%20%20%20%20%20tab%5Bj%2C0%5D%3D1%0A%20%20%20%20%20%20%20%20for%20k%20in%20range(1%2Cj%2B1)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20tab%5Bj%2Ck%5D%3Dtab%5Bj-1%2Ck-1%5D%2Btab%5Bj-1%2Ck%5D%0A%20%20%20%20return%20tab%0A&+Pascal(6)&"
                                target="_blank">Python</a>
                        </li>
                        <li>
                            Dichotomy
                            <a
                                href="#exec&python=0&+///Find%20a%20root%20of%20$f$%20between%20$a$%20and%20$b$%20with%20precision%20%3Ctt%3eeps%3C/tt%3e.%0aThe%20%3Ctt%3edicho%3C/tt%3e%20function%20begins%20with%20a%20test%20that%20the%20sign%20differ%20at%20$a$%20and%20$b$.&+function%20dicho(f%2Ca%2Cb%2Ceps)%0A%20%20var%20c%2Cniter%3B%0A%20%20if%20f(a)*f(b)%3E%3D0%20then%20retorn%20%22error%3A%20no%20sign%20change%22%3B%20fi%3B%0A%20%20while%20abs(b-a)%3Eeps%20do%0A%20%20%20%20c%3D(a%2Bb)%2F2%3B%0A%20%20%20%20if%20f(a)*f(c)%3E0%20then%20a%3Dc%3B%20else%20b%3Dc%3B%20fi%3B%0A%20%20od%3B%0A%20%20return%20c%3B%0Affunction%3A%3B&+f(x)%3A%3Dcos(x)-x%3B&+plot(f(x)%2Cx%2C0%2C2)%0A&+dicho(f%2C0.0%2C1.0%2C1e-8)&"
                                target="_blank">
                            Xcas
                            </a>,
                            <a
                                href="#exec&python=1&+///Find%20a%20root%20of%20$f$%20between%20$a$%20and%20$b$%20with%20precision%20%3Ctt%3eeps%3C/tt%3e.%0aThe%20%3Ctt%3edicho%3C/tt%3e%20function%20begins%20with%20a%20test%20that%20the%20sign%20differ%20at%20$a$%20and%20$b$.&+def%20dicho(f%2Ca%2Cb%2Ceps)%3A%0A%20%20%20%20%23%20local%20var%20c%2Cniter%3B%0A%20%20%20%20if%20f(a)*f(b)%3E%3D0%3A%20%0A%20%20%20%20%20%20%20%20return%20%22error%3A%20f(a)*f(b)%3E%3D0%22%0A%20%20%20%20while%20abs(b-a)%3Eeps%3A%0A%20%20%20%20%20%20%20%20c%3D(a%2Bb)%2F2%0A%20%20%20%20%20%20%20%20if%20f(a)*f(c)%3E0%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20a%3Dc%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20b%3Dc%0A%20%20%20%20return%20c%0A&+def%20f(x)%3A%0A%20%20%20%20return%20cos(x)-x&+plot(f(x)%2Cx%2C0%2C2)&+dicho(f%2C0.0%2C1.0%2C1e-8)&"
                                target="_blank">Python</a>
                        </li>
                        <li>
                            Approximate area under curve
                            <a
                                href="#exec&python=0&+///Numeric%20integration&+f(x)%3A%3Dsin(x)%0A&+plot(f(x)%2Cx%2C0%2C1)%3B%20line(y%3D0)%3B&+function%20rect(f%2Ca%2Cb%2CN)%0A%20%20var%20S%3B%0A%20%20S%3A%3D0.0%3B%0A%20%20h%3A%3D(b-a)%2FN%3B%0A%20%20for%20j%20from%201%20to%20N%20do%0A%20%20%20%20S%3A%3DS%2Bf(a%2Bj*h)%3B%0A%20%20od%3B%0A%20%20return%20S*h%3B%0Affunction%3A%3B&+rect(f%2C0%2C1%2C100)%0A&+integrate(f(x)%2Cx%2C0%2C1.0)%0A&+///For%20the%20midpoint%20method,%20replace%20f(a+j*h)%20by%20f(a-h/2+j*h)&+fonction%20Midpoint(f%2Ca%2Cb%2CN)%0A%20%20var%20S%3B%0A%20%20S%3A%3D0.0%3B%0A%20%20h%3A%3D(b-a)%2FN%3B%0A%20%20for%20j%20from%201%20to%20N%20do%0A%20%20%20%20S%3A%3DS%2Bf(a-h%2F2%2Bj*h)%3B%0A%20%20od%3B%0A%20%20return%20S*h%3B%0Affunction%3A%3B&+Midpoint(f%2C0%2C1%2C100)&+///It%20is%20more%20accurate%20for%20(almost)%20the%20same%20computational%20cost,%20as%20graphically%20illustrated%20below.&+plot(f(x)%2Cx%2C0%2C1)%3B%0Arectangle(0%2C1%2Cf(1)%2Ccolor%3Dred)%3B%20%0Arectangle(0%2C1%2Cf(1%2F2)%2Ccolor%3Dgreen)&+///Estimation%20by%20Monte-Carlo%20method&+function%20Montecarlo(f%2Ca%2Cb%2Cn)%0A%20%20local%20k%2Cr%3B%0A%20%20r%3A%3D0%3B%0A%20%20for%20k%20from%201%20to%20n%20do%0A%20%20%20%20r%3A%3Dr%2Bf(rand(uniformd%2Ca%2Cb))%3B%0A%20%20od%3B%0A%20%20return%20r*(b-a)%2Fn%3B%0Affunction%3A%3B&+n%3A%3D100%3BMontecarlo(f%2C0%2C1%2Cn)&+N%3A%3D800%3B%0Al%3A%3Dseq(Montecarlo(f%2C0%2C1%2Cn)%2CN)%3B%0Ahistogram(l%2C0%2C0.005)%3B%0Am%3A%3D1-cos(1)%3B%0Aline(x%3Dm%2Ccolor%3Dred)%3B%0Aplot(normald(m%2Cstddev(l)%2Cx)%2Cx%3D0.35..0.55)&"
                                target="_blank">Xcas
                            </a>
                            <a
                                href="#exec&python=1&+///Numeric%20integration&+f(x)%3A%3Dsin(x)&+plot(f(x)%2Cx%2C0%2C1)%3B%20line(y%3D0)%3B&+def%20Rect(f%2Ca%2Cb%2CN)%3A%0A%20%20%20%20%23%20local%20S%2Ch%2Cj%0A%20%20%20%20S%3D0.0%0A%20%20%20%20h%3D(b-a)%2FN%0A%20%20%20%20for%20j%20in%20range(N)%3A%0A%20%20%20%20%20%20%20%20S%3DS%2Bf(a%2Bh%2Bj*h)%0A%20%20%20%20return%20S*h&+Rect(f%2C0%2C1%2C100)&+integrate(f(x)%2Cx%2C0%2C1.0)&+///For%20the%20midpoint%20method,%20replace%20f(a+j*h)%20by%20f(a-h/2+j*h)&+def%20Pointmilieu(f%2Ca%2Cb%2CN)%3A%0A%20%20%20%20%23%20local%20S%2Ch%2Cj%0A%20%20%20%20S%3D0.0%0A%20%20%20%20h%3D(b-a)%2FN%0A%20%20%20%20for%20j%20in%20range(N)%3A%0A%20%20%20%20%20%20%20%20S%3DS%2Bf(a%2Bh%2F2%2Bj*h)%0A%20%20%20%20return%20S*h&+Pointmilieu(f%2C0%2C1%2C100)&+///It%20is%20more%20accurate%20for%20(almost)%20the%20same%20computational%20cost,%20as%20graphically%20illustrated%20below.&+plot(f(x)%2Cx%2C0%2C1)%3B%0Arectangle(0%2C1%2Cf(1)%2Ccolor%3Dred)%3B%20%0Arectangle(0%2C1%2Cf(1%2F2)%2Ccolor%3Dgreen)&+def%20Montecarlo(f%2Ca%2Cb%2Cn)%3A%0A%20%20%20%20%23%20local%20k%2Cr%2Cx%0A%20%20%20%20r%3D0%0A%20%20%20%20for%20k%20in%20range(n)%3A%0A%20%20%20%20%20%20%20%20r%3Dr%2Bf(random.uniform(a%2Cb))%0A%20%20%20%20return(r*(b-a)%2Fn)&+%23%0An%3D100%0AMontecarlo(f%2C0%2C1%2Cn)&+%23%0AN%3D800%3B%0Al%3D%5BMontecarlo(f%2C0%2C1%2Cn)%20for%20j%20in%20range(N)%5D%0Ahistogram(l%2C0%2C0.005)%0Am%3D1-cos(1)%0Adroite(x%3D%3D%3Dm%2Ccolor%3D%3D%3Dred)%3B%0Aplot(normald(m%2Cstddev(l)%2Cx)%2Cx%3D%3D%3D0.35..0.55)&"
                                target="_blank">Python</a>
                        </li>
                        <li>
                            Cumulated frequency
                            <a href="#exec&python=0&+///Cumulated%20distribution%20between%202%20values%20$a$%20and%20$b$.%0aFor%20another%20law,%20e.g.%20exponentiald(1),%20take%20care%20of%20the%20values%20of%20$a$%20and%20$b$%20and%20modify%20%3Ctt%3ex=-5..5%3C/tt%3e%20for%20example%20to%20%3Ctt%3ex=0..6%3C/tt%3e.&+law%3A%3Dnormald(0%2C1)&*a,-2,-5,5,0.125&*b,0,-5,5,0.125&+plotarea(law(x)%2Cx%3Dmin(a%2Cb)..max(a%2Cb))%3B%0Aplotfunc(law(x)%2Cx%3D-5..5)%3B%0A&+///Symmetric%20confidence%20interval%20for%20the%20law%20with%20$alpha$%20risk.&+alpha%3A%3D0.05%3A%3B%0Aicdf(law%2Calpha%2F2)%2Cicdf(law%2C1-alpha%2F2)&"
                               target="_blank">normal law</a>
                        </li>
                        <li>
                            <a
                                href="#exec&python=0&+n%3A%3D2%5E13%3B%0Al%3A%3Dseq(%0A%20%20%20%20sum(ranv(n%2Cuniformd%2C0%2C1))%2Fn-0.5%2C%0A%20%20%20%20400)&+sigma%3A%3Dstddev(uniformd%2C0%2C1)%3B%0Aevalf(sigma%2Fsqrt(n))%0A&+histogram(l%2C-0.01%2C0.001)%3B%0Aplot(normald(0%2Csigma%2Fsqrt(n)%2Cx)%2Cx%3D-0.01..0.01)&"
                                target="_blank">
                            Central-limit theorem illustration
                            </a>
                        </li>
                    </ul>
                </div>
            </li>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutoex2'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Examples</strong></button>
                <div id="tutoex2" style="display:none">
                    Sessions examples
                    <ul>
                        <li>
                            <a
                                href="#exec&python=0&+///%3Ch1%3eFloats%3C/h1%3e&+1.0-0.9-0.1&+///As%20illustrated%20above,%20Xcas%20does%20not%20compute%20in%20basis%2010.%0aThe%20program%20below%20will%20find%20the%20basis%20used%20for%20computation.&+function%20Base()%0A%20%20local%20A%2CB%3B%0A%20%20A%3A%3D1.0%3B%20B%3A%3D1.0%3B%0A%20%20while%20evalf(evalf(A%2B1.0)-A)-1.0%3D0.0%20do%20%20A%3A%3D2*A%3B%20od%3B%0A%20%20while%20evalf(evalf(A%2BB)-A)-B!%3D0%20do%20B%3A%3DB%2B1%3B%20od%3B%0A%20%20return%20B%3B%0Affunction%3A%3B%20Base()&+///Smallest%20and%20largest%20representable%20strictly%20positive%20reals%20(normal%20precision).&+MINREAL%3BMAXREAL&+///Xcas%20precision%20for%20floats%20in%20bits.%20If%20%3Ctt%3eDigits%3C/tt%3e%20is%20larger%20than%2014,%20computations%20are%20slower%20but%20more%20accurate.&+epsilon%3A%3D0%3A%3B%20Digits%3A%3D14%3B%0Apour%20j%20de%201%20jusque%201000%20faire%20%0A%20%20si%20evalf(1)%2B2%5E(-j)%3D%3Devalf(1)%20alors%20break%3B%20fsi%3B%20%0Afpour%3A%3B%0Aj&+///Relative%20error,%20example%20with%20the%20computation%20of%20a%20derivative.%20The%20optimal%20value%20of%20$h$%20depends%20on%20the%20precision%20(%3Ctt%3eDigits%3C/tt%3e).&+der(f%2Cx%2Ch)%3A%3D(f(x%2Bh)-f(x))%2Fh&+Digits%3A%3D14&+seq(der(exp%2C0.0%2C10%5E(-j))-1%0A%20%20%2Cj%2C1%2C15))&+der2(f%2Cx%2Ch)%3A%3D(f(x%2Bh)-f(x-h))%2F2%2Fh&+seq(der2(exp%2C0.0%2C10%5E(-j))-1%0A%20%20%2Cj%2C1%2C15))&+///Relative%20error%20on%20$f(x)$%20is%20equivalent%20to%20$abs(x*f'(x)/f(x))$.%20Illustration%20with%20interval%20arithmetic.&+x%3A%3Dconvert(pi%2Cinterval)&+err%3A%3D(right(x)-left(x))%2Fpi&+f(x)%3A%3Dexp(x)%3A%3By%3A%3Df(x)&+(right(y)-left(y))%2Fexp(pi)%3B%20%0Aerr*pi*f'(pi)%2Ff(pi)&+///Sum%20of%20$n$%20independant%20absolute%20errors.%0aThe%20majoration%20of%20the%20absolute%20error%20of%20the%20sum%20is%20multiplied%20by%20$n$%20but%20this%20is%20too%20pessimistic,%20most%20of%20the%20time%20error%20is%20multiplied%20by%20a%20factor%20$sqrt(n)$.%0aExample%20of%20simulation%20:%20sum%20of%20$n=400$%20numbers%20on%20(-1,1),%20uniform%20law,%20divide%20by%20$sqrt(n)=20$,%20make%20this%201000%20times,%20draw%20the%20histogram%20and%20compare%20with%20the%20normal%20law%20(mean=0,%20stddev=stddev%20of%20the%20uniform%20law%20on%20(-1,1)).&+n%3A%3D400%3B%0Am%3A%3Dranm(n%2C1000%2C-1..1)%3A%3B%0Agl_x%3D-2..2%3B%0Ahistogram(sum(m)%2Fsqrt(n)%2C-1%2C0.1)%3B%20%0Aplot(normald(0%2Cstddev(uniform%2C-1%2C1))%2C-2..2)&+///Correction%20of%20rounding%20errors%20in%20the%20sum%20of%20the%20components%20of%20a%20list.%20We%20accumulate%20in%20$c$%20almost%20the%20opposite%20of%20the%20roundings%20errors%20from%20%3Ctt%3es+=x%3C/tt%3e&+function%20Somme(l)%0A%20%20local%20x%2Cs%2Cc%3B%0A%20%20s%3A%3D0.0%3B%0A%20%20c%3A%3D0.0%3B%0A%20%20pour%20x%20in%20l%20faire%0A%20%20%20%20c%20%2B%3D%20(x-((s%2Bx)-s))%3B%0A%20%20%20%20s%20%2B%3D%20x%3B%0A%20%20fpour%3B%0A%20%20print(c)%3B%0A%20%20return%20s%2Bc%3B%0Affunction%3A%3B&+n%3A%3D6000%3B%0Al%3A%3Dseq(1%2Fj%2Cj%2C1%2Cn)%3A%3B%0ASomme(l)%3B&+///Comparison%20with%20the%20approx%20value%20of%20the%20exact%20value%20of%20$S$%20and%20of%20the%20approx%20computation%20without%20correction.&+S%3A%3Dsum(1%2Fj%2Cj%2C1%2Cn)%3A%3B%20evalf(S)%3B%0Asum(1.%20%2Fj%2Cj%2C1%2Cn)%3B&"
                                target="_blank">Floating point numbers</a>
                        </li>
                        <li>
                            <a
                                href="#exec&python=0&+///Computation%20time%20and%20accuracy%20of%20a%20LU%20factorization%20as%20the%20size%20$n$%20of%20the%20matrix%20increases.&+t%3A%3D%5B%5D%3A%3B%20err%3A%3D%5B%5D%3A%3B%0Afor%20n%20from%201%20to%208%20do%0A%20%20m%3A%3Dranm(n*50%2Cn*50%2Cuniformd%2C-1%2C1)%3B%20%0A%20%20t.append(time(p%2Cl%2Cu%3A%3Dlu(m)))%3B%20%0A%20%20err.append(maxnorm(permu2mat(p)*m-l*u))%3B%0Aod%3A%3B%0At%3Berr%3B&+N%3A%3Dseq(ln(n)%2Cn%2C2%2C8)%3B%0AT%3A%3Dln(t)%5B1..11%5D%3B%0Apolygonscatterplot(N%2CT)%3B%0Alinear_regression_plot(N%2CT%2Ccolor%3Dred)&+linear_regression(N%2CT)&+///It's%20better%20than%20the%20expected%20$O(n^3)$,%20there%20are%20some%20optimizations%20as%20the%20matrix%20size%20increases%20and%20Xcas%20is%20using%20more%20efficient%20bloc%20algorithms.%0aFor%20specific%20matrices,%20like%20sparse%20matrices%20(e.g.%20discrete%20laplacian)%20or%20symmetric%20defined,%20some%20algorithms%20will%20give%20better%20timings%20(like%20Cholesky%20factorization%20for%20symmetric%20defined%20matrices).&+n%3A%3D7%3B%20a%3A%3Dlaplacian(n)%3B&+///Comparison%20:%20linear%20solving%20assuming%20LU%20is%20known%20in%20$O(n^2)$%20vs%20direct%20solving.&+function%20f(n)%0A%20%20local%20t1%2Ct2%2Cp%2Cl%2Cu%2Ca%2Cb%2Cv%2Cw%3B%0A%20%20p%2Cl%2Cu%3A%3Dlu(a%3A%3Dranm(n%2Cn%2Cuniformd%2C-1%2C1))%3A%3B%20%0A%20%20b%3A%3Dranv(n%2Cuniformd%2C-1%2C1)%3A%3B%20%0A%20%20t1%3A%3Dtime(v%3A%3Dlinsolve(p%2Cl%2Cu%2Cb))%3B%0A%20%20t2%3A%3Dtime(w%3A%3Dlinsolve(a%2Cb))%3B%0A%20%20return%20t1%2Ct2%2Cmaxnorm(v-w)%3B%0Affunction%3A%3B&+f(600)&+///Condition%20number%20of%20a%20matrix,%20example%20of%20resolution%20of%20a%20system%20with%202%20second%20members%20that%20are%20close%20together,%20the%20relative%20error%20of%20the%20corresponding%20solutions%20is%20almost%20increased%20by%20the%20condition%20number.&+a%3A%3D%5B%5B10%2C7%2C8%2C7%5D%2C%0A%20%20%5B7%2C5%2C6%2C5%5D%2C%0A%20%20%5B8%2C6%2C10%2C9%5D%2C%0A%20%20%5B7%2C5%2C9%2C10%5D%5D&+b%3A%3D%5B32%2C23%2C33%2C31%5D&+v%3A%3Dlinsolve(a%2Cb)&+delta_b%3A%3D%5B1%2C-1%2C1%2C-1%5D%2F100&+w%3A%3Dlinsolve(a%2Cb%2Bdelta_b)&+err1%3A%3Dl2norm(evalf(delta_b))%2Fl2norm(b)%3B%0Aerr2%3A%3Dl2norm(evalf(w-v))%2Fl2norm(v)%3B&+cond(a%2C2)%3B%20err2%2Ferr1&"
                                target="_blank">Linear systems, LU, condition number</a>
                        </li>
                        <li>
                            <a
                                href="#exec&python=0&+///$Q*R$%20decomposition%20and%20least%20squares.%0aExample:%20linear%20regression.&+///Given%20a%20sequence%20of%20values%20that%20are%20on%20a%20line%20modulo%20a%20small%20random%20error,%20we%20are%20searching%20the%20best%20line%20$y=a*x+b$%20near%20these%20points%20minimizing%20the%20square%20vertical%20distance.&+n%3A%3D30%3B%20b%3A%3Dseq(2*j%2B5*rand()%2Cj%2C1%2Cn)&+x%3A%3Dseq(j%2Cj%2C1%2Cn)%3B%20scatterplot(x%2Cb)%3B%0Alinear_regression_plot(x%2Cb)&+///Matrix%20translation%20of%20the%20problem%20$A*x=b$%20with%20$x=[m,p]$&+A%3A%3Dtrn(%5Bx%2Cseq(1%2Cn)%5D)&+A*%5Bm%2Cp%5D%3Db&+///The%20system%20is%20overdetermined.%20It%20can%20only%20be%20solve%20as%20a%20least%20square%20problem,%20find%20$x$%20such%20that%20$abs(A*x-b)$%20is%20minimal,%20i.e.%20$A^t*A*x=A^t*b$&+///Let%20$A=Q_1*R_1$%20with%20$R_1$%20upper%20triangular%20invertible%20be%20the%20thin%20$QR$%20factorization%20of%20$A$.%20We%20have%20$R_1*x=Q_1^t*b$&+q%2Cr%3A%3Dqr(evalf(A))&+q1%3A%3Dq%5B%3A%2C0..1%5D&+r1%3A%3Dr%5B0..1%2C0..1%5D&+linsolve(r1%2Ctran(q1)*b)&+///Comparison%20with%20the%20builtin%20linear%20regression%20command%20of%20Xcas.&+linear_regression(x%2Cb)&+///Solving%20like%20above%20is%20more%20accurate%20than%20solving%20$A^t*A*x=A^t*b$%20because%20the%20condition%20number%20is%20smaller.&+cond(A%2C2)&+///We%20might%20loose%20at%20most%201.5%20digits%20instead%20of%203.&"
                                target="_blank">QR decomposition, least squares, example linear regression</a>
                        </li>
                        <li> Univariate polynomials
                            <a href="#exec&python=0&+///Horner%20method%20to%20evaluate%20a%20polynomial%20at%20a%20point,%20comparison%20with%20the%20builtin%20horner%20command.&+function%20Horner(p%2Ca)%0A%20%20%2F%2F%20p%20list%20of%20coefficients%20by%20decreasing%20order%0A%20%20%2F%2F%20returns%20p%20evaled%20at%20a%0A%20%20local%20c%2Cr%3B%0A%20%20r%3A%3D0%3B%0A%20%20for%20c%20in%20p%20do%0A%20%20%20%20r%3A%3Dr*a%2Bc%3B%0A%20%20od%3B%0A%20%20return%20r%3B%0Affunction%3A%3B&+Horner(%5B1%2C2%2C3%5D%2C4)%3B%20%0Ahorner(%5B1%2C2%2C3%5D%2C4)&+///We%20modify%20the%20previous%20program%20to%20also%20return%20the%20euclidean%20quotient%20of%20$p$%20by%20$x-a$.%0a&+function%20Horner2(p%2Ca)%0A%20%20local%20c%2Cr%2Cq%3B%0A%20%20r%3A%3D0%3B%20q%3A%3D%5B%5D%3B%0A%20%20for%20c%20in%20p%20do%0A%20%20%20%20r%3A%3Dr*a%2Bc%3B%0A%20%20%20%20q.append(r)%3B%0A%20%20od%3B%0A%20%20q%3A%3Dq%5B0..-2%5D%3B%0A%20%20return%20q%2Cr%3B%0Affunction%3A%3B&+Horner2(%5B1%2C2%2C3%5D%2C4)&+///Calling%20Horner2,%20we%20make%20a%20change%20of%20origin,%20i.e.%20express%20$P(X)$%20in%20terms%20of%20the%20$(X-a)^k$,%20and%20compare%20with%20the%20builtin%20ptayl%20command.&+function%20Taylor(p%2Ca)%0A%20%20local%20q%2Cj%2Cn%3B%0A%20%20q%3A%3Dp%3B%0A%20%20n%3A%3Ddegree(p)%3B%0A%20%20for%20j%20from%200%20to%20n%20do%0A%20%20%20%20p%2Cq%5Bj%5D%3A%3DHorner2(p%2Ca)%3B%0A%20%20od%3B%0A%20%20return%20reverse(q)%3B%0Affunction%3A%3B&+Taylor(%5B1%2C2%2C3%5D%2C4)%3B%0Aptayl(%5B1%2C2%2C3%5D%2C4)&"
                               target="_blank">Horner and Taylor</a>
                        </li>
                        <li> Polynomial interpolation
                            <a href="#exec&python=0&+///Interpolation%20of%20$ln(x^2+1)$%20at%2011%20equispaced%20points%20on%20$[0,1]$.&+f(x)%3A%3Dln(x%5E2%2B1)%3B%20n%3A%3D10%3B%20%0AX%3A%3Devalf(seq(j%2Fn%2Cj%2C0%2Cn))%3B%20%0AY%3A%3Dmap(X%2Cf)%3B&+P%3A%3Dinterp(X%2CY)%3B%0A&+plot(%5Bf(x)%2CP%5D%2Cx%3D-1..2%2Ccolor%3D%5Bred%2Cblue%5D)&+plot(1e7*abs(f(x)-P)%2Cx%3D0..1)&+///Runge's%20phenomenon:%20adding%20more%20equispaced%20points%20does%20not%20help.%20Here%20we%20take%20$n+1$%20points%20on%20[-1,1]%20with%20$n=20$.&+f(x)%3A%3D1%2F(1%2B25x%5E2)%3B%20n%3A%3D20%3B%20%0AX%3A%3Dseq(2*j%2Fn-1.0%2Cj%2C0%2Cn)%3A%3B&+gl_y%3D-2..2%3B%0Al%3A%3Dlagrange(X%2Cmap(X%2Cf))%3A%3B%20%0Aplot(%5Bl%2Cf(x)%5D%2Cx%3D-1..1)&+plot(l-f(x)%2Cx%3D-1..1)%0A&+///This%20does%20not%20happen%20with%20Tchebyshev%20points.&+T%3A%3Dseq(cos((j%2B0.5)*pi%2F(n%2B1))%2C%0A%20%20j%2C0%2Cn)%3B&+apply(point%2CT)&+l%3A%3Dlagrange(T%2Cmap(T%2Cf))%3A%3B%20%0Aplot(%5Bl%2Cf(x)%5D%2Cx%3D-1..1)&+plot((l-f(x))%2Cx%3D-1..1)&"
                               target="_blank"> Runge's phenomenom, Tchebyshev points</a>
                        </li>
                        <li> Polynomial GCD
                            <a href="#exec&python=0&+///GCD%20of%20univariate%20polynomials%20with%20integer%20coefficients.&+a%3A%3D(x-1)%5E8*(x%5E2%2B2)%3B%0Ab%3A%3D(x-1)*(x%5E2%2B2)%5E4&+function%20Euclide(a%2Cb)%0A%20%20while%20b!%3D0%20do%0A%20%20%20%20print(b)%3B%0A%20%20%20%20a%2Cb%3A%3Db%2Crem(a%2Cb)%3B%0A%20%20od%3B%0A%20%20return%20a%3B%0Affunction%3A%3B&+Euclide(a%2Cb)&+///Coefficients%20are%20rationals,%20hence%20computations%20are%20more%20expensive%20(numerator%20and%20denominator%20size%20grows%20in%20the%20Euclide%20algorithm).%20To%20avoid%20rationals,%20we%20replace%20division%20by%20pseudo-division%20(this%20does%20not%20change%20the%20gcd).&+function%20Euclide1(a%2Cb)%0A%20%20if%20degree(a)%3Cdegree(b)%20then%20return%20Euclide1(b%2Ca)%3B%20fi%3B%0A%20%20while%20b!%3D0%20do%0A%20%20%20%20print(b)%3B%0A%20%20%20%20a%2Cb%3A%3Db%2Crem(lcoeff(b)%5E(degree(a)-degree(b)%2B1)*a%2Cb)%3B%0A%20%20od%3B%0A%20%20return%20a%3B%0Affunction%3A%3B&+Euclide1(a%2Cb)&+///We%20observe%20that%20the%20coefficient%20sizes%20grows%20rapidly.%20To%20avoid%20that%20we%20can%20replace%20$b$%20by%20it's%20primitive%20part%20(divide%20by%20the%20gcd%20of%20the%20coefficients).&+function%20Euclide2(a%2Cb)%0A%20%20if%20degree(a)%3Cdegree(b)%20then%20return%20Euclide2(b%2Ca)%3B%20fi%3B%0A%20%20while%20b!%3D0%20do%0A%20%20%20%20b%3A%3Dprimpart(b)%3B%0A%20%20%20%20print(b)%3B%0A%20%20%20%20a%2Cb%3A%3Db%2Crem(lcoeff(b)%5E(degree(a)-degree(b)%2B1)*a%2Cb)%3B%0A%20%20od%3B%0A%20%20return%20a%3B%0Affunction%3A%3B&+Euclide2(a%2Cb)&+///It's%20better,%20but%20computing%20the%20content%20(gcd%20of%20coefficients)%20of%20$b$%20at%20each%20step%20is%20still%20expensive.%0aThe%20subresultant%20algorithm%20computes%20a%20divisor%20of%20the%20content.%20This%20coefficient%20is%20not%20optimal,%20but%20almost%20and%20it%20is%20easy%20to%20%0acompute.&+function%20Euclide3(a%2Cb)%0A%20%20local%20g%2Ch%2Cq%3B%0A%20%20if%20degree(a)%3Cdegree(b)%20then%20return%20Euclide3(b%2Ca)%3B%20fi%3B%0A%20%20g%3A%3D1%3B%20h%3A%3D1%3B%20%0A%20%20while%20b!%3D0%20do%0A%20%20%20%20d%3A%3Ddegree(a)-degree(b)%3B%0A%20%20%20%20q%3A%3Dlcoeff(b)%3B%0A%20%20%20%20a%2Cb%3A%3Db%2Crem(q%5E(d%2B1)*a%2Cb)%3B%0A%20%20%20%20b%3A%3Dratnormal(b%2F(g*h%5Ed))%3B%0A%20%20%20%20g%3A%3Dq%3B%20h%3A%3Dq%5Ed%2Fh%5E(d-1)%3B%0A%20%20od%3B%0A%20%20return%20a%3B%0Affunction%3A%3B&+Euclide3(a%2Cb)&+///Modular%20methods%20are%20more%20efficient.%20If%20the%20polynomials%20are%20prime%20together,%20they%20will%20be%20modulo%20any%20prime%20not%20dividing%20the%20resultant%20of%20the%20polynomials,%20it%20will%20easily%20be%20detected.%0aOtherwise,%20we%20rebuild%20the%20GCD%20modulo%20one%20or%20more%20prime%20numbers%20(by%20Chinese%20remaidering)%20that%20return%20the%20minimal%20degree%20and%20we%20test%20divisibility%20of%20$a$%20and%20$b$.%20%0a&+Euclide(a%20mod%2011%2Cb%2B1%20mod%2011)&+g%3A%3DEuclide(a%20mod%2011%2Cb%20mod%2011)&+normal(g%2Flcoeff(g))%20mod%200&"
                               target="_blank">from Euclide to sub-resultant</a>
                        </li>
                        <li>
                            <a
                                href="#exec&python=0&+///%3Ch1%3eLinear%20algebra%20on%20a%20finite%20field.%3C/h1%3e%0aLU%20decomposition%20and%20application%20to%20linear%20system%20solving.&+n%3A%3D5%3B%20p%3A%3D17%3B%20a%3A%3Drandmatrix(n%2Cn%2C1%20mod%20p)&+p%2Cl%2Cu%3A%3Dlu(a)&+function%20myinv(a)%0A%20%20local%20b%2Cc%2Cj%2Cp%2Cl%2Cu%3B%0A%20%20n%3A%3Dsize(a)%3B%0A%20%20b%3A%3Da%3B%20%0A%20%20c%3A%3Didentity(n)%3B%0A%20%20p%2Cl%2Cu%3A%3Dlu(a)%3B%0A%20%20for%20j%20from%200%20to%20n-1%20do%20%0A%20%20%20%20b%5Bj%5D%3A%3Dlinsolve(p%2Cl%2Cu%2Cc%5Bj%5D)%3B%0A%20%20od%3B%0A%20%20return%20b%3B%0Affunction%3A%3B&+myinv(a)%3B%20inv(a)&+///Algorithm%20to%20compute%20the%20characteristic%20polynomial%20by%20interpolation%20in%20$O(n^4)$%20operations.&+function%20polchar(a)%0A%20%20local%20j%2Cp%2Cn%2CI%2CN%2Cg%2Cgj%2CX%2CY%3B%0A%20%20if%20type(a%5B0%2C0%5D)!%3D15%20then%20%0A%20%20%20%20return%20%22expecting%20matrix%20with%20coefficients%20in%20Z%2FpZ%22%3B%20%0A%20%20fi%3B%0A%20%20p%3A%3Da%5B0%2C0%2C2%5D%3B%20%2F%2F%20field%20char.%0A%20%20if%20!isprime(p)%20then%20%0A%20%20%20%20return%20p%2B%22%20is%20not%20prime%22%3B%20%0A%20%20fi%3B%0A%20%20n%3A%3Dsize(a)%3B%0A%20%20I%3A%3Didentity(n)%3B%0A%20%20X%3A%3D%5B%5D%3B%20Y%3A%3D%5B%5D%3B%0A%20%20if%20n%3Cp%20then%0A%20%20%20%20for%20j%20from%200%20to%20n%20do%0A%20%20%20%20%20%20X%5Bj%5D%3A%3Dj%3B%0A%20%20%20%20%20%20Y%5Bj%5D%3A%3Ddet(j*I-a)%3B%0A%20%20%20%20od%3B%0A%20%20%20%20return%20normal(interp(X%2CY))%3B%0A%20%20fi%3B%0A%20%20%2F%2F%20construct%20an%20extension%20of%20Z%2FpZ%0A%20%20N%3A%3Dceil(log(n%2B1)%2Flog(p))%3B%0A%20%20purge(g)%3B%0A%20%20GF(p%2CN%2Cg)%3B%0A%20%20%2F%2F%20interpolation%20at%20g%5Ej%0A%20%20gj%3A%3D1%3B%0A%20%20for%20j%20from%200%20to%20n%20do%0A%20%20%20%20X%5Bj%5D%3A%3Dgj%3B%0A%20%20%20%20Y%5Bj%5D%3A%3Ddet(gj*I-a)%3B%0A%20%20%20%20gj%3A%3Dg*gj%3B%0A%20%20od%3B%0A%20%20return%20normal(interp(X%2CY))%3B%0Affunction%3A%3B&+polchar(a)%3B%20charpoly(a%2Cx)&+a%3A%3Drandmatrix(8%2C8%2C1%20mod%205)&+polchar(a)%3B%20charpoly(a%2Cx)&"
                                target="_blank">
                            Linear algebra over a finite field
                            </a>
                        </li>
                        <li> Groebner  basis
                            <a
                                href="#exec&python=0&+cyclic6%3A%3D%20%5B2*(x*y*z%2By*z*t%2Bz*t*u%2Bt*u*v%2Bu*v*x%2Bv*x*y)%2C%20%0Ax*y*z*t%2By*z*t*u%2Bz*t*u*v%2Bt*u*v*x%2Bu*v*x*y%2Bv*x*y*z%2C%20%0Ax*y*z*t*u*v-1%2C%20%0Ax%2By%2Bz%2Bt%2Bu%2Bv%2C%20%0Ax*y%2By*z%2Bz*t%2Bt*u%2Bu*v%2Bx*v%2C%20%0Ax*y*z*t*u%2By*z*t*u*v%2Bz*t*u*v*x%2Bt*u*v*x*y%2Bu*v*x*y*z%2Bv*x*y*z*t%5D%3B&+p%3A%3Dprevprime(2%5E24)%3B&+time(G%3A%3D%0A%20%20gbasis(cyclic6%20mod%20p%2C%0A%20%20%20%20indets(cyclic6)))&+size(G)&+G%5B20%5D&+time(H%3A%3D%0A%20%20gbasis(cyclic6%2C%0A%20%20%20%20indets(cyclic6)))&+H%5B20%5D&+normal(1%2F(lcoeff(H%5B20%5D%2Cv)%20mod%20p)%0A%20%20*H%5B20%5D)&+normal(1%2F(lcoeff(G%5B20%5D%2Cv)%20mod%20p)%0A%20%20*G%5B20%5D-1%2F(lcoeff(H%5B20%5D%2Cv)%20mod%20p)%0A%20%20*H%5B20%5D)&"
                                target="_blank">cyclic6</a>.
                            For more intensive computations, activate
			wasm in the settings and open
                            <a
                                href="#exec&python=1&+cyclic7%3A%3D%5Bx1%2Bx2%2Bx3%2Bx4%2Bx5%2Bx6%2Bx7%2C%0A%20%20%20%20%20%20%20%20%20%20x1*x2%2Bx1*x7%2Bx2*x3%2Bx3*x4%2Bx4*x5%2Bx5*x6%2Bx6*x7%2C%0A%20%20%20%20%20%20%20%20%20%20x1*x2*x3%2Bx1*x2*x7%2Bx1*x6*x7%2Bx2*x3*x4%2Bx3*x4*x5%2Bx4*x5*x6%2Bx5*x6*x7%2C%0A%20%20%20%20%20%20%20%20%20%20x1*x2*x3*x4%2Bx1*x2*x3*x7%2Bx1*x2*x6*x7%2Bx1*x5*x6*x7%2Bx2*x3*x4*x5%2Bx3*x4*x5*x6%2Bx4*x5*x6*x7%2C%0A%20%20%20%20%20%20%20%20%20%20x1*x2*x3*x4*x5%2Bx1*x2*x3*x4*x7%2Bx1*x2*x3*x6*x7%2Bx1*x2*x5*x6*x7%2Bx1*x4*x5*x6*x7%2Bx2*x3*x4*x5*x6%2Bx3*x4*x5*x6*x7%2C%0A%20%20%20%20%20%20%20%20%20%20x1*x2*x3*x4*x5*x6%2Bx1*x2*x3*x4*x5*x7%2Bx1*x2*x3*x4*x6*x7%2Bx1*x2*x3*x5*x6*x7%2Bx1*x2*x4*x5*x6*x7%2Bx1*x3*x4*x5*x6*x7%2Bx2*x3*x4*x5*x6*x7%2C%0A%20%20%20%20%20%20%20%20%20%20x1*x2*x3*x4*x5*x6*x7-1%5D%3A%3B&+p%3A%3Dprevprime(2%5E24)&+time(G%3A%3Dgbasis(cyclic7%20mod%20p%2Clname(cyclic7)%2Crevlex))%3B&+size(G)&"
                                target="_blank">cyclic7 (modular)</a>.
If you want to see informations while a computation is running, run first
<tt>debug_infolevel:=1</tt> (or more), then open the browser console.
                            For really large computations, use native Xcas versions.
                        </li>
                        <li> Arithmetic on multivariate polynomials (requires a browser
                            compatible with Web-Assembly, like Firefox &geq; 58).
                            <a
                                href="#exec&python=0&+n%3A%3D20%3B&+f%20%3A%3D%20symb2poly((1%20%2B%20x%20%2B%20y%20%2B%20z%2Bt)%5En%2C%5Bx%2Cy%2Cz%2Ct%5D)%3A%3B%0Aq%3A%3Dsymb2poly(x%5E(n-3)%2C%5Bx%2Cy%2Cz%2Ct%5D)%3A%3B%0Asize(f)%3B&+time(p%3A%3Df*(f%2B1))%3B%0Asize(p)%3B&+time(h%3A%3Dquo(p%2Cf%2C2))%3B%0Ah-f%3B&+time(h%2Cr%3A%3Dquorem(p%2Bq%2Cf%2C-1))%3B%0Ah-f%3Bpoly2symb(r%2C%5Bx%2Cy%2Cz%2Ct%5D)%3B&"
                                target="_blank">Fateman benchmark for n=20</a>
                        </li>
                        <li>
                            <a
                                href="#filename=parisseb%40orange.fr%40%20%20session&from=parisseb%40orange.fr&python=0&+///Approx%20linear%20algebra&+n%3A%3D500%3B%20%0Am%3A%3Dranm(n%2Cn%2Cuniformd%2C-1%2C1)%3A%3B%0Atime(q%2Cr%3A%3Dqr(m%2C-1))%3B%0Amaxnorm(m-q*r)%3B&+time(p%2Cq%3A%3Dschur(m))%3B%0Amaxnorm(p*q*trn(p)-m)%0A&+time(p%2Cl%2Cu%3A%3Dlu(m))%3B%0Amaxnorm(l*u-permu2mat(p)*m)&"
                                target="_blank">
                            Approx benchmarks
                            </a>
                        </li>
                      </li>
                      <li>
                            <a
                                href="#exec&python=0&+///Series%20expansion%20benchmark.&+n%3A%3D200%3Bseries(%22t%22)%3B%20%0Au%20%3A%3D%20t%20%2B%20O(t%5En)%3B%20%0Atime(r%3A%3D(u%2F(exp(u)-1))*exp(x*u))%3B&+///Expand%20power%20of%20polynomial%20with%20coefficient%20in%20an%20extension%20of%20$QQ$.&+x%3A%3Drootof(cyclotomic(20))%3B%0Af%3A%3D(3x%5E7%20%2B%20x%5E4%20-%203x%20%2B%201)*y%5E3%20%2B%20(2x%5E6-x%5E5%2B4x%5E4-x%5E3%2Bx%5E2-1)*y%20%2B(-3x%5E7%2B2x%5E6-x%5E5%2B3x%5E3-2x%5E2%2Bx)%3A%3B%0Ap%3A%3Dsymb2poly(f%2Cy%2C%5B%5D)%3A%3B%20time(s%3A%3Dp%5E400)%3B&+///Determinant%20of%20a%20matrix%20of%20size%20$n$%20with%20random%20coefficients%20in%20an%20extension%20of%20$QQ$.&+purge(x)%3Bn%3A%3D40%3B%0Aa%3A%3Drootof(x%5E3%2B3x%2B1)%3B%20%0Am%3A%3Dranm(n%2Cn%2Ca)%3A%3B%20%0Atime(d%3A%3Ddet(m))%3B&+///Determinant%20of%20a%20matrix%20with%20polynomial%20coefficients%20over%20$ZZ$/$p*ZZ$&+p%20%3A%3D%202003*1009%3B%20n%3A%3D40%3B%20%0Af(j%2Ck)%3A%3D%7B%20k%3A%3Drand(6)%3B%20return%20randpoly(x%2Ck)%20mod%20p%3B%20%7D%3B%20%0Am%3A%3Dmatrix(n%2Cn%2Cf)%3A%3B%20%0Atime(det(m))%3B&+///Characteristic%20polynomial%20of%20a%20matrix%20with%20integer%20coefficients.&+n%3A%3D70%3B%20%0Am%3A%3Dranm(n%2Cn%2C-21)%3A%3B%20%0Atime(charpoly(m))%3B&"
                                target="_blank">
                            Exact benchmarks
                            </a>
                        </li>
                        <li>
                            Fractals:
                            <ul>
                                <li>
                                    Mandelbrot
                                    <a
                                        href="#exec&python=0&+///Mandelbrot%20fractal,%20not%20using%20symmetry.&+function%20fra(X%2CY%2CNmax)%0A%20%20local%20x%2Cy%2Cz%2Cc%2Cj%2Cw%2Ch%2Cres1%2Cres2%3B%0A%20%20w%3A%3D2.7%2FX%3B%0A%20%20h%3A%3D-1.87%2FY%3B%0A%20%20res1%3A%3D%5B%5D%3B%20%0A%20%20Y%3A%3DY-1%3B%0A%20%20for%20y%20from%200%20to%20Y%20do%0A%20%20%20%20c%3A%3D-2.1%2Bi*(h*y%2B0.935)%3B%0A%20%20%20%20for%20x%20from%200%20to%20X-1%20do%0A%20%20%20%20%20%20z%3A%3D0%3B%0A%20%20%20%20%20%20for%20j%20from%200%20to%20Nmax-1%20do%0A%20%20%20%20%20%20%20%20if%20abs(z%3A%3Dz%5E2%2Bc)%3E2%20then%20break%3B%20fi%3B%0A%20%20%20%20%20%20od%3B%0A%20%20%20%20%20%20res1.append(pixon(x%2Cy%2C126*j%2B2079))%3B%0A%20%20%20%20%20%20c%3A%3Dc%2Bw%3B%0A%20%20%20%20od%3B%0A%20%20od%3B%0A%20%20return%20res1%3B%0Affunction%3A%3B&+///Faster%20program%20using%20symmetry.&+function%20fra1(X%2CY%2CNmax)%0A%20%20local%20x%2Cy%2Cz%2Cc%2Cj%2Cw%2Ch%2Cres1%2Cres2%3B%0A%20%20w%3A%3D2.7%2FX%3B%0A%20%20h%3A%3D-1.87%2FY%3B%0A%20%20res1%3A%3Dmakelist(-ceil(X*Y%2F2)-1)%3B%20%0A%20%20res2%3A%3Dcopy(res1)%3B%0A%20%20Y%3A%3DY-1%3B%0A%20%20for%20y%20from%200%20to%20Y%2F2%20do%0A%20%20%20%20c%3A%3D-2.1%2Bi*(h*y%2B0.935)%3B%0A%20%20%20%20for%20x%20from%200%20to%20X-1%20do%0A%20%20%20%20%20%20z%3A%3D0%3B%0A%20%20%20%20%20%20for%20j%20from%200%20to%20Nmax-1%20do%0A%20%20%20%20%20%20%20%20if%20abs(z%3A%3Dz%5E2%2Bc)%3E2%20then%20break%3B%20fi%3B%0A%20%20%20%20%20%20od%3B%0A%20%20%20%20%20%20res1.append(pixon(x%2Cy%2C126*j%2B2079))%3B%0A%20%20%20%20%20%20res2.append(pixon(x%2CY-y%2C126*j%2B2079))%3B%0A%20%20%20%20%20%20c%3A%3Dc%2Bw%3B%0A%20%20%20%20od%3B%0A%20%20od%3B%0A%20%20return%20res1%2Cres2%3B%0Affunction%3A%3B&+pixon(1)&+fra1(260%2C222%2C10)&"
                                        target="_blank">Xcas</a>,
                                    <a href="#exec&python=1&+///Mandelbrot%20fractal,%20Python%20compatible%20syntax,%20without%20symmetry%20trick.&+def%20fra(X%2CY%2CNmax)%3A%0A%20%20local%20x%2Cy%2Cz%2Cc%2Cj%2Cw%2Ch%2Cres1%0A%20%20w%3D2.7%2FX%0A%20%20h%3D-1.87%2FY%0A%20%20res1%3D%5B%5D%0A%20%20res2%3D%5B%5D%0A%20%20for%20y%20in%20range(Y)%3A%0A%20%20%20%20c%20%3D%20-2.1%2Bi*(h*y%2B0.935)%0A%20%20%20%20for%20x%20in%20range(X)%3A%0A%20%20%20%20%20%20z%20%3D%200%0A%20%20%20%20%20%20for%20j%20in%20range(Nmax)%3A%0A%20%20%20%20%20%20%20%20if%20abs(z%3A%3Dz**2%2Bc)%3E2%3A%0A%20%20%20%20%20%20%20%20%20%20%20break%0A%20%20%20%20%20%20res1.append(pixon(x%2Cy%2C126*j%2B2079))%0A%20%20%20%20%20%20c%20%3D%20c%2Bw%3B%0A%20%20return%20res1&+///Mandelbrot%20fractal%20with%20symmetry.&+def%20fra1(X%2CY%2CNmax)%3A%0A%20%20local%20x%2Cy%2Cz%2Cc%2Cj%2Cw%2Ch%2Cres1%2Cres2%0A%20%20w%3D2.7%2FX%0A%20%20h%3D-1.87%2FY%0A%20%20res1%3Dmakelist(-ceil(X*Y%2F2)-1)%0A%20%20res2%3Dcopy(res1)%0A%20%20Y%3DY-1%0A%20%20for%20y%20in%20range(ceil(Y%2F2)%2B1)%3A%0A%20%20%20%20c%20%3D%20-2.1%2Bi*(h*y%2B0.935)%0A%20%20%20%20for%20x%20in%20range(X)%3A%0A%20%20%20%20%20%20z%20%3D%200%0A%20%20%20%20%20%20for%20j%20in%20range(Nmax)%3A%0A%20%20%20%20%20%20%20%20if%20abs(z%3A%3Dz**2%2Bc)%3E2%3A%0A%20%20%20%20%20%20%20%20%20%20%20break%0A%20%20%20%20%20%20res1.append(pixon(x%2Cy%2C126*j%2B2079))%0A%20%20%20%20%20%20res2.append(pixon(x%2CY-y%2C126*j%2B2079))%0A%20%20%20%20%20%20c%20%3D%20c%2Bw%3B%0A%20%20return%20res1%2Cres2&+pixon(1)&+fra1(260%2C222%2C10)&"
                                       target="_blank">Python</a>,
                                </li>
                                <li>
                                    Newton fractals
                                    <a href="#exec&python=0&+///We%20iterate%20Newton%20method%20to%20find%20the%20roots%20of%20a%20polynomial%20$P$,%20$z[n+1]=z[n]-P(z[n])/P'(z[n])$,%20if%20there%20is%20numeric%20convergence%20we%20color%20the%20initial%20point%20$z[0]$%20of%20the%20sequence%20with%20a%20color%20depending%20on%20the%20root%20number.%0aTwo%20versions%20are%20proposed,%20fsym%20is%20using%20complex%20conjugation%20symmetry%20to%20speedup%20computations%20by%20a%20factor%20about%202.&+function%20f(P%2Cxmin%2Cxmax%2Cymin%2Cymax%2CN%2Cmaxiter)%0A%20%20local%20z0%2Cz%2Czp%2Chx%2Chy%2Cj%2Ck%2Cl%2Cn%2Cr%2Crs%2Cres%3B%0A%20%20P%3A%3Dsymb2poly(P)%3B%0A%20%20res%3A%3Dmakelist(-(N%2B1)%5E2)%3B%0A%20%20r%3A%3Dproot(P)%3B0%3B%20%2F%2F%20f(x%5E5-1%2C-1.3%2C1.3%2C-1.3%2C1.3%2C134%2C10)%0A%20%20rs%3A%3Dsize(r)-1%3B%0A%20%20hx%3A%3Devalf(xmax-xmin)%2FN%3B%20%0A%20%20hy%3A%3Devalf(ymax-ymin)%2FN%3B%0A%20%20for%20k%20from%200%20to%20N%20do%0A%20%20%20%20z0%3A%3Dxmin%2Bi*(ymin%2Bk*hy)%3B%0A%20%20%20%20for%20j%20from%200%20to%20N%20do%0A%20%20%20%20%20%20z%3A%3Dz0%3B%0A%20%20%20%20%20%20for%20l%20from%200%20to%20maxiter%20do%0A%20%20%20%20%20%20%20%20if%20distance((z%3A%3Dhorner(P%2C(zp%3A%3Dhorner(P%2Cz%2Cnewton))%2Cnewton))%2Czp)%3C1e-4%20or%20abs(z)%3E1e20%20then%20%0A%20%20%20%20%20%20%20%20%20%20break%3B%20%0A%20%20%20%20%20%20%20%20fi%3B%0A%20%20%20%20%20%20od%3B%0A%20%20%20%20%20%20if%20z%3D%3Dundef%20then%20continue%3B%20fi%3B%0A%20%20%20%20%20%20for%20n%20from%200%20to%20rs%20do%0A%20%20%20%20%20%20%20%20if%20distance(z%2Cr%5Bn%5D)%3C1e-4%20then%20break%3B%20fi%3B%0A%20%20%20%20%20%20od%3B%0A%20%20%20%20%20%20res.append(pixon(j%2Ck%2C256%2B25*n%2Bl))%3B%0A%20%20%20%20%20%20z0%3A%3Dz0%2Bhx%3B%0A%20%20%20%20od%3B%0A%20%20od%3B%0A%20%20return%20res%3B%0Affunction%3A%3B&+function%20fsym(P%2Cxmin%2Cxmax%2Cymin%2CN%2Cmaxiter)%0A%20%20local%20z0%2Cz%2Czp%2Chx%2Chy%2Cj%2Ck%2Cl%2Cn%2Cr%2Crs%2Crimag%2Cres1%2Cres2%3B%0A%20%20P%3A%3Dsymb2poly(P)%3B%0A%20%20if%20size(im(P))!%3D0%20then%20return%20%22Polynomial%20must%20have%20real%20coefficients%22%3B%20fi%3B%0A%20%20r%3A%3Dproot(P)%3B%0A%20%20%2F%2F%20extract%20roots%20with%20imaginary%20part%20%3E%3D0%2C%20put%20reals%20at%20the%20end%0A%20%20res1%3A%3Dselect(x-%3Eim(x)%3E0%2Cr)%3B%0A%20%20rimag%3A%3D2*size(res1)%3B%0A%20%20res2%3A%3Dselect(x-%3Eim(x)%3D%3D0%2Cr)%3B%0A%20%20r%3A%3Dconcat(res1%2Creverse(conj(res1))%2Cres2)%3B%0A%20%20rs%3A%3Dsize(r)-1%3B%0A%20%20res1%3A%3Dmakelist(-ceil((N%2B1)%5E2%2F2))%3B%20%0A%20%20res2%3A%3Dmakelist(-ceil((N%2B1)%5E2%2F2))%3B%0A%20%20hx%3A%3Devalf(xmax-xmin)%2FN%3B%20%0A%20%20hy%3A%3Devalf(-2*ymin)%2FN%3B%0A%20%20for%20k%20from%200%20to%20N%2F2%20do%0A%20%20%20%20z0%3A%3Dxmin%2Bi*(ymin%2Bk*hy)%3B%0A%20%20%20%20for%20j%20from%200%20to%20N%20do%0A%20%20%20%20%20%20z%3A%3Dz0%3B%0A%20%20%20%20%20%20for%20l%20from%200%20to%20maxiter%20do%0A%20%20%20%20%20%20%20%20if%20distance((z%3A%3Dhorner(P%2C(zp%3A%3Dhorner(P%2Cz%2Cnewton))%2Cnewton))%2Czp)%3C1e-4%20or%20abs(z)%3E1e20%20then%20%0A%20%20%20%20%20%20%20%20%20%20break%3B%20%0A%20%20%20%20%20%20%20%20fi%3B%0A%20%20%20%20%20%20od%3B%0A%20%20%20%20%20%20if%20z%3D%3Dundef%20then%20continue%3B%20fi%3B%0A%20%20%20%20%20%20for%20n%20from%200%20to%20rs%20do%0A%20%20%20%20%20%20%20%20if%20distance(z%2Cr%5Bn%5D)%3C1e-4%20then%20break%3B%20fi%3B%0A%20%20%20%20%20%20od%3B%0A%20%20%20%20%20%20res1.append(pixon(j%2Ck%2C256%2B25*n%2Bl))%3B%0A%20%20%20%20%20%20res2.append(pixon(j%2CN-k%2C256%2B25*when(n%3E%3Drimag%2Cn%2Crimag-n-1)%2Bl))%3B%0A%20%20%20%20%20%20z0%3A%3Dz0%2Bhx%3B%0A%20%20%20%20od%3B%0A%20%20od%3B%0A%20%20return%20res1%2Cres2%3B%0Affunction%3A%3B&+pixon(1)&+fsym(x%5E5-1%2C-1.3%2C1.3%0A%2C-1.3%2C150%2C10)&+0%3B%20%2F%2F%20f(x%5E5-1%2C-1.3%2C1.3%2C-1.3%2C1.3%2C134%2C10)&"
                                       target="_blank">Xcas</a>,
                                    <a href="#exec&python=1&+///We%20iterate%20Newton%20method%20to%20find%20the%20roots%20of%20a%20polynomial%20$P$,%20$z[n+1]=z[n]-P(z[n])/P'(z[n])$,%20if%20there%20is%20numeric%20convergence%20we%20color%20the%20initial%20point%20$z[0]$%20of%20the%20sequence%20with%20a%20color%20depending%20on%20the%20root%20number.%0aTwo%20versions%20are%20proposed%20in%20Python-compatible%20syntax,%20fsym%20is%20using%20complex%20conjugation%20symmetry%20to%20speedup%20computations%20by%20a%20factor%20about%202.&+def%20f(P%2Cxmin%2Cxmax%2Cymin%2Cymax%2CN%2Cmaxiter)%3A%0A%20%20%20%20%23%20local%20z%2Cz0%2Czp%2Chx%2Chy%2Cj%2Ck%2Cl%2Cn%2Cr%2Crs%2Cres%0A%20%20%20%20P%3Dsymb2poly(P)%0A%20%20%20%20res%3D%5B%5D%0A%20%20%20%20r%3Dproot(P)%0A%20%20%20%20rs%3Dsize(r)%0A%20%20%20%20hx%3Devalf(xmax-xmin)%2FN%0A%20%20%20%20hy%3Devalf(ymax-ymin)%2FN%0A%20%20%20%20for%20k%20in%20range(N%2B1)%3A%0A%20%20%20%20%20%20%20%20z0%3Dxmin%2Bi*(ymin%2Bk*hy)%0A%20%20%20%20%20%20%20%20for%20j%20in%20range(N%2B1)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20z%3Dz0%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20l%20in%20range(maxiter)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20distance((z%3A%3Dhorner(P%2C(zp%3A%3Dhorner(P%2Cz%2Cnewton))%2Cnewton))%2Czp)%3C1e-4%20or%20abs(z)%3E1e20%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20z%3D%3Dundef%3A%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20continue%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20n%20in%20range(rs)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20distance(z%2Cr%5Bn%5D)%3C1e-4%3A%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20break%0A%20%20%20%20%20%20%20%20%20%20%20%20res.append(pixon(j%2Ck%2C256%2B25*n%2Bl))%0A%20%20%20%20%20%20%20%20%20%20%20%20z0%3Dz0%2Bhx%0A%20%20%20%20return%20res&+def%20fsym(P%2Cxmin%2Cxmax%2Cymin%2CN%2Cmaxiter)%3A%0A%20%20%20%20%23%20local%20z0%2Cz%2Czp%2Chx%2Chy%2Cj%2Ck%2Cl%2Cn%2Cr%2Crs%2Crimag%2Cres1%2Cres2%0A%20%20%20%20P%3Dsymb2poly(P)%0A%20%20%20%20if%20size(im(P))%3C%3E0%20%3A%0A%20%20%20%20%20%20%20%20return(%22Polynomial%20must%20have%20real%20coefficients!%22)%0A%20%20%20%20r%3Dproot(P)%0A%20%20%20%20res1%3Dselect(lambda%20x%3Aim(x)%3E0%2Cr)%0A%20%20%20%20rimag%3D2*size(res1)%0A%20%20%20%20res2%3Dselect(lambda%20x%3Aim(x)%3D%3D0%2Cr)%0A%20%20%20%20r%3Dconcat(res1%2Creverse(conj(res1))%2Cres2)%0A%20%20%20%20rs%3Dsize(r)%0A%20%20%20%20res1%3D%5B%5D%0A%20%20%20%20res2%3D%5B%5D%0A%20%20%20%20hx%3Devalf(xmax-xmin)%2FN%0A%20%20%20%20hy%3Devalf(-2*ymin)%2FN%0A%20%20%20%20for%20k%20in%20range(ceil((N%2B1)%2F2))%3A%0A%20%20%20%20%20%20%20%20z0%3Dxmin%2Bi*(ymin%2Bk*hy)%0A%20%20%20%20%20%20%20%20for%20j%20in%20range(0%2CN%2B1)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20z%3Dz0%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20l%20in%20range(maxiter)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20distance((z%3A%3Dhorner(P%2C(zp%3A%3Dhorner(P%2Cz%2Cnewton))%2Cnewton))%2Czp)%3C0.0001%20or%20abs(z)%3E1e%2B20%20%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20break%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(z%3D%3Dundef)%20%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20continue%0A%20%20%20%20%20%20%20%20%20%20%20%20for%20n%20in%20range(rs)%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20(distance(z%2Cr%5Bn%5D))%3C0.0001%20%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20break%0A%20%20%20%20%20%20%20%20%20%20%20%20res1.append(pixon(j%2Ck%2C256%2B25*n%2Bl))%0A%20%20%20%20%20%20%20%20%20%20%20%20res2.append(pixon(j%2CN-k%2C256%2B25*when(n%3E%3Drimag%2Cn%2Crimag-n-1)%2Bl))%0A%20%20%20%20%20%20%20%20%20%20%20%20z0%3Dz0%2Bhx%0A%20%20%20%20return(res1%2Cres2)&+pixon(1)&+fsym(x%5E5-1%2C-1.3%2C1.3%2C-1.3%2C150%2C10)&+0%3B%20%2F%2F%20f(x%5E5-1%2C-1.3%2C1.3%2C-1.3%2C1.3%2C134%2C10)&"
                                       target="_blank">Python</a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </div>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('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">
                    From the top you will see:
                    <ul>
                        <li>
                            a panel of buttons: settings, save/restore session,
                            helpers (Xcas logo maths, programming, scientific keyboard, documentation).
                            Some buttons or links are not visible at startup like the x2 or
                            &#x2709; links:
                            <ul>
                                <li> the <strong>x2</strong> (resp. local) link may be used to replicate a
                                    session, right-click to copy/paste the link in Xcas native or
                                    on a static web
                                    page. It is also useful if you stop a computation that would
                                    take too long.
                                <li> the <strong>&#x2709;</strong> link lets you share your session by e-mail.
                                </li>
                            </ul>
                        </li>
                        <li> a <strong>help</strong> area, where you will see short descriptions of the
                            commands you asked the syntax. You can clear the help area with
                            the erase button at the right of the help search field.
                        </li>
                        <li> the <strong>history</strong> area contains levels (0 at the
                            beginning), a level is a pair commandline (written in
                            black)/answer (in blue).
                            You can move levels with the ↑ and ↓ buttons.
                            You can modify an existing commandline, update it with the
                            &#x2705; button or Enter key at the beginning of the field.
                            You can throw a level to the trash with the erase button at the
                            right of the level. You can restore levels from the trash with
                            the Restore button at the bottom of the history, or empty
                            the trash.
                            The link <tt>+</tt> right to the Empty button lets you open
                            a new empty session in a new tab.
                        </li>
                        <li>
                            a <strong>commandline</strong>,
                            type your command or program there,  then tap &#x2705;
                            or hit Enter (type Ctrl-Enter if your input has several lines, or
                            Enter on a blank line).
                            If you want to force a new line, hit Shift-Enter or tap the <tt>\n</tt> button.
                            <br>
                            For example, type <tt>1/2+1/3</tt>
                            or <tt>sin(pi/4)</tt> or <tt>sin(pi/4.0)</tt>.
                            <br>
                            The <tt>Math</tt>, <tt>prog</tt> and <tt>123</tt>
                            buttons may be used to help you fill the commandline.
                            <br>
                            If you know a commandname, type it (or its first letters),
                            for example <tt>factor</tt> then press
                            the <button>F1</button> key or the <button>?</button>
                            button. This will display a
                            <strong>short help</strong> on the command if it exists
                            or give some commandname hints if it does not or is incomplete.
                            <br>
                            For example, click on <tt>math</tt> then <tt>rewrite</tt> then
                            <tt>factor</tt> then <tt>?</tt>, look at the short help at the top,
                            click on one example or complete with x^4-1 then type Enter.
                            <br>
                            You can
                            <strong>select</strong> text  with the <tt>beg</tt>
                            and <tt>end</tt> buttons, remove selection
                            with <tt>del</tt> and paste selection with <tt>cp</tt>.
                            <br>
                            If you evaluate a blank commandline, this will add a
                            <strong>comment</strong> field. You can convert
                            a commandline into a comment (or a comment into a commandline):
                            type /// at the beginning then Enter.
                            You can comment an exisiting level by pressing
                            the &#x270e; key. You can write boldface, italic, etc. in a comment
                            using the buttons below the comment or typing HTML code.
                            If you want to render maths, you have two methods
                            <ul>
                                <li>enter a valid Xcas input between two dollars
                                    (<tt>$...$</tt>), the input will be parsed unevaled and converted to MathML for 2d
                                    display. For example <tt>$x[n+1]^2$</tt> will display x with
                                    exponent n+1, <tt>$A=[[1,2],[3,4]]$</tt> will display a matrix
                                    (it will not modify A), <tt>$integrate(sin(x),x,0,pi)$</tt>
                                    will display the integral of sin(x) between 0 and pi (the integral will not be
                                    computed), <tt>vector(u), vector(A,B)</tt> will display an arrow
                                    over u or AB.
                                    Symbols of sets like ℤ,ℕ may be obtained by entering
                                    <tt>$ZZ$, $NN$</tt>, for example type <tt>$x in QQ$</tt> to get x∈ℚ. HTML code may
                                    also help like <tt>&amp;forall;</tt> for &forall;,
                                    <tt>&amp;exist;</tt>, <tt>&amp;oplus;</tt>, <tt>&amp;otimes;</tt>,
                                    <tt>&amp;notin;</tt>, <tt>&amp;empty;</tt>, <tt>&amp;part;</tt>, etc.
                                    or copy/paste a symbol from
                                    <a href="https://www.w3schools.com/charsets/ref_utf_math.asp">here</a>.
                                <li> or enter a comment containing at least one pair of
                                    double dollars (<tt>$$...$$</tt>), the whole comment will be
                                    rendered as a LaTeX formatted comment by loading MathJax
                                    (beware that this will not work offline).
                            </ul>
                        </li>
                        <li>
                            a <strong>console</strong> that will display CAS messages,
                            syntax errors or step by step computation for commands that
                            support step by step (like derivative).
                            The console is not displayed if it is empty. You can clear
                            the console or adjust it's height.
                        </li>
                        <li>
                            a <strong>graph 3d</strong> area for 3d commands. This area
                            is not displayed if it is empty.
                        </li>
                    </ul>
                    You can <strong>save</strong> the history by hitting the <tt>&#x1f4be;</tt>
                    button. The filename of the session is displayed in a modifiable text
                    field at the right of the <tt>&#x1f4be;</tt> button, it is <tt>session</tt>
                    by default. You can open a saved session by hitting the <tt>Load</tt>
                    button.
                    You can <strong>export</strong> your worksheet on desktops, this
                    will save the whole HTML code (instead of the commandlines for a
                    session).
                    2d graphs can be saved as SVG 1.2 files (save button at the right of
                    the level).
                    <br>
                    If you have a native Xcas session, you can open it in Xcas for Firefox
                    (native Xcas menu menu File, Clone or from commandline
                    <tt>xcas --online nom_fichier.xws</tt>).
                    <br>
                    Note that Chrome (or the builtin browser of your device) is
                    much slower than Firefox (about 5 times). Moreover Chrome
                    does not have builtin support to display 2d maths with
                    MathML, an additional javascript library (Mathjax) must
                    be retrieved from Internet which is slower and does not
                    work in airplane mode.
                    <br>
                    <strong>It is therefore recommended to run Xcas for Firefox from Firefox</strong>
                    <br>
                    <button class="bouton"
                            onclick="$id('tutointerface').style.display='none';">Hide
                    interface help</button>
                </div>
            </li>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutokbd'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Keyboard</strong></button>
                <div id="tutokbd" style="display:none">
                    Keyboard shortcuts with Alt (or Ctrl if Alt-key is already
                    interpreted by the browser or the OS)
                    <ul>
                        <li> D, cursor right: move focus to the right (or down)
                        <li> G, cursor left: move focus to the left (or up)
                        <li> cursor down: move focus to the right/down twice
                        <li> curseur up: move focus to the left/up twice
                        <li> B: move focus to commandline
                        <li> C: copy current field to command line and move focus to commandline
                        <li> A: move focus to help field
                        <li> TAB: display help on the command at the left of the cursor
                            in the commandline.
                        <li> M: display or hide Math menu
                        <li> P: display or hide Program menu
                        <li> T: show turtle menu
                        <li> E or F: exec history
                        <li> N: clears console
                    </ul>
                </div>
            </li>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutocfg'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Configuration</strong></button>
                <div id="tutocfg" style="display:none">
                    Click on the button at the topleft to modify settings. You can
                    change
                    the default digits number, the angle unit, the step by step mode,
                    etc.
                    If you have a compatible browser, like Firefox&geq;58, you can
                    enable the <tt>wasm</tt> option (Web-Assembly), this makes most
                    computations faster and give access to PARI-GP commands after
                    running <tt>pari()</tt>.
                </div>
            </li>
            <li style="display:inline">
                <button class="bouton" onclick="var tmp=$id('manuels'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Manuals</strong>
                </button>
                <span id="manuels" style="display:none">
                    <strong>Xcas manals</strong> <button class="bouton"
                                                         onclick="$id('manuels').style.display='none';">Hide</button>
                    <br>
                    Most of the documentation is in French, not yet translated.
                    The "hard disk" version of the documentation is available on
                    Linux if you have <tt>giac</tt> installed.
                    Otherwise, please select the Internet version.
                    <ul>
                        <li> Xcas reference guide
                            <a href="file:///usr/share/giac/doc/en/cascmd_en.html"
                               target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/en/cascmd_en.html"
                               target="_blank">Internet</a>,
                        </li>
                        <li> Symbolic and numeric algorithms (FR):
                            PDF <a href="file:///usr/share/giac/doc/fr/algo.pdf"
                                   target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/algo.pdf"
                               target="_blank">Internet</a>,
                            HTML <a href="file:///usr/share/giac/doc/fr/algo.html"
                                    target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/algo.html"
                               target="_blank">Internet</a>,
                        </li>
                        <li> Programmation (FR):
                            <a href="irem/algolycee.html" target="_blank">algorithmique lyc&eacute;e</a>,
                            <a href="file:///usr/share/giac/doc/fr/casrouge/index.html"
                               target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/casrouge/index.html"
                               target="_blank">Internet</a>,
                        </li>
                        <li> Geometry (FR):
                            <a href="file:///usr/share/giac/doc/fr/casgeo/index.html"
                               target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/casgeo/index.html"
                               target="_blank">Internet</a>,
                        </li>
                        <li> Simulation (FR):
                            <a href="file:///usr/share/giac/doc/fr/cassim/index.html"
                               target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/cassim/index.html"
                               target="_blank">Internet</a>,
                        </li>
                        <li> Logo turtle (FR):
                            <a href="file:///usr/share/giac/doc/fr/castor/index.html"
                               target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/castor/index.html"
                               target="_blank">Internet</a>,
                        </li>
                        <li> Exercises (FR):
                            <a href="file:///usr/share/giac/doc/fr/casexo/index.html"
                               target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/casexo/index.html"
                               target="_blank">Internet</a>,
                        </li>
                        <li> Amusement (FR):
                            <a href="file:///usr/share/giac/doc/fr/cascas/index.html"
                               target="_blank">hard disk</a>,
                            <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/cascas/index.html"
                               target="_blank">Internet</a>,
                        </li>
                    </ul>
                </span>
            </li>
            <li style="display:inline">
                <button class="bouton" onclick="var tmp=$id('apropos'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>About</strong>
                </button>
                <span id="apropos" style="display:none">
                xcasen.html is a javascript interface, optimized for Firefox, of the
                <a
                    href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/emgiac.tgz">Giac</a>
                computer algebra system compiled with emscripten. The text editors
                are using the <a href="http://codemirror.net">CodeMirror</a>
                javascript library.
                Unlike many CAS web-interfaces, once the page is loaded,
                it does not require a server,
                it runs entirely locally with the javascript engine of your browser.
                It is slower than native code, about 2 times slower for numeric code,
                up to 8 times slower for symbolic code.
                If you run large computations, consider installing
                <a href="http://www-fourier.univ-grenoble-alpes.fr/~parisse/install_en.html">Xcas native</a>!
                <br>
                Giac/Xcas (c) 2018 B. Parisse, R. De Graeve, Institut Fourier, Université
                de Grenoble, GPL3 license. For commercial license,
	    contact us.
	    <br>
	        Optimization, signalprocessing, graph theory code: Luka Marohnić.
	    <br>
                Mathml and SVG code initially written by J.P. Branchard.
                </span>
            </li>
            <br>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutosimplifier'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Simplify</strong></button>
                <span id="tutosimplifier" style="display:none">
                    There is no universal method to simplify an expression,
                    sometimes it's better to expand, sometimes to factor, sometimes
                    linearize, etc.. It is therefore important to know
                    some <strong>rewriting</strong>
                    commands, the most important are available by hitting Math then rewrite.
                    <ul>
                        <li>
                            For example, hit <tt>math</tt>, <tt>rewrite</tt>, <tt>simpl</tt>
                            this will insert the command
                            <button onclick="UI.insert(UI.focused,'simplify(')">simplify(</button>,
                            type the expression you want to expand and simplify, then Enter.<br>
                            <button onclick="UI.insert(UI.focused,'normal(')">normal</button>,
                            <button onclick="UI.insert(UI.focused,'reorder(')">reorder</button>,
                            <button onclick="UI.insert(UI.focused,'ratnormal(')">ratnormal</button>
                            are somewhat similar, less powerfull and faster: normal
                            does not search relations between trigonometric functions,
                            ratnormal does only rational simplifications.
                            <tt>reorder</tt> reorders a polynomial according to a list of variables.
                        </li>
                        <li>
                            <button onclick="UI.insert(UI.focused,'factor(')">factor</button>
                            factorizes over R
                            <button onclick="UI.insert(UI.focused,'cfactor(')">cfactor</button>
                            over C
                        </li>
                        <li>
                            <button onclick="UI.insert(UI.focused,'partfrac(')">partfrac</button>
                            partial fraction decomposition over R,
                            <button onclick="UI.insert(UI.focused,'cpartfrac(')">cpartfrac</button>
                            over C.
                        </li>
                        <li>
                            <button onclick="UI.insert(UI.focused,'texpand(')">texpand</button>
                            expand trigonometrics, exponentials and logarithms,
                            <button onclick="UI.insert(UI.focused,'lin(')">lin</button>
                            linearizes exponentials,
                            <button onclick="UI.insert(UI.focused,'tlin(')">tlin</button>
                            linearizes trigonometrics,
                        </li>
                        <li> <button onclick="UI.insert(UI.focused,'subst(')">subst</button>
                            substitution of one or more variables by one or more values
                        </li>
                        <li> Trigonometric conversions <button onclick="UI.insert(UI.focused,'trigcos(')">trigcos</button>,
                            <button onclick="UI.insert(UI.focused,'trigsin(')">trigsin</button>,
                            <button onclick="UI.insert(UI.focused,'trigtan(')">trigtan</button>,
                            <button onclick="UI.insert(UI.focused,'halftan(')">halftan</button>,
                            <button onclick="UI.insert(UI.focused,'tan2sincos(')">tan2sincos</button>
                        </li>
                        <li> Others: <button onclick="UI.insert(UI.focused,'trig2exp(')">trig2exp</button>,
                            <button onclick="UI.insert(UI.focused,'exp2trig(')">exp2trig</button>
                            <button onclick="UI.insert(UI.focused,'pow2exp(')">pow2exp</button>,
                            <button onclick="UI.insert(UI.focused,'exp2pow(')">exp2pow</button>
                            <button onclick="UI.insert(UI.focused,'lncollect(')">lncollect</button>
                            <button onclick="UI.insert(UI.focused,'lnexpand(')">lnexpand</button>
                        </li>
                    </ul>
                </span>
            </li>
            <li style="display:inline">
                <button class="bouton"
                        onclick="var tmp=$id('tutolinalg'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
                <strong>Linear algebra </strong>
                </button>
                <span id="tutolinalg" style="display:none">
                    <ul>
                        <li>
                            To create a vector, type the coordinates with comma as separator and
                            [] as delimiters.
                            <button onclick="UI.insert(UI.focused,'dot(')">dot</button>
                            scalar product,
                            <button onclick="UI.insert(UI.focused,'cross(')">cross</button>
                            cross product in dimension 2 or 3
                        </li>
                        <li>
                            Matrices are vectors of vectors of the same size and can be typed in
                            the commandline like <tt>A:=[[1,2],[3,4]]</tt>. Alternatively, you can
                            hit <tt>Math</tt> then <tt>matrix</tt> to open the matrix assistant
                            or <tt>rand</tt> for a matrix with random coefficients.
                        </li>
                        <li>
                            Line and column indices begin at 0 when indexed by <tt>[]</tt> and 1 when
                            indexed by <tt>[[]]</tt>, for
                            example
                            <button onclick="UI.insert(UI.focused,'A[0,1]')">A[0,1]</button>
                            or <button onclick="UI.insert(UI.focused,'A[[1,2]]')">A[[1,2]]</button>.
                        <li>
                            You can use <tt>+,-,*</tt> and <button onclick="UI.insert(UI.focused,'matpow(')">matpow</button>
                            for usual arithmetic operations on matrices.
                        </li>
                        <li>
                            <button onclick="UI.insert(UI.focused,'tran(')">tran</button>
                            transposed, <button onclick="UI.insert(UI.focused,'tran(')">trn</button>: transconjugate,
                            <button onclick="UI.insert(UI.focused,'idn(')">idn</button> identity;
                        </li>
                        <li>
                            <button onclick="UI.insert(UI.focused,'linsolve(')">linsolve</button>
                            linear system,
                            <button onclick="UI.insert(UI.focused,'rref(')">rref</button> :
                            row reduction to echelon form,
                            <button onclick="UI.insert(UI.focused,'p,l,u:=lu(')">det</button>
                            : determinant,
                            <button onclick="UI.insert(UI.focused,'inv(')">inv</button>
                            : inverse,
                            <button onclick="UI.insert(UI.focused,'p,l,u:=lu(')">lu</button>
                            : LU decomposition, can be used in
                            <button onclick="UI.insert(UI.focused,'linsolve(p,l,u,')">linsolve</button>,
                        </li>
                        <li>
                            <button onclick="UI.insert(UI.focused,'charpoly(')">charpoly(</button>
                            characteristic polynomial
                            <button onclick="UI.insert(UI.focused,'pmin(')">pmin(</button>
                            minimal polynomial,
                            <button onclick="UI.insert(UI.focused,'p,d:=jordan(')">p,d:=jordan(</button>
                            eigenvectors and eigenvalues,
                        </li>
                        <li>
                            Matrix factorizations
                            <button onclick="UI.insert(UI.focused,'lu(')">lu</button>,
                            <button onclick="UI.insert(UI.focused,'cholesky(')">cholesky</button>,
                            <button onclick="UI.insert(UI.focused,'qr(')">qr</button>,
                            <button onclick="UI.insert(UI.focused,'svd(')">svd</button>
                        </li>
                        <li> Norms
                            <button onclick="UI.insert(UI.focused,'l1norm(')">l1norm</button>,
                            <button onclick="UI.insert(UI.focused,'l2norm(')">l2norm</button>,
                            <button onclick="UI.insert(UI.focused,'maxnorm(')">maxnorm</button> :
                            <button onclick="UI.insert(UI.focused,'matrix_norm(')">matrix_norm</button>
                            (w.r.t L1, L2 or Linf vector space norm)
                        </li>
                    </ul>
            <li style="display:inline">
            <button class="bouton"
                    onclick="var tmp=$id('tutoarit'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
            <strong>Arithmetic</strong>
            </button>
            <span id="tutoarit" style="display:none">
            Hit <tt>math</tt> then <tt>arit</tt>.
            Some commands work on integers and polynomials, for example
            <tt>gcd</tt> or <tt>lcm</tt>.
            Otherwise, there are two versions,
            the one working on integers begins with
            <tt>i</tt>, like <tt>irem</tt> (euclidean
            remainder for integers) vs <tt>rem</tt> (euclidean remainder for polynomials).
            <ul>
            <li>
            <button onclick="UI.insert(UI.focused,'gcd(')">gcd</button>,
            <button onclick="UI.insert(UI.focused,'lcm(')">lcm</button> GCD and LCM
            </li>
            <li>
            <button onclick="UI.insert(UI.focused,'irem(')">irem</button>,
            <button onclick="UI.insert(UI.focused,'iquo(')">iquo</button>,
            <button onclick="UI.insert(UI.focused,'iquorem(')">iquorem</button>:
            remainder and quotient (euclidean integer division)
            </li>
            <li>
            <button onclick="UI.insert(UI.focused,'iegcd(')">iegcd</button>
            extended GCD for integers
            <button onclick="UI.insert(UI.focused,'iabcuv(')">iabcuv</button>
            integer solutions of au+bv=c,
            <button onclick="UI.insert(UI.focused,'isprime(')">isprime</button>
            pseudo-primality test,
            <button onclick="UI.insert(UI.focused,'nextprime(')">nextprime</button>,
            <button onclick="UI.insert(UI.focused,'ifactor(')">ifactor</button>
            integer factorization,
            <button onclick="UI.insert(UI.focused,'euler(')">Euler</button> indicatrix,
            <button onclick="UI.insert(UI.focused,'powmod(')">powmod</button>
            fast modular powering.
            </li>
            <li>
            <button onclick="UI.insert(UI.focused,'rem(')">rem</button>,
            <button onclick="UI.insert(UI.focused,'quo(')">quo</button>,
            <button onclick="UI.insert(UI.focused,'quorem(')">quorem</button>:
            remainder and quotient for polynomial euclidean division.
            The default variable is <tt>x</tt>, it can be specified as 3rd argument.
            <li>
            <button onclick="UI.insert(UI.focused,'egcd(')">egcd</button>
            extended gcd for polynomials
            <button onclick="UI.insert(UI.focused,'abcuv(')">abcuv</button>
            polynomial solutions for au+bv=c
            <button onclick="UI.insert(UI.focused,'horner(')">horner</button>
            Horner evaluation,
            <button onclick="UI.insert(UI.focused,'interp(')">interp</button>
            polynomial interpolation
            </li>
            <li>
            Use infix <tt>mod</tt> to work in ℤ/nℤ, for
            example <tt>x^3+5x-11 mod 17</tt>
            is a polynomial with coefficients in ℤ/17ℤ.
            If you must work in a non prime finite field, run
            <button onclick="UI.insert(UI.focused,'GF(')">GF</button>
            </li>
            </ul>
            </span>
            </li>
            <li style="display:inline">
            <button class="bouton"
                    onclick="var tmp=$id('tutosolve'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
            <strong>Solve</strong>
            </button>
            <span id="tutosolve" style="display:none">
            <ul>
            <li> Equation and system solving:
            Hit <tt>math</tt>
            then <tt>solve</tt>, select exact or approx. and real or
            complex,
            or enter the commands
            <button onclick="UI.insert(UI.focused,'solve(')">solve</button>
            <button onclick="UI.insert(UI.focused,'csolve(')">csolve</button>
            <button onclick="UI.insert(UI.focused,'fsolve(')">fsolve</button>
            <button onclick="UI.insert(UI.focused,'cfsolve(')">cfsolve</button>)
            </li>
            <li> Differential equation/system solving:
            Hit <tt>math</tt>
            then <tt>calc</tt>
            <button onclick="UI.insert(UI.focused,'desolve(')">desolve</button>
            exact solver,
            <button onclick="UI.insert(UI.focused,'odesolve(')">odesolve</button>
            approx. solver, or <tt>math</tt>, <tt>graph</tt>
            <button onclick="UI.insert(UI.focused,'odeplot(')">ode</button>
            approx. graph.
            </li>
            <li>
            Recurrent sequences:
            hit <tt>math</tt> then <tt>u_n</tt>.
            The
            <button onclick="UI.insert(UI.focused,'rsolve(')">rsolve</button>
            command tries to find an explicit expression for a recurrent sequence.
            </li>
            </ul>
            </span>
            </li>
            <li style="display:inline">
            <button class="bouton"
                    onclick="var tmp=$id('tutoanalyse'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
            <strong>Calculus</strong>
            </button>
            <span id="tutoanalyse" style="display:none">
            Hit <tt>math</tt> then <tt>f(x)</tt>
            to study a function, or <tt>u_n</tt> for a sequence,
            or <tt>calc</tt> for calculus commands and assistants for
            discrete sums (<tt>∑</tt>), limits (<tt>limit</tt>),
            derivatives (<tt>∂</tt>),
            antiderivatives and definite integrals (<tt>∫</tt>),
            series expansions
            (<tt>series</tt>).
            <br>
            For example, let's define an univariate function
            <tt>f</tt>, hit <tt>prog</tt> then
            <tt>func</tt>, set
            <tt>f</tt> as function
            <tt>x</tt> as list of arguments and <tt>sin(x^2)</tt> as
            returned value. Or type in the commandline
            <button onclick="UI.insert(UI.focused,'f(x):=sin(x^2):;')"><tt>f(x):=sin(x^2)</tt></button>
            Once <tt>f</tt> is defined, we can compute the value of the function
            and derivative like this:
            <button onclick="UI.insert(UI.focused,'f(sqrt(pi)); f\'(2);f\'(y);')">
            <tt>f(sqrt(pi)); f'(2); f'(y) </tt></button>.
            <br>
            <tt>'</tt> denotes the derivative with respect to <tt>x</tt>,
            for other variables, use
            <button onclick="UI.insert(UI.focused,'diff(')">diff</button>.
            The antiderivative command is
            <button onclick="UI.insert(UI.focused,'integrate(')">integrate</button>, for
            example <button onclick="UI.insert(UI.focused,'integrate(1/(x^4-1))')">integrate(1/(x^4-1));</button>,
            or for a definite integral
            <button onclick="UI.insert(UI.focused,'integrate(1/(x^4+1),x,0,+infinity)')">
            integrate(1/(x^4+1)^4,x,0,+infinity);</button>.
            <br>
            The <button onclick="UI.insert(UI.focused,'limit(')">limit</button> et
            <button onclick="UI.insert(UI.focused,'series(')">series</button>
            commands compute a limit or Taylor series (or asymptotic series expansion)
            for example
            <button 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=$id('tutoproba'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
            <strong>Probability </strong></button>
            <span id="tutoproba" style="display:none">
            Hit <tt>math</tt> <tt>rand</tt> opens an assistant that build
            random numbers.
            <br>
            Continuous distributions commands
            <button onclick="UI.insert(UI.focused,'uniformd(')">uniformd</button>,
            <button onclick="UI.insert(UI.focused,'normald(')">normald</button>,
            <button onclick="UI.insert(UI.focused,'studentd(')">studentd</button>,
            <button onclick="UI.insert(UI.focused,'chisquared(')">chisquared</button>,
            <button onclick="UI.insert(UI.focused,'gammad(')">gammad</button>,
            <button onclick="UI.insert(UI.focused,'exponentiald(')">exponentiald</button>,
            <button onclick="UI.insert(UI.focused,'cauchyd(')">cauchyd</button>,
            <button onclick="UI.insert(UI.focused,'fisherd(')">fisherd</button>,
            <button onclick="UI.insert(UI.focused,'betad(')">betad</button>.
            <br>
            Discrete distributions commands
            <button onclick="UI.insert(UI.focused,'binomial(')">binomial</button>,
            <button onclick="UI.insert(UI.focused,'negbinomial(')">negbinomial</button>,
            <button onclick="UI.insert(UI.focused,'geometric(')">geometric</button>,
            <button onclick="UI.insert(UI.focused,'poisson(')">poisson</button>.
            <br>
            Cumulated distributions commands have a
            <tt>_cdf</tt> suffix, one can also get them by passing the
            distribution law and arguments to the <button onclick="UI.insert(UI.focused,'cdf(')">cdf</button> command.
            Inverse cumulated distributions have an
            <tt>_icdf</tt> suffix, there is also an  <button onclick="UI.insert(UI.focused,'icdf(')">icdf</button> command.
            <br>
            The   <button onclick="UI.insert(UI.focused,'histogram(')">histogram</button>
            will display an histogram of a list of value
            (default class minimum 0, default class
            size 1, otherwise pass them as arguments).
            <br>
            The   <button onclick="UI.insert(UI.focused,'markov(')">markov</button>
            command splits a Markov chain transition matrix.
            </span>
            </li>
            <li style="display:inline">
            <button class="bouton"
                    onclick="var tmp=$id('tutograph'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
            <strong>Graphs </strong>
            </button>
            <span id="tutograph" style="display:none">
            Hit <tt>math</tt>  then <tt>graph</tt>
            (see also <tt>f(x)</tt> for function variations).,
            <br>
            Examples of commands
            <button 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>
            displays the 2d graph of two expressions simultaneously
            (sin(x) and x-x^3/6),
            <button 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>
            displays the 3d graph of x^2-y^2 together with a plane.
            You can move the viewpoint with the mouse.
            <br>
            Some geometry commands:
            <button onclick="UI.insert(UI.focused,'point(')">point</button>,
            <button onclick="UI.insert(UI.focused,'midpoint(')">milieu</button>,
            <button onclick="UI.insert(UI.focused,'line(')">line</button>,
            <button onclick="UI.insert(UI.focused,'bisector(')">bisector</button>,
            <button onclick="UI.insert(UI.focused,'perpen_bisector(')">perpen_bisector</button>,
            <button onclick="UI.insert(UI.focused,'segment(')">segment</button>,
            <button onclick="UI.insert(UI.focused,'triangle(')">triangle</button>,
            <button onclick="UI.insert(UI.focused,'circle(')">circle</button>,
            <button onclick="UI.insert(UI.focused,'ellipse(')">ellipse</button>,
            <button onclick="UI.insert(UI.focused,'hyperbola(')">hyperbola</button>,
            <button onclick="UI.insert(UI.focused,'parabola(')">parabola</button>, ...
            </span>
            </li>
            <li style="display:inline">
            <button class="bouton"
                    onclick="var tmp=$id('tutoprog'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
            <strong>Programmation</strong>
            </button>
            <span id="tutoprog" style="display:none">
            The <tt>Prog</tt> displays assistants
            that will help you enter programmation structures
            (test, loop, function). You can add newlines with the <tt>\n</tt>
            button, or with Shift-Enter (or Enter alone if you modify an
            existing level). <tt>→|</tt> indents the current line.
            Hit <tt>debug</tt> to run a function in step by step mode,
            this will display local variables, it's very useful to debug
            a function.
            <br>
            You can choose syntax compatibility with C/javascript or Python.
            <button onclick="var tmp=$id('progex'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
            <strong>example of program</strong>
            </button>
            <div id="progex" style="display:none">
            Example of program: sum of squares in Xcas syntax
            <br>
            <tt>function f(x)
            <br>
            &nbsp;&nbsp;local y,s;
            <br>
            &nbsp;&nbsp;if x &gt; 100000 then return "Number too large"; fi;
            <br>
            &nbsp;&nbsp;s:=0;
            <br>
            &nbsp;&nbsp;for y from 1 to x do
            <br>
            &nbsp;&nbsp;&nbsp;&nbsp;s:=s+y^2;
            <br>
            &nbsp;&nbsp;od
            <br>
            &nbsp;&nbsp;return s;
            <br>
            end:;
            </tt><br>
            Python compatible syntax<br>
            <tt>def f(x):<br>
            &nbsp;&nbsp;&nbsp;&nbsp;# local y,s<br>
            &nbsp;&nbsp;&nbsp;&nbsp;if x &gt; 100000:<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return "Number too large"<br>
            &nbsp;&nbsp;&nbsp;&nbsp;s=0<br>
            &nbsp;&nbsp;&nbsp;&nbsp;for y in range(x+1):<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s=s+y**2<br>
            &nbsp;&nbsp;&nbsp;&nbsp;return s<br>
            </tt>
            <button onclick="UI.insert(UI.focused,'function f(x)\n  local y,s;\n  if x &gt; 100 then return &quot;Number too large&quot; fi;\n  s:=0;\n  for y from 1 to x do\n    s:=s+y^2;\n  od\n  return s;\nend:; ')">Test (Xcas)</button>
            <button onclick="UI.insert(UI.focused,'def f(x):\n    # local y,s\n    if x > 100000:\n        return &quot;Number too large&quot;\n    s=0\n    for y in range(x+1):\n        s=s+y**2\n    return s\n')">Test (Python)</button>
            <br>
            <br>
            </div>
            </span>
            </li>
            <li style="display:inline">
            <button class="bouton"
                    onclick="var tmp=$id('tutotortue'); if (tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">
            <strong>Turtle</strong>
            </button>
            <span id="tutotortue" style="display:none">
            The turtle is a small robot that moves following the user commands,
            it will trace the moves with a pen with a selectable color. It may
            be used to learn programming.
            <br>
            Click on <tt>Prog</tt> then <tt>Turtle</tt> then <tt>new</tt>
            <br>
            Two levels are created, the first one is for programs/functions that
            will be used to make a figure, the second field begins with the
            command <tt>clearscreen</tt>, it will contain the move commands, including
            calls to functions defined in the first level.
            At the right of the <tt>new</tt> button, you can select move commands,
            <tt>forward</tt>
            (turtle moves forward n steps, default n=10),
            <tt>backward</tt>, <tt>tright</tt>
            (<tt>right</tt> n degrees, default n=90), etc.
            <br>
            For example, click on the line after <tt>clearscreen</tt>,
            then <tt>forward</tt> then <tt>tleft</tt>, press Enter, the turtle
            moves 10 pixels left and will turn left, heading to the top.
            <br>
            The first field is a normal level where you can write utilities
            functions,
            with the help of the prog assistants (test, loop, func).
            <br>
            Example: square, regular polygons
            <a
                href="#exec&python=0&+function%20Square(l)%0A%20%20local%20k%3B%0A%20%20for%20k%20from%201%20to%204%20do%0A%20%20%20%20forward(l)%3B%0A%20%20%20%20left()%3B%0A%20%20od%3B%0Affunction%3A%3B&+%23%0Aclearscreen%0ASquare(40)%0Ajump%2080%0ASquare(40)&+function%20Polygon(l%2Cn)%0A%20%20local%20k%2Ct%3B%0A%20%20t%3A%3D360%2Fn%3B%0A%20%20for%20k%20from%201%20to%20n%20do%0A%20%20%20%20forward(l)%3B%0A%20%20%20%20left(t)%3B%0A%20%20od%3B%0Affunction%3A%3B&+%23%0Aclearscreen%0APolygon(50%2C5)&"
                target="_blank">
            Xcas</a> or
            <a
                href="#exec&python=1&+def%20Square(l)%3A%0A%20%20%20%20%23%20local%20k%0A%20%20%20%20for%20k%20in%20range(4)%3A%0A%20%20%20%20%20%20%20%20forward(l)%0A%20%20%20%20%20%20%20%20left()&+%23%0Aclearscreen%0ASquare(40)%0Ajump%2080%0ASquare(40)&+def%20Polygon(l%2Cn)%3A%0A%20%20%20%20%23%20local%20k%2Ct%0A%20%20%20%20t%3D360%2Fn%0A%20%20%20%20for%20k%20in%20range(n)%3A%0A%20%20%20%20%20%20%20%20forward(l)%0A%20%20%20%20%20%20%20%20left(t)&+%23%0Aclearscreen%0APolygon(50%2C5)&"
                target="_blank">Python</a>,
            <a
                href="#exec&python=0&+sap(n)%3A%3D%7B%0A%20%20triangle_plein(5*n%2C5*n)%3B%0A%20%20left()%20%3B%0A%20%20triangle_plein(5*n%2C5*n)%3B%0A%20%20jump%204*n%3B%0A%20%20triangle_plein(4*n%2C4*n)%3B%0A%20%20right()%20%3B%0A%20%20triangle_plein(4*n%2C4*n)%3B%0A%20%20skip%20-4*n%3B%0A%7D%3A%3B&+sapins2(n)%3A%3D%7B%0A%20%20if%20n%3C%3D1%20then%20%0A%20%20%20%20pencolor%20yellow%3B%20disque%2010%3B%20pencolor%20green%3B%20return%3B%20%0A%20%20fi%3B%0A%20%20pencolor%20green%3B%0A%20%20sap(n)%3B%0A%20%20left(30)%3B%0A%20%20jump%2010*n%3B%0A%20%20right(30)%3B%0A%20%20sapins2(n-2)%3B%0A%20%20right(30)%3B%0A%20%20jump%2010*n%3B%0A%20%20left(30)%3B%0A%20%20sap(n)%3B%0A%7D%3A%3B&+clearscreen%3B%0Askip%2050%3B%0Ajump%20-75%3B%0Asapins2(8)%3B%0Apencolor%20blue%3B%0Asigne%20%22Merry%20Xcas%22&"
                target="_blank">
            Merry Xcas</a>,
            <a
                href="#exec&python=1&+def%20sap(n)%3A%0A%20%20%20%20triangle_plein(5*n%2C5*n)%0A%20%20%20%20left()%0A%20%20%20%20triangle_plein(5*n%2C5*n)%0A%20%20%20%20jump%204*n%0A%20%20%20%20triangle_plein(4*n%2C4*n)%0A%20%20%20%20right()%0A%20%20%20%20triangle_plein(4*n%2C4*n)%0A%20%20%20%20skip%20-4*n&+def%20sapins2(n)%3A%0A%20%20%20%20if%20n%3C%3D1%3A%0A%20%20%20%20%20%20%20%20pencolor%20yellow%0A%20%20%20%20%20%20%20%20disque%2010%20%0A%20%20%20%20%20%20%20%20pencolor%20green%20%0A%20%20%20%20%20%20%20%20return%0A%20%20%20%20pencolor%20green%0A%20%20%20%20sap(n)%0A%20%20%20%20left(30)%0A%20%20%20%20jump%2010*n%0A%20%20%20%20right(30)%0A%20%20%20%20sapins2(n-2)%0A%20%20%20%20right(30)%0A%20%20%20%20jump%2010*n%0A%20%20%20%20left(30)%0A%20%20%20%20sap(n)&+%23%0Aclearscreen%0Askip%2050%0Ajump%20-75%0Asapins2(8)%0Apencolor%20blue%0Asigne%20%22Merry%20Xcas%22&"
                target="_blank">Merry Xcas (Python version)</a>
            <br>
            The French <a
                href="https://www-fourier.univ-grenoble-alpes.fr/~parisse/giac/doc/fr/castor/index.html"
                target="_blank">turtle
            manual</a> explain all these commands and contains many examples
            of scenarios to teach programming to young childrens.
            </span>
            </li>
            <li style="display:inline">
            <button class="bouton"
                    onclick="var l=['tutocfg','tutonet','tutoinst','tutoex','tutoex2','tutointro','tutointerface','tutokbd','tutosimplifier','tutoarit','tutosolve','tutoanalyse','tutoproba','tutoprog','tutograph','tutolinalg','tutotortue','manuels','apropos']; var s=l.length; for (var i=0;i<s;++i) $id(l[i]).style.display='none';">
            <em>Fold all</em>
            </button>
        </ul>
        </span>
<div id="divhelpoutput" style="max-height: 200px; overflow:auto">
  <table id="helpoutput" title="Aide"
         style="max-width:1000px "></table>
</div>
<div>
  <button id="bouton_math" class="bouton" onclick="UI.show_menu();"
          title="Show or hide math assistants"
  >
    <img WIDTH="28" HEIGHT="28" SRC="logo.png" alt="Maths" align="center">
    Math
  </button>
  <button id="prog_key" class="bouton" title="Programmation" onclick="var tmp=$id('progbuttons'); if (tmp.style.display=='none'){ tmp.style.display='block';} else { tmp.style.display='none';}">Prog</button>
  <button class="bouton" id="button_123" onmousedown="event.preventDefault()"
          onclick="if ($id('keyboard').style.display=='inline'){ $id('keyboard').style.display='none'; $id('alpha_keyboard').style.display='none';} else UI.kbdonfuncoff(); if (UI.focusaftereval){ UI.focused.focus(); }"
          title="Show or hide scientific keyboard"
  >123
  </button>
  <button class="bouton" style="vertical-align:bottom"
          onclick="if($id('help').style.display=='none')
                $id('help').style.display='block';
                else $id('help').style.display='none';"
          title="Show or hide documentation"
  >
    <strong>Doc</strong>
  </button>
  <textarea cols="9" class="bouton" style="font-size:large;vertical-align:bottom" id="helptxt"
            title="Short help on a commandname"
            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" onmousedown="event.preventDefault()"
          title="Clear help"
          onclick="var helptxt=$id('helptxt'); helpoutput.innerHTML='';helptxt.value='';$id('helptxt').focus();">&#x232b;
  </button>
</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+'(')"
      >
      <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+'(')"
      >
      <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+'(')">
      <input type="button" style="width:29px;height:35px;" name="add_ln"
             id="add_ln"
             value="exp" 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,'^')">
      <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. // is a comment, type mod to work in Z/nZ.">
    </td>
  </tr>
  <tr>
    <td>
      <input type="button" style="width:29px;height:35px;" name="add_left_par" id="add_left_par" value="(" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value);">
      <input type="button" style="width:29px;height:35px;" name="add_right_par" id="add_right_par" value=")" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value);">
      <input type="button" style="width:29px;height:35px;" name="add_xtn"
             id="add_xtn"
             value="x,t,n" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,UI.xtn)" title="Insert x or t or n">
      <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="Complex square root of -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="square root">
      <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;"
             name="add_abc" id="add_abc" value="abc"
             onmousedown="event.preventDefault()" onClick="var tmp=$id('alpha_keyboard'); if (tmp.style.display=='none') tmp.style.display='inline'; else tmp.style.display='none'"
             title="alpha keyboard">
      <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=", is a field separator for a vector/list component. ' suspends evaluation"
      >
      <input type="button" id="add_infer" value="&lt;"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value);">
      <input type="button" style="display:none" name="curseur_up"
             id="curseur_up"
             value="↑" onmousedown="event.preventDefault()"
             onClick="UI.moveCaretUpDown(UI.focused,-1)" title="move cursor up">
      <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="Copy last commandline to focus"
      >
      <input type="button" style="width:29px;height:35px;" name="add_dosel"
             id="add_dosel"
             value="sel" onmousedown="event.preventDefault()" onClick="UI.selectionne()" title="Select">
      <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="Alternatives keys"
             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=":= stores a value to a variable, for example a:=pi/2; sin(a). ! computes a factorial"
      >
      <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="; ends a commands, for example inside a program"
      >
      <input type="button" id="add_super" value="&gt;"
             title=""
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value);">
      <input type="button" style="display:none" name="curseur_down"
             id="curseur_down" value="↓" onmousedown="event.preventDefault()"
             onClick="UI.moveCaretUpDown(UI.focused,1)"
             title="move cursor down"
      >
      <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="End 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 is either the basis of exponential or separator between mantissa and exponent of a floating point number"
      >
      <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_rewritetrig" id="add_rewritetrig" value="rewrite"
             onmousedown="event.preventDefault()"
             onClick="$id('assistant_rewrite').style.display='block';UI.funcoff();"
             title="Commands to rewrite expressions"
      >
      <input type="button" style="width:29px;height:35px" name="add_calculus"
             id="add_calculus"
             value="calc" onClick="$id('assistant_calculus').style.display='block';UI.funcoff();"
             title="Calculus commands (diff, integrate, ...)"
      >
      <input type="button" style="width:60px;height:35px" name="add_solve"
             id="add_solve"
             value="solve" onmousedown="event.preventDefault()" onClick="UI.funcoff();UI.savefocused=UI.focused; $id('assistant_solve').style.display='block';UI.set_focus('solveeq') ;"
             title="Solve assistant"
      >
      <input type="button" style="width:60px;height:35px"
             name="add_graph" id="add_graph" value="graph"
             onmousedown="event.preventDefault()"
             onClick="$id('assistant_graph').style.display='block';UI.funcoff();"
             title="Graph commands (function, parametric, etc.)"
      >
      <input type="button" style="width:29px;height:35px" name="add_geo"
             id="add_geo"
             value="geometry" onClick="$id('assistant_geo').style.display='block';UI.funcoff();"
             title="Geometry commands">
      <input type="button" style="width:60px;height:35px"
             name="add_arit" id="add_arit" value="arit"
             onmousedown="event.preventDefault()"
             onClick="$id('assistant_arit').style.display='block';UI.funcoff();"
             title="Arithmetic commands">
      <input type="button" style="width:60px;height:35px"
             name="add_linalg" id="add_linalg" value="linalg"
             onmousedown="event.preventDefault()"
             onClick="$id('assistant_linalg').style.display='block';UI.funcoff();"
             title="Linear algebra commands">
      <input type="button" style="width:29px;height:35px" name="add_mathcomment"
             id="add_mathcomment"
             value="text" onmousedown="event.preventDefault()"
             onClick="UI.eval_cmdline1('///Type a comment, use $...$ (math button) to render math formula (in Xcas syntax)',true)" title="Create a new comment entry.">
    </td>
  </tr>
  <tr>
    <td>
      <input type="button" style="width:60px;height:35px" name="add_tabvar"
             id="add_tabvar"
             value="f(x)" onmousedown="event.preventDefault()" onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_tabvar').style.display='block';"
             title="Function study assistant"
      >
      <input type="button" style="width:60px;height:35px"
             name="add_rsolve" id="add_rsolve" value="u_n"
             onmousedown="event.preventDefault()"
             onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_suites').style.display='block';UI.xtn='n';"
             title="Recurrent sequence assistant"
      >
      <input type="button" style="width:50px;height:35px"
             name="add_seq" id="add_seq" value="list"
             onmousedown="event.preventDefault()"
             onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_seq').style.display='block';UI.set_focus('seqexpr')"
             title="Create a sequence of values from an explicit expression"
      >
      <input type="button" style="width:60px;height:35px"
             name="add_tableur" id="add_tableur" value="tabl."
             onmousedown="event.preventDefault()"
             onClick="UI.open_sheet(true);"
             title="Spreadsheet">
      <input type="button" style="width:60px;height:35px"
             name="add_matr" id="add_matr" value="matrx"
             onmousedown="event.preventDefault()"
             onClick="UI.open_sheet(false);"
             title="Matrix assistant">
      <input type="button" style="width:60px;height:35px"
             name="add_stats" id="add_stats" value="stats"
             title="Probability and statistics"
             onmousedown="event.preventDefault()"
             onClick="UI.funcoff();UI.savefocused=UI.focused;var mat=$id('assistant_matr');mat.style.display='block';mat.matr_formule.checked=false;mat.matr_formuleshadow.checked=true;$id('matr_type_chooser').style.display='none';$id('matr_stat12').style.display='none';$id('matr_stats').style.display='block';UI.assistant_matr_setdisplay();$id('matr').style.display='none';$id('matr_matr').style.display='none';$id('matr_testhyp').style.display='none';$id('risque_alpha').style.display='none';"
      >
      <input type="button" style="width:60px;height:35px"
             name="add_rand" id="add_rand" value="rand"
             onmousedown="event.preventDefault()"
             onClick="UI.savefocused=UI.focused;$id('assistant_rand').style.display='block';UI.assistant_rand_setdisplay();UI.funcoff();"
             title="assistant to create a random number, list or matrix"
      >
      <input type="button" value="slider" id="add_curseur"
             style="height:35px"
             onclick="UI.addcurseur(String.fromCharCode(UI.paramname),0,-5,5,0.125); UI.paramname++;"
             title="Create a slider"
      >
    </td>
  </tr>
</table>
<div id="progbuttons" style="display:none">
  <input type="button" style="width:29px;height:35px" name="add_test"
         id="add_test"
         value="test" onmousedown="event.preventDefault()" onClick="UI.savefocused=UI.focused;  $id('assistant_boucle').style.display='none'; $id('assistant_prog').style.display='none'; $id('assistant_test').style.display='block' ;UI.set_focus('sicond'); //UI.insert(UI.focused,'\nsi  alors  sinon  fsi; ');UI.moveCaret(UI.focused,-20);UI.funcoff();"
         title="if/then/else test assistant"
  >
  <input type="button" style="width:40px;height:35px"
         id="add_boucle" value="loop" onclick="UI.savefocused=UI.focused; $id('assistant_boucle').style.display='block';$id('assistant_test').style.display='none';$id('assistant_prog').style.display='none'"
         title="for/while loop assistant"
  >
  <input type="button" value="func" title="Function creation assistant" style="width:55px;height:35px" id="add_function" onclick="UI.savefocused=UI.focused;  $id('assistant_boucle').style.display='none';  $id('assistant_test').style.display='none'; $id('assistant_prog').style.display='block';UI.set_focus('funcname');$id('localvarspan').style.display=UI.python_mode?'none':'inline';">
  <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="Debugger, for example debug(f(2,3)) will execute step by step the f function with arguments 2 and 3"
  >
  <input type="button" style="width:29px;height:35px" name="add_//"
         id="add_//"
         value="//" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,UI.python_mode?'#':'//');UI.funcoff();" title="comment">
  <input type="button" style="width:29px;height:35px" name="add_nlprog"
         id="add_nlprog"
         value="cmds" onmousedown="event.preventDefault()"
         onClick="UI.hide_show($id('list_cmds')); UI.hide_show_xcas('list_cmds_xcas'); UI.hide_show_python('python_mods');"
         title="List commands">
  <input type="button" style="width:29px;height:35px" name="add_listechaine"
         id="add_listechaine"
         value='graph' onmousedown="event.preventDefault()"
         onClick="UI.hide_show($id('prog_graph_cmds'));"
         title="Strings and sets commands">
  <input type="button" style="width:29px;height:35px"
         id="add_tortue"
         value="Turtle" onmousedown="event.preventDefault()"
         onClick="UI.hide_show_xcas('boutons_tortue_xcas'); var f=$id('boutons_tortue'); if (f.style.display=='none'){ f.style.display='block'; } else { f.style.display='none'; }" title="turtle commands">
  <div id="list_cmds" style="display:none">
    <button class="bouton" onclick="UI.insert(UI.focused,'range(');">range</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'len(');">len</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'append(');">append</button>
    <button class="bouton" onclick="UI.insert(UI.focused,'sorted(');">sort</button>
    <div id="list_cmds_xcas">
    <button class="bouton" onclick="UI.insert(UI.focused,'seq(');">seq</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,'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>
    <strong>set[]</strong>
    <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>
    <br>
    <strong> ""</strong>
    <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>
    </div>
    <div id="python_mods" style="display:none">
      <br>
    <button class="bouton" onclick="UI.insert_focused('from math import *');"><strong>math</strong></button><button class="bouton" onclick="UI.insert_focused('sqrt(');">racine</button><button class="bouton" onclick="UI.insert_focused('abs(');">abs</button><button class="bouton" onclick="UI.insert_focused('max(');">max</button><button class="bouton" onclick="UI.insert_focused('min(');">min</button><button class="bouton" onclick="UI.insert_focused('round(');">arrondi</button><button class="bouton" onclick="UI.insert_focused('floor(');">floor</button>
    <br>
<button class="bouton" onclick="UI.insert_focused('from cmath import *');"><strong>cmath</strong></button>
    <button class="bouton" onclick="UI.insert_focused('from random import *');"><strong>random</strong></button><button class="bouton" onclick="UI.insert_focused('random(');">random</button><button class="bouton" onclick="UI.insert_focused('randint(');">randint</button><button class="bouton" onclick="UI.insert_focused('choice(');">choice</button>
    <br>
    
    <button class="bouton" onclick="UI.insert_focused('from arit import *');"><strong>arit</strong></button><button class="bouton" onclick="UI.insert_focused('isprime(');">isprime</button><button class="bouton" onclick="UI.insert_focused('nextprime(');">nextp</button><button class="bouton" onclick="UI.insert_focused('ifactor(');">ifactor</button><button class="bouton" onclick="UI.insert_focused('gcd(');">gcd</button><button class="bouton" onclick="UI.insert_focused('lcm(');">lcm</button><button class="bouton" onclick="UI.insert_focused('iegcd(');">iegcd</button>
    <br>

    <button class="bouton" onclick="UI.insert_focused('from linalg import *');"><strong>linalg</strong></button><button class="bouton" onclick="UI.insert_focused('add(');">add</button><button class="bouton" onclick="UI.insert_focused('sub(');">sub</button><button class="bouton" onclick="UI.insert_focused('mul(');">mul</button><button class="bouton" onclick="UI.insert_focused('inv(');">inv</button><button class="bouton" onclick="UI.insert_focused('transpose(');">tran</button><button class="bouton" onclick="UI.insert_focused('rref(');">rref</button>
    <br>

    <button class="bouton" onclick="UI.insert_focused('from numpy import *');"><strong>numpy</strong></button><button class="bouton" onclick="UI.insert_focused('array(');">array</button><button class="bouton" onclick="UI.insert_focused('linspace(');">linspace</button><button class="bouton" onclick="UI.insert_focused('arange(');">arange</button><button class="bouton" onclick="UI.insert_focused('solve(');">solve</button><button class="bouton" onclick="UI.insert_focused('eig(');">eig</button><button class="bouton" onclick="UI.insert_focused('inv(');">inv</button>
    <br>
  </div>
  </div>
  <div id="prog_graph_cmds" style="display:none">
    <button class="bouton" title="Type ; on an empty commandline to display graph." onclick="UI.insert_focused('from graphic import *');"><strong>graphic</strong></button><button class="bouton" onclick="UI.insert_focused('set_pixel(');">pixel</button><button class="bouton" onclick="UI.insert_focused('draw_line(');">line</button><button class="bouton" onclick="UI.insert_focused('draw_rectangle(');">rect</button><button class="bouton" onclick="UI.insert_focused('draw_circle(');">circle</button><button class="bouton" onclick="UI.insert_focused('draw_string(');">string</button><button class="bouton" onclick="UI.insert_focused(';');">show</button>
    <br>
    <button class="bouton" onclick="UI.insert_focused('red');">red</button><button class="bouton" onclick="UI.insert_focused('green');">green</button><button class="bouton" onclick="UI.insert_focused('blue');">blue</button><button class="bouton" onclick="UI.insert_focused('yellow');">yellow</button><button class="bouton" onclick="UI.insert_focused('cyan');">cyan</button><button class="bouton" onclick="UI.insert_focused('magenta');">magenta</button>
    <br>
    
    <button class="bouton" title="Inside MicroPython, type , on an empty commandline to display graph." onclick="UI.insert_focused('from matplotl import *');"><strong>matplotl</strong></button><button class="bouton" onclick="UI.insert_focused(UI.micropy?'bar(':'barplot(');">bar</button><button class="bouton" onclick="UI.insert_focused(UI.micropy?'scatter(':'scatterplot(');">scat.</button><button class="bouton" onclick="UI.insert_focused('arrow(');">arrow</button><button class="bouton" onclick="UI.insert_focused(UI.micropy?'plot(':'polygonplot(');">plot</button><button class="bouton" onclick="UI.insert_focused(UI.micropy?'text(':'legend(');">txt</button><button class="bouton" onclick="UI.insert_focused(',');">,</button><button class="bouton" onclick="UI.insert_focused('clf()');">clf</button>
    
  </div>
  <div id="boutons_tortue" style="display:none">
    <input type="button" style="width:46px;height:35px" name="add_efface"
           id="add_efface"
           value="clear" onmousedown="event.preventDefault()"
           onClick="if (UI.python_mode){ UI.eval_cmdline1('# script functions\nfrom turtle import *\nreset()\n',true);UI.eval_cmdline1(UI.micropy?'.':'clearscreen # Move script\n',true);} else {UI.eval_cmdline1('/* utility functions for the script */\n',true); UI.eval_cmdline1('/* Move script*/\nclearscreen;\n',true);}" title="Create a turtle picture. Type . in an empty commandline to display turtle.">
    <input type="button" style="width:46px;height:35px" name="add_avance"
           id="add_avance"
           value="forward" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'forward(');" title="n steps forward (defaut 10)">
    <input type="button" style="width:46px;height:35px" name="add_recule"
           id="add_recule"
           value="backward" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'backward(');" title="n steps backward (defaut 10)">
    <input type="button" style="width:46px;height:35px" name="add_tourne_droite"
           id="add_tourne_droite"
           value="tright" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'right(');" title="turn right n degrees (default 90)">
    <input type="button" style="width:46px;height:35px" name="add_tourne_gauche"
           id="add_tourne_gauche"
           value="tleft" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'left(');" title="turn left n degrees (default 90)">
    <input type="button" style="width:46px;height:35px" name="add_crayon"
           id="add_crayon"
           value="pen" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'pencolor(');" title="change color for the turtle pen">
    <input type="button" style="width:46px;height:35px" name="add_rond"
           id="add_rond"
           value="arc" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,UI.micropy?'circle(':'rond ');" title="Arc of circle">
    <input type="button" style="width:46px;height:35px" name="add_ecris"
           id="add_ecris"
           value="write" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,UI.micropy?'write(':'ecris ');" title="Write a string">
    <span id="boutons_tortue_xcas">
    <input type="button" style="width:46px;height:35px" name="add_pas_de_cote"
           id="add_pas_de_cote"
           value="skip" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'skip ');" title="turtle jumps n step to the right (default 10)">
    <input type="button" style="width:46px;height:35px" name="add_saute"
           id="add_saute"
           value="jump" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'jump ');" title="turtle jumps n steps (default 10)">
    <br>
    <input type="button" style="width:46px;height:35px" name="add_disque"
           id="add_disque"
           value="farc" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'disque ');" title="Filled arc of circle">
    <input type="button" style="width:46px;height:35px" name="add_rectangle_plein"
           id="add_rectangle_plein"
           value="rectangle" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'rectangle_plein ');" title="Filled rectangle">
    <input type="button" style="width:46px;height:35px" name="add_triangle_plein"
           id="add_triangle_plein"
           value="triangle" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'triangle_plein ');" title="Filled triangle">
    <input type="button" style="width:46px;height:35px" name="add_repete"
           id="add_repete"
           value="repeat" onmousedown="event.preventDefault()"
           onClick="UI.insertsemi(UI.focused,'repete ');"
           title="Repeat one or more instructions">
    <input type="button" style="width:46px;height:35px" name="tortue_maillage"
           id="tortue_maillage"
           value="mesh" onmousedown="event.preventDefault()"
           onClick="UI.turtle_maillage=(UI.turtle_maillage+1)%3" title="Change mesh type (quad, triang, none)">
</span>
    <input type="button" style="width:46px;height:35px" name="tortue_clear"
           id="tortue_clear"
           value="&#x274C;" onmousedown="event.preventDefault()"
           onClick="$id('boutons_tortue').style.display='none'" title="Remove turtle buttons">
  </div>
</div>
<div id="assistant_rewrite" style="display:none">
  <button class="bouton" onclick="UI.insert(UI.focused,'simplify(')"
          title="Tries to simplify an expression.">simpl.
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'normal(')"
          title="Expands, reduce to an irreducible fraction">normal
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'c')" title="Prefix for factorization over C">c</button>
  <button class="bouton" onclick="UI.insert(UI.focused,'factor(')" title="Factorization, for example factor(x^4-1). Use cfactor to factor over C">factor</button>
  <button class="bouton" onclick="UI.insert(UI.focused,'partfrac(')" title="Partial fraction decomposition. Use cpartfrac over C">partf</button>
  <button class="bouton" onclick="UI.insert(UI.focused,'subst(')" title="Substitution">subst</button>
  <button class="bouton" onclick="UI.insert(UI.focused,'reorder(')" title="Change variable order in a polynomial">reord</button>
  <br>
  <button class="bouton" onclick="UI.insert(UI.focused,'texpand(')"
          title="Expand sin/cos/tan/exp/ln">texpand
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'tlin(')"
          title="Linearize trigonometric expressions">tlin
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'tcollect(')"
          title="Collect trigonometric expressions">tcoll.
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'trigsin(')"
          title="Rewrite with sin">trigsin
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'trigcos(')"
          title="Rewrite with cos">cos
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'trigtan(')"
          title="Rewrite with tan">tan
  </button>
  <button class="bouton"
          onclick="UI.insert(UI.focused,'halftan(')"
          title="Rewrite in terms of tan of the half angle">halftan
  </button>
  <br>
  <button class="bouton" onclick="UI.insert(UI.focused,'trig2exp(')"
          title="sin/cos/tan in terms of exp(i*.)">trig2exp
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'exp2trig(')" title="exp(i*.)->cos(.)+i*sin(.)">exp2trig</button>
  <button class="bouton" onclick="UI.insert(UI.focused,'lin(')" title="Linearize exponentials">lin</button>
  <button class="bouton" onclick="UI.insert(UI.focused,'lncollect(')"
          title="Collect logarithms">lncoll.
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'exp2pow(')" title="e^(a*ln(b))->b^a">exp2^</button>
  <button class="bouton" onclick="UI.insert(UI.focused,'pow2exp(')" title="b^a->e^(a*ln(b))">^2exp</button>
  <button class="bouton"
          onclick="$id('assistant_rewrite').style.display='none'">&#x274C;
  </button>
</div>
<div id="assistant_graph" style="display:none">
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_plotfunc').style.display='block';UI.xtn='x';"
          title="Graph an expression, for example plotfunc(sin(x),x===-5..5,xstep===0.1)">plot
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.funcoff();UI.savefocused=UI.focused;
                $id('assistant_plotimplicit').style.display='block';UI.set_focus('plotimplicitexprf');"
          title="Graphe an implicit curve, for example plotimplicit(x^2+x*y+y^2===3)">implicit
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_plotparam').style.display='block';UI.xtn='t';"
          title="Graph a parametric curve, for example plotparam([cos(t),sin(t)],t===0..2*pi,tstep=0.1)">param
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.funcoff();UI.savefocused=UI.focused; $id('assistant_plotpolar').style.display='block';UI.xtn='t'; UI.set_focus('plotpolarexpr');"
          title="Graph a polar curve, for example plotpolar(sin(3*t),t)">polar
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_plotfield').style.display='block';UI.set_focus('plotfieldexprf');"
          title="Slopefield of a differential equation, for example plotfield(sin(t*y),[t===-5..5,y===-3..3],xstep===0.5,ystep===0.5))">field
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'plotode(')"
          title="Graph of a solution of a differential equation">ode
  </button>
  <br>
  <button class="bouton" onclick="UI.insert(UI.focused,'plotseq(')"
          title="Web graph of a recurrent sequence"
  >suite
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'plotlist(')"
          title="Draw points (i,y_i) for a list [y_i]"
  >liste
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'moustache(')"
          title="Boxwhiskers">whisker
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'histogram(')"
          title="Histogram">histo.
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'scatterplot(')"
          title="Scatterplot">scatter
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'polygonplot(')"
          title="Polygonal line from a list of points"
  >polyg.
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'linear_regression_plot(')"
          title="Linear regression plot"
  >regr.
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'bar_plot(')"
          title="Barplot">bar
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'plotcdf(')"
          title="Cumulated frequency graph for a probability distribution"
  >cdf
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'plotcontour(')"
          title="Level curves for a 2-var function"
  >level
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'plotarea(')"
          title="Area under the curve"
  >area
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'bezier(')"
          title="Bezier curve">bezier
  </button>
  <button class="bouton"
          onclick="$id('assistant_graph').style.display='none'">&#x274C;
  </button>
  <div id="assistant_plotfunc" style="display:none">
    Choose
    <button class="bouton" onclick="$id('assistant_plotfunc1var').style.display='block';$id('assistant_plotfunc2var').style.display='none';UI.set_focus('plotfuncexpr');">curve</button>
    or
    <button class="bouton" onclick="$id('assistant_plotfunc1var').style.display='none';$id('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, for example x^2" rows=1></textarea><br>
      variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                         id="plotfuncvarname" title="Variable name, for example x" rows=1>x</textarea><br>
      xmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                     id="plotfuncvarmin" title="Start value" rows=1>-4</textarea><br>
      xmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                     id="plotfuncvarmax" title="End value" rows=1>4</textarea><br>
      xstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                      id="plotfuncvarstep" title="Step (between two successive evaluations of the expression)" rows=1>0.0625</textarea>
      <br>
      <button class="bouton" onclick="UI.assistant_plotfunc1var_ok();">&#x2705;</button>
      <button class="bouton"
              onclick="UI.focused=UI.savefocused;$id('assistant_plotfunc').style.display='none'">&#x274C;
      </button>
      <button class="bouton"
              onclick="$id('plotfuncexpr').value='';$id('plotfuncvarname').value='';$id('plotfuncvarmin').value='';$id('plotfuncvarmax').value='';$id('plotfuncvarstep').value='';">Clear
      </button>
      <button class="bouton" onclick="$id('plotfuncexpr').value='x^2';$id('plotfuncvarname').value='x';$id('plotfuncvarmin').value='-4';$id('plotfuncvarmax').value='4';">Example</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, for example 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="First variable, for example 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="second variable, for example 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="Step (between two successive evaluations of the expression)" rows=1>0.25</textarea>
      <br>
      <button class="bouton" onclick="UI.assistant_plotfunc2var_ok();">&#x2705;</button>
      <button class="bouton"
              onclick="UI.focused=UI.savefocused;$id('assistant_plotfunc').style.display='none'">&#x274C;
      </button>
      <button onclick="$id('plotfunc2expr').value='';$id('plotfunc2varx').value='x';$id('plotfunc2vary').value='y';$id('plotfunc2varxstep').value='';$id('plotfunc2varystep').value='';">Clear
      </button>
      <button onclick="$id('plotfunc2expr').value='x^2-y^2';$id('plotfunc2varx').value='x===-3..3';$id('plotfunc2vary').value='y===-3..3';$id('plotfunc2varxstep').value='0.25';$id('plotfunc2varystep').value='0.25';">Example</button>
    </div>
  </div>
  <div id="assistant_plotparam" style="display:none">
    Choose parametric
    <button class="bouton"
            onclick="$id('assistant_plotparam1var').style.display='block';$id('assistant_plotparam2var').style.display='none';UI.set_focus('plotparamexprx');">curve
    </button>
    or parametric
    <button class="bouton"
            onclick="$id('assistant_plotparam1var').style.display='none';$id('assistant_plotparam2var').style.display='block';UI.set_focus('plotparam2exprx');">surface
    </button>
    <button class="bouton"
            onclick="UI.focused=UI.savefocused;$id('assistant_plotparam').style.display='none'">&#x274C;
    </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 of x(t), for example 2*cos(t)" rows=1></textarea><br>
      y(t)= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                      id="plotparamexpry" title="Expression of y(t), for example 3*sin(t)" rows=1></textarea><br>
      variable<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                        id="plotparamvarname" title="variable name, for example t" rows=1>t</textarea><br>
      tmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                     id="plotparamvarmin" title="start value" rows=1>-4</textarea><br>
      tmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                     id="plotparamvarmax" title="end value" rows=1>4</textarea><br>
      tstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                      id="plotparamvarstep" title="Step (between two successive evaluations of the expression)" rows=1>0.0625</textarea>
      <br>
      <button class="bouton" onclick="UI.assistant_plotparam_ok();;">&#x2705;</button>
      <button class="bouton"
              onclick="UI.focused=UI.savefocused;$id('assistant_plotparam').style.display='none'">&#x274C;
      </button>
      <button class="bouton"
              onclick="$id('plotparamexprx').value='';$id('plotparamexpry').value='';$id('plotparamvarname').value='';$id('plotparamvarmin').value='';$id('plotparamvarmax').value='';$id('plotparamvarstep').value='';">Clear
      </button>
      <button class="bouton" onclick="$id('plotparamexprx').value='cos(2t)';$id('plotparamexprx').value='cos(2t)';$id('plotparamexpry').value='sin(3t)';$id('plotparamvarname').value='t';$id('plotparamvarmin').value='-pi';$id('plotparamvarmax').value='pi';">Example</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, for example 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, for example 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, for example v" rows=1></textarea><br>
      1&egrave;re variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                                     id="plotparam2varx" title="First variable, for example 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="second variable, for example 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="Step (between two successive evaluations of the expression)" rows=1>0.25</textarea><br>
      vstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                      id="plotparam2varystep" title="Step (between two successive evaluations of the expression)" rows=1>0.25</textarea>
      <br>
      <button class="bouton" onclick="UI.assistant_plotparam2var_ok();">&#x2705;</button>
      <button class="bouton"
              onclick="UI.focused=UI.savefocused;$id('assistant_plotparam').style.display='none'">&#x274C;
      </button>
      <button class="bouton"
              onclick="$id('plotparam2exprx').value='';$id('plotparam2expry').value='';$id('plotparam2exprz').value='';$id('plotparam2varx').value='u';$id('plotparam2vary').value='v';$id('plotparam2varxstep').value='';$id('plotparam2varystep').value='';">Clear
      </button>
      <button class="bouton" onclick="$id('plotparam2exprx').value='v*cos(u)';$id('plotparam2expry').value='v*sin(u)';$id('plotparam2exprz').value='v';$id('plotparam2varx').value='u===-pi..pi';$id('plotparam2vary').value='v===-3..3';$id('plotparam2varxstep').value='pi/32';$id('plotparam2varystep').value='0.25';">Example</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, for example 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="First variable, for example 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="Second variable, for example 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="Step (between two successive evaluations of the expression)" rows=1>0.25</textarea><br>
    ystep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                    id="plotimplicitvarystep" title="Step (between two successive evaluations of the expression)" rows=1>0.25</textarea><br>
    niveaux=<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                      id="plotimplicitlevel" title="Levels to be plotted, keep empty for none, or input a list"
                      rows=1></textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_plotimplicit_ok();">&#x2705;</button>
    <button class="bouton"
            onclick="UI.focused=UI.savefocused;$id('assistant_plotimplicit').style.display='none'">&#x274C;
    </button>
    <button class="bouton"
            onclick="$id('plotimplicitexprf').value='';$id('plotimplicitvarx').value='x';$id('plotimplicitvary').value='y';$id('plotimplicitvarxstep').value='';$id('plotimplicitvarystep').value='';$id('plotimplicitlevel').value=''">Clear
    </button>
    <button class="bouton" onclick="$id('plotimplicitexprf').value='x^3-x-y^2-1';$id('plotimplicitvarx').value='x===-3..3';$id('plotimplicitvary').value='y===-3..3';$id('plotimplicitvarxstep').value='0.02';$id('plotimplicitvarystep').value='0.02';$id('plotimplicitlevel').value=''">Example 1</button>
    <button class="bouton" onclick="$id('plotimplicitexprf').value='x^2-y^2';$id('plotimplicitvarx').value='x===-3..3';$id('plotimplicitvary').value='y===-3..3';$id('plotimplicitvarxstep').value='0.02';$id('plotimplicitvarystep').value='0.02';$id('plotimplicitlevel').value='[-3,-2,-1,0,1,2,3]'">Example 2</button>
  </div>
  <div id="assistant_plotfield" style="display:none">
    Slopefield for a differential equation dx/dt=f(x,t) or autonomous 2-d system d[x,y]/dt=f(x,y)<br>
    f=<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                id="plotfieldexprf" title="Expression, for example x^3+x-y^2-1" rows=1></textarea><br>
    Variable t (or x)<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                               id="plotfieldvarx" title="First variable, for example t===-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="second variable, for example 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="Step (between two successive evaluations of the expression)" rows=1>0.25</textarea><br>
    ystep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                    id="plotfieldvarystep" title="Step (between two successive evaluations of the expression)" rows=1>0.25</textarea><br>
    init=<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                   id="plotfieldinit" title="Optionnal list of initial conditions" rows=1></textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_plotfield_ok();">&#x2705;</button>
    <button class="bouton"
            onclick="UI.focused=UI.savefocused;$id('assistant_plotfield').style.display='none'">&#x274C;
    </button>
    <button class="bouton"
            onclick="$id('plotfieldexprf').value='';$id('plotfieldvarx').value='x';$id('plotfieldvary').value='y';$id('plotfieldvarxstep').value='';$id('plotfieldvarystep').value='';$id('plotfieldinit').value=''">Clear
    </button>
    <button class="bouton" onclick="$id('plotfieldexprf').value='sin(t*y)';$id('plotfieldvarx').value='t===-3..3';$id('plotfieldvary').value='y===-3..3';$id('plotfieldvarxstep').value='0.25';$id('plotfieldvarystep').value='0.25';$id('plotfieldinit').value='[[0,1],[0,2]]'">Example 1d</button>
    <button class="bouton" onclick="$id('plotfieldexprf').value='[[0.2,-1],[1,0.2]]*[x,y]';$id('plotfieldvarx').value='x===-3..3';$id('plotfieldvary').value='y===-3..3';$id('plotfieldvarxstep').value='0.25';$id('plotfieldvarystep').value='0.25';$id('plotfieldinit').value='seq([0,j],j,-3,3)'">Example a 2d</button>
    <button class="bouton" onclick="$id('plotfieldexprf').value='[[0.2,0.5],[0.5,0.2]]*[x,y]';$id('plotfieldvarx').value='x===-3..3';$id('plotfieldvary').value='y===-3..3';$id('plotfieldvarxstep').value='0.25';$id('plotfieldvarystep').value='0.25';$id('plotfieldinit').value='seq([0,j],j,-3,3)'">Example b 2d</button>
  </div>
  <div id="assistant_plotpolar" style="display:none">
    Polar curve <br>
    expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                         id="plotpolarexpr" title="Expression, for example sin(3*t)" rows=1></textarea><br>
    variable θ <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                         id="plotpolarvarname" title="variable name, for example t" rows=1>t</textarea><br>
    θmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                   id="plotpolarvarmin" title="start value" rows=1></textarea><br>
    θmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                   id="plotpolarvarmax" title="end value" rows=1></textarea><br>
    θstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                    id="plotpolarvarstep" title="Step (between two successive evaluations of the expression)" rows=1></textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_plotpolar_ok();">&#x2705;</button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_plotpolar').style.display='none'">&#x274C;</button>
    <button class="bouton"
            onclick="$id('plotpolarexpr').value='';$id('plotpolarvarname').value='';$id('plotpolarvarmin').value='';$id('plotpolarvarmax').value='';$id('plotpolarvarstep').value='';">Clear
    </button>
    <button class="bouton" onclick="$id('plotpolarexpr').value='sin(3*t)';$id('plotpolarvarname').value='t';$id('plotpolarvarmin').value='0';$id('plotpolarvarmax').value='pi';$id('plotpolarvarstep').value='';">Example</button>
  </div>
</div>
<div id="assistant_calculus" style="display:none">
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.funcoff();UI.savefocused=UI.focused; $id('assistant_limit').style.display='block';UI.set_focus('limitexpr') ;" title="limit of an expression as a variable tends to a limite, for example limit(sin(x)/x,x,0). For unidirectional limit add 1 or -1 as last argument">limit</button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_diff').style.display='block';UI.set_focus('diffexpr')
                ;" title="Derivative of an expression. For a function f, for example f(x):=sin(x^2), the derivative of f is f', for example g:=f' or f'(2)">∂
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.funcoff();UI.savefocused=UI.focused;
                $id('assistant_series').style.display='block';UI.set_focus('seriesexpr')
                ;" title="Taylor/series expansion, for example series(sin(x),x=0,5,polynom). Without the polynom option, no remainder term is returned. For unidirectional series expansion, add optional parameter 1 or -1 before polynom"> series
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_sum').style.display='block';UI.set_focus('sumexpr'); " title="Discrete sum, for example ∑(k,k,1,n) ou ∑(1/n^2,n,1,inf)"> ∑
  </button>
  <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.funcoff();UI.savefocused=UI.focused; $id('assistant_int').style.display='block';UI.set_focus('intexpr');"
          title="Integrals computation, for example ∫(x^2*sin(x)*exp(x),x) or ∫(1/(x^4+1),x,0,inf)">∫
  </button>
  <button class="bouton"
          onmousedown="event.preventDefault()"
          onClick="UI.funcoff();UI.savefocused=UI.focused;$id('assistant_desolve').style.display='block';UI.set_focus('desolveeq');"
          title="Differential equation solver, for example desolve(y''+y=0), desolve(y'+y=0,y(0)=1)">desolve
  </button>
  <br>
  <button class="bouton" onclick="UI.insert(UI.focused,'ilaplace(')"
          title="ilaplace: inverse Laplace transform">i
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'laplace(')"
          title="Laplace transform">laplace
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'odesolve(')"
          title="odesolve: approx differential equation solver">o
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'desolve(')"
          title="Differential equation solver">desolve
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'ifft(')"
          title="ifft: inverse Fast Fourier transform">i
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'fft(')"
          title="Fast Fourier transform">fft
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'invztrans(')"
          title="invztrans: inverse z-transform of a rational fraction">inv
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'ztrans(')"
          title="z-transform">ztrans
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'grad(')"
          title="Gradient">grad
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'hessian(')"
          title="Hessian">hess
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'curl(')"
          title="Rotationnal">curl
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'divergence(')"
          title="Divergence">div
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'vpotential(')"
          title="vpotential: vector potential">v
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'potential(')"
          title="Potentiel">poten.
  </button>
  <button class="bouton"
          onclick="$id('assistant_calculus').style.display='none'">&#x274C;
  </button>
  <div id="assistant_desolve" style="display:none">
    Differential equation
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="desolveeq" title="for example y'+t*y=t^2" rows=1
              cols=40></textarea>
    <br>
    time-variable
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="desolvevar" title="for example t" rows=1 cols=3>t</textarea>,
    unknown
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="desolvey" title="for example y" rows=1 cols=3>y</textarea>
    <br>
    Initial conditions (optional)
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="desolveinit" title="for example 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.assistant_desolve_ok();">&#x2705;
    </button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_desolve').style.display='none'">&#x274C;</button>
    <button class="bouton" onclick="$id('desolveeq').value='';$id('desolvevar').value='';$id('desolvey').value='';$id('desolveinit').value='';">Clear</button>
    <button class="bouton" onclick="$id('desolveeq').value='y\'+t*y=t';$id('desolvevar').value='t';$id('desolvey').value='y';$id('desolveinit').value='y(0)=2';">Order 1</button>
    <button class="bouton" onclick="$id('desolveeq').value='y\'\'+y=t^2';$id('desolvevar').value='t';$id('desolvey').value='y';$id('desolveinit').value='y(0)=1,y\'(0)=0';">Order 2</button>
    <button class="bouton" onclick="$id('desolveeq').value='y\'=[[1,2],[2,1]]*y+[t,t+1]';$id('desolvevar').value='t';$id('desolvey').value='y';$id('desolveinit').value='y(0)=[1,2]'">System</button>
  </div>
  <div id="assistant_series" style="display:none">
    Series expansion <br>
    expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                         id="seriesexpr" title="Expression, for example sin(x)" rows=1></textarea><br>
    variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                       id="seriesvarname" title="variable name, for example x" rows=1>x</textarea><br>
    at <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                 id="seriesvarlim" title="Limit point" rows=1></textarea><br>
    order <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                    id="seriesvarorder" title="Order" rows=1></textarea><br>
    Polynom <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                      id="seriesvarstep" title="The 'polynom' option suppress the remainder term in the Taylor expansion" rows=1>polynom</textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_series_ok();">&#x2705;</button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_series').style.display='none'">&#x274C;</button>
    <button class="bouton"
            onclick="$id('seriesexpr').value='';$id('seriesvarname').value='';$id('seriesvarlim').value='';$id('seriesvarorder').value='';">Clear
    </button>
    <button class="bouton" onclick="$id('seriesexpr').value='sin(x)/x';$id('seriesvarname').value='x';$id('seriesvarlim').value='0';$id('seriesvarorder').value='5';$id('seriesvarstep').value='polynom';">Example</button>
  </div>
  <div id="assistant_limit" style="display:none">
    Limit :<br>
    expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                         id="limitexpr" title="Expression, for example sin(x)/x" rows=1></textarea><br>
    variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                       id="limitvarname" title="variable name, for example x" rows=1>x</textarea><br>
    at <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                 id="limitvarlim" title="Limit at value" rows=1></textarea><br>
    Direction (optional) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                                   id="limitvardir" title="-1: limite from left, 1: from right" rows=1></textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_limit_ok();">&#x2705;</button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_limit').style.display='none'">&#x274C;</button>
    <button class="bouton"
            onclick="$id('limitexpr').value='';$id('limitvarname').value='';$id('limitvarlim').value='';$id('limitvardir').value='';">Clear
    </button>
    <button class="bouton" onclick="$id('limitexpr').value='sin(x)/x';$id('limitvarname').value='x';$id('limitvarlim').value='0';$id('limitvardir').value='1';">Example</button>
  </div>
  <div id="assistant_int" style="display:none">
    Integration <br>
    expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                         id="intexpr" title="Expression, for example x^2" rows=1></textarea><br>
    variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                       id="intvarname" title="variable name, for example x" rows=1>x</textarea><br>
    from (optional) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                              id="intvarmin" rows=1></textarea><br>
    to (optional) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                            id="intvarmax" rows=1></textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_int_ok();">&#x2705;</button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_int').style.display='none'">&#x274C;</button>
    <button class="bouton"
            onclick="$id('intexpr').value='';$id('intvarname').value='';$id('intvarmin').value='';$id('intvarmax').value='';">Clear
    </button>
    <button class="bouton" onclick="$id('intexpr').value='1/(1+x^2)^2';$id('intvarname').value='x';$id('intvarmin').value='';$id('intvarmax').value='';">Example 1</button>
    <button class="bouton" onclick="$id('intexpr').value='1/(1+x^2)^2';$id('intvarname').value='x';$id('intvarmin').value='0';$id('intvarmax').value='1';">Example 2</button>
  </div>
  <div id="assistant_sum" style="display:none">
    Discrete sum <br>
    expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                         id="sumexpr" title="Expression, for example j^2" rows=1></textarea><br>
    variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                       id="sumvarname" title="variable name, for example j" rows=1>j</textarea><br>
    from (optional) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                              id="sumvarmin" rows=1></textarea><br>
    to (optional) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                            id="sumvarmax" rows=1></textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_sum_ok();">&#x2705;</button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_sum').style.display='none'">&#x274C;</button>
    <button class="bouton" onclick="$id('sumexpr').value='j^2';$id('sumvarname').value='j';$id('sumvarmin').value='0';$id('sumvarmax').value='n';">Example</button>
    <button class="bouton"
            onclick="$id('sumexpr').value='';$id('sumvarname').value='';$id('sumvarmin').value='';$id('sumvarmax').value='';">Clear
    </button>
  </div>
  <div id="assistant_diff" style="display:none">
    Derivative <br>
    expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                         id="diffexpr" title="Expression, for example sin(x)^2" rows=1></textarea><br>
    variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                       id="diffvarname" title="variable name, for example x" rows=1>x</textarea><br>
    Number of derivatives <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                                    id="diffnumber" title="Default value 1" rows=1>1</textarea><br>
    <br>
    <button class="bouton" onclick="UI.assistant_diff_ok();">&#x2705;</button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_diff').style.display='none'">&#x274C;</button>
    <button class="bouton" onclick="$id('diffexpr').value='sin(x)^2';$id('diffvarname').value='x';$id('diffnumber').value='';">Example 1</button>
    <button class="bouton" onclick="$id('diffexpr').value='sin(x^2)';$id('diffvarname').value='x';$id('diffnumber').value='5';">Example 2</button>
    <button class="bouton"
            onclick="$id('diffexpr').value='';$id('diffvarname').value='';$id('diffnumber').value='';">Clear
    </button>
  </div>
</div>
<div id="assistant_geo" style="display:none">
  <button class="bouton" onclick="UI.insert(UI.focused,'point(')"
          title="Point by coordinates or affix">point
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'segment(')"
          title="Segment by 2 points or 2 affixes">segment
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'line(')"
          title="Line by 2 points or equation">line
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'vector(')"
          title="Vector">vector
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'equation(')"
          title="Equation">equation
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'parameq(')"
          title="Parametric equation">param
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'midpoint(')"
          title="Midpoint">milieu
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'circle(')"
          title="Circle by center and radius or diameter">&#x25ef;
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'isobarycenter(')"
          title="Isobarycenter">Isobary.
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'center(')"
          title="Circle center">center
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'inter(')"
          title="List of intersections, run inter_unique for one point">inter
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'inter_unique(')"
          title="First or unique intersection point">unique
  </button>
  <button class="bouton" onclick="var tmp=$id('assitant_geo_plus'); if(tmp.style.display=='none') tmp.style.display='block'; else tmp.style.display='none';">+</button>
  <div id="assitant_geo_plus" style="display:none">
    <button class="bouton" onclick="UI.insert(UI.focused,'triangle(')"
            title="Triangle">&#x25b3;
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'rectangle(')"
            title="Rectangle">&#x25ad;
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'parallelogram(')"
            title="Parallelogram">&#x25b1;
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'square(')"
            title="Square">&#x25a2;
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'isopolygon(')"
            title="Isopolygon">iso
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'polygon(')"
            title="Polygon">polygon
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'parallel(')"
            title="Parallel">//
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'perpendicular(')"
            title="Perpendicular">&perp;
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'perpen_bisector(')"
            title="Perpendicular bisector">perpen_
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'bisector(')"
            title="Bisector">bisector
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'altitude(')"
            title="Altitude">hauteur
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'tangent(')"
            title="Tangent to a graphe">tangent
    </button>
    <button class="bouton" onclick="UI.insert(UI.focused,'distance(')"
            title="Distance">dist.
    </button>
    <button class="bouton"
            onclick="$id('assistant_geo').style.display='none'">&#x274C;
    </button>
  </div>
</div>
<div id="assistant_arit" style="display:none">
  <button class="bouton" onclick="UI.insert(UI.focused,'gcd(')"
          title="GCD of integers or polynomials">gcd
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'iquo(')"
          title="iquo: quotient de la division euclidienne d'entiers">&nbsp;&nbsp;i
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'quo(')"
          title="Polynomial euclidean quotient">quo
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'irem(')"
          title="irem: integer euclidean remainder">&nbsp;&nbsp;i
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'rem(')"
          title="Polynomial euclidean remainder">rem
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'iabcuv(')"
          title="iabcuv: solve a*u+b*v=c where a,b,c are integers">&nbsp;&nbsp;i
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'abcuv(')"
          title="Polynomial solution of A*U+B*V=C">abcuv
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'ifactor(')"
          title="ifactor: integer factorization">&nbsp;&nbsp;i
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'factor(')"
          title="Polynomial factorization">factor
  </button>
  <br>
  <button class="bouton" onclick="UI.insert(UI.focused,'lcm(')"
          title="Least common multiple (integer or polynomials)">lcm
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'ichinrem(')"
          title="Integer chinese remainder">ichrem
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'isprime(')"
          title="Pseudo-primality test">isprime
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'nextprime(')"
          title="Next pseudo-prime integer">next
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'powmod(')"
          title="powmod: fast modular powering">pow
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'mod(')"
          title="Create an element of Z/nZ">mod
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'GF(')"
          title="Create a finite field (of cardinal p^n with n>1)">GF
  </button>
  <br>
  <button class="bouton" onclick="UI.insert(UI.focused,'lcoeff(')"
          title="lcoeff: leading coefficient">&nbsp;l
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'coeff(')" title="Coefficient">coeff</button>
  <button class="bouton" onclick="UI.insert(UI.focused,'degree(')"
          title="Degree">degree
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'horner(')"
          title="Evaluation">horner
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'ptayl(')"
          title="Polynomial Taylor expansion (aka shift)">ptayl
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'proot(')"
          title="Approx. complex roots for a polynomial">proot
  </button>
  <button class="bouton"
          onclick="$id('assistant_arit').style.display='none'">&#x274C;
  </button>
</div>
<div id="assistant_linalg" style="display:none">
  <button class="bouton" onclick="UI.insert(UI.focused,'dot(')"
          title="Scalar product">dot
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'cross(')"
          title="Vector product in R^2 or R^3">cross
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'tran(')"
          title="Matrix transpose, for the transconjugate use trn(M) or M^*">tran
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'idn(')"
          title="Identity matrix of size n">idn
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'matrix(')"
          title="Create a matrix">matr
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'hilbert(')"
          title="Hilbert matrix of size n">hilb
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'vandermonde(')"
          title="Vandermonde matrix">vand
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'laplace(')"
          title="1-d discrete Laplacian matrix of size n">lapl.
  </button>
  <br>
  <button class="bouton" onclick="UI.insert(UI.focused,'rref(')"
          title="Row reduction to echelon form">rref
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'ker(')"
          title="ker(M) basis of the nullspace of a linear application of matrix M">ker
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'det(')"
          title="Determinant">det
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'linsolve(')"
          title="Linear system solver">linsolve
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'lu(')"
          title="Factorization P*A=L*U">lu
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'qr(')"
          title="Factorization A=Q*R">qr
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'cholesky(')"
          title="Cholesky factorization A=L*L^* for A definite positive">chol.
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'cond(')"
          title="Condition number with respect to 1, 2 or inf norm">cond
  </button>
  <br>
  <button class="bouton" onclick="UI.insert(UI.focused,'egv(')"
          title="Eigenvectors">egv
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'egvl(')"
          title="Eigenvalues">egvl
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'jordan(')"
          title="Jordan matrix reduction A*P=P*J">jordan
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'pcar(')"
          title="Characteristic polynomial">pcar
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'pmin(')"
          title="Minimal polynomial">pmin
  </button>
  <button class="bouton" onclick="UI.insert(UI.focused,'matrix_norm(')"
          title="Matrix norm (1, 2 or inf) ">norm
  </button>
  <button class="bouton"
          onclick="$id('assistant_linalg').style.display='none'">&#x274C;
  </button>
</div>
<div id="chooselawdiv" style="display:none">
  <form id="chooselawform">
    Selected law <input class="bouton" type="text" id="rand_law" name="rand_law"
                        title="Loi" value='normald'>, optional parameters
    <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, for example 1 ou 2 ou 1.3 ou x" value=1>
    <br>
    Choose a law
    <input type="button" onclick="$id('rand_law').value='uniformd';$id('rand_law1').value=0;$id('rand_law1').step=0.01;$id('rand_law2').value=1;$id('rand_law1').style.display='inline';$id('rand_law2').style.display='inline';" value="uniformd">
    <input type="button" onclick="$id('rand_law').value='normald';$id('rand_law1').value=0;$id('rand_law1').step=0.01;$id('rand_law2').value=1;$id('rand_law1').style.display='inline';$id('rand_law2').style.display='inline';" value="normald">
    <input type="button" onclick="$id('rand_law').value='exponentiald';$id('rand_law1').value=0.5;$id('rand_law1').step=0.01;$id('rand_law1').style.display='inline';$id('rand_law2').style.display='none';" value="exponentiald">
    <input type="button" onclick="$id('rand_law').value='binomial';$id('rand_law1').value=10;$id('rand_law1').step=1;$id('rand_law2').value=0.5;$id('rand_law1').style.display='inline';$id('rand_law2').style.display='inline';" value="binomial">
    <input type="button" onclick="$id('rand_law').value='negbinomial';$id('rand_law1').value=10;$id('rand_law1').step=1;$id('rand_law2').value=0.5;$id('rand_law1').style.display='inline';$id('rand_law2').style.display='inline';" value="negbinomial">
    <input type="button" onclick="$id('rand_law').value='geometric';$id('rand_law1').value=0.5;$id('rand_law1').step=0.01;$id('rand_law1').style.display='inline';$id('rand_law2').style.display='none';" value="geometric">
    <input type="button" onclick="$id('rand_law').value='poisson';$id('rand_law1').value=0.5;$id('rand_law1').step=0.01;$id('rand_law1').style.display='inline';$id('rand_law2').style.display='none';" value="poisson">
  </form>
</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="$id('assistant_matr').matr_formuleshadow.checked=!checked;UI.assistant_matr_setdisplay();"
           title="Check to define the matrix using an expression">
    <input class="bouton" type="button" value="expression" onclick="$id('assistant_matr').matr_formule.checked=true;$id('assistant_matr').matr_formuleshadow.checked=false;UI.assistant_matr_setdisplay();"> or
    <input class="bouton" type="checkbox" name="matr_formuleshadow"
           onclick="$id('assistant_matr').matr_formule.checked=!checked;UI.assistant_matr_setdisplay();"
           title="Check to define each element of the matrix"
           checked>
    <input class="bouton" type="button" value="case" onclick="$id('assistant_matr').matr_formule.checked=false;$id('assistant_matr').matr_formuleshadow.checked=true;UI.assistant_matr_setdisplay();">
  </div>
  <div id="matr_stats" style="display:none">
    <input class="bouton" type="button"
           onclick="$id('chooselawdiv').style.display='block';$id('law_arg').style.display='inline';$id('matr_stat12').style.display='none';$id('matr_testhyp').style.display='none';$id('risque_alpha').style.display='none';$id('matr').style.display='none';$id('matr_matr').style.display='none';" value="usual laws">
    or <input class="bouton" type="button"
              onclick="$id('chooselawdiv').style.display='block';$id('law_arg').style.display='none';$id('matr_stat12').style.display='none';$id('matr_testhyp').style.display='none';$id('risque_alpha').style.display='block';$id('matr').style.display='none';$id('matr_matr').style.display='none';" value="fluctuation interval">
    or <input class="bouton" type="button" onclick="$id('matr_stat12').style.display='block';$id('matr').style.display='block'; if(UI.is_sheet){ UI.spreadsheet2matrix(false);UI.matrix2spreadsheet();} UI.assistant_matr_setdisplay();$id('matr_testhyp').style.display='none';$id('risque_alpha').style.display='none';$id('chooselawdiv').style.display='none'; $id('matr_matr').style.display='block';$id('matr_submat').style.display='block';" value="descriptive statistics">
    or <input class="bouton" type="button" onclick="$id('matr_stat12').style.display='none';$id('matr').style.display='block'; $id('matr_testhyp').style.display='block';$id('risque_alpha').style.display='block';$id('chooselawdiv').style.display='none'; $id('matr_matr').style.display='block';$id('matr_submat').style.display='block';UI.adequation($id('assistant_matr'))" value="inferential statistics">
    <div id="matr_stat12" style="display:none">
      <input class="bouton" type="checkbox" name="stat_mean">Mean,
      <input class="bouton" type="checkbox" name="stat_stddev">Standard deviation,
      <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;">Histogram,
      <input class="bouton" type="checkbox" name="stat_moustache">Boxwhisker,
      <br>
      <input class="bouton" type="checkbox" name="stat_scatter" onclick="form.stat_cmax.value=form.stat_cmin.value+1;">Scatterplot
      <input class="bouton" type="checkbox" name="stat_polygonscatter" onclick="form.stat_cmax.value=form.stat_cmin.value+1;">Polygonplot,
      <input class="bouton" type="checkbox" name="stat_linreg"
             onclick="form.stat_cmax.value=form.stat_cmin.value+1;">Linear regression
    </div>
    <div id="risque_alpha" style="display:none">
      Risk &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>
          Confidence interval:
          <input type="button" class="bouton" onclick="form.adequation[0].checked=true;UI.adequation(form)" value="proportion"><input type="radio" name="adequation"
                                                                                                                                      onclick="UI.adequation(form)" title="Confidence interval according to normal law assuming n*p and n*(1-p)>=5" checked>
          (n=<input name="confiance_n" class="bouton" type="number" value=30
                    min=30 step=1 title="Population size. For n&gt;100, standard deviation is estimated by sqrt(n/(n-1)*p*(1-p)), otherwise 0.5">&geq;30,
          p=<input name="confiance_p" class="bouton" type="number"
                   title="Proportion in sample"
                   value=0.5 min=0 max=1 step=0.001>),
          <input type="button" class="bouton" onclick="form.adequation[1].checked=true;UI.adequation(form)" value="Student &mu;&sigma;"><input type="radio"
                                                                                                                                               onclick="UI.adequation(form)" name="adequation" title="Confidence interval according to Student law">
          (&mu;=<input name="confiance_mu" class="bouton" type="number"
                       title="Sample mean" value=0
                       step=0.001>, &sigma;=<input name="confiance_sigma" class="bouton" type="number"
                                                   step=0.001 min=0 value=1 title="Sample stddev">
          n=<input name="confiance_n_" class="bouton" type="number" value=30
                   min=30 step=1>)
          <br>
          <input type="button" class="bouton" onclick="form.adequation[2].checked=true;UI.adequation(form)" value="data"><input type="radio" onclick="UI.adequation(form)" name="adequation"
                                                                                                                                title="Confidence interval according to Student on data from matrix">,
        </li>
        <li> Adequation data/data :
          <input type="button" class="bouton" onclick="form.adequation[3].checked=true;UI.adequation(form)" value="Chi2"> <input type="radio" onclick="UI.adequation(form)"
                                                                                                                                 name="adequation" value="radio">,
          <input type="button" class="bouton" onclick="form.adequation[4].checked=true;UI.adequation(form)" value="Kolmogorov"> <input onclick="UI.adequation(form)"
                                                                                                                                       type="radio" name="adequation" value="radio"
                                                                                                                                       title="Kolmogorov-Smirnov adequation test (assumes common continuous unknown law)">,
          or
          <input type="button" class="bouton" onclick="form.adequation[5].checked=true;UI.adequation(form)" value="Wilcoxon"> <input onclick="UI.adequation(form)"
                                                                                                                                     type="radio" name="adequation" value="radio"
                                                                                                                                     title="Wilcoxon-Mann-Whitney test">
        </li>
        <li>
          Adequation data/law : <input type="button" class="bouton" onclick="form.adequation[6].checked=true;UI.adequation(form)" value="normal"> <input type="radio"
                                                                                                                                                         name="adequation" value="radio" onclick="UI.adequation(form)">
          or
          <input type="button" class="bouton" onclick="form.adequation[7].checked=true;UI.adequation(form)" value="Student"> <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> optional),
          <br>
          <span title="Alternative to H0">Alternative H1 &lt;<input
              type="radio" name="adequation_alt">,
                            &ne;<input type="radio" name="adequation_alt">,
                            &gt;<input type="radio" name="adequation_alt"></span>
        </li>
      </ul>
    </div>
  </div>
  <div id="matr_matr">
    <input id="matr_name" name="matr_name" class="bouton" type="text"
           value="m" title="Matrix name" size=3>:
    <input class="bouton" type="button" onclick="UI.sheet_rowadd(-1);" 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="Number of rows" value=3 min=1 max=40>
    <input class="bouton" type="button" onclick="UI.sheet_rowadd(1)" value="+">
    by
    <input class="bouton" type="button" onclick="UI.sheet_coladd(-1)" 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="Number of columns" value=3 min=1 max=6>
    <input class="bouton" type="button" onclick="UI.sheet_coladd(1)" 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 of m[j,k] in terms of j and k"></textarea>
    <input class="bouton" type="checkbox" name="matr_start0"
           title="Check for indices starting at 0" checked>
    (indices from 0 to size-1)
    <br>
    <input class="bouton" type="button" title="Identity matrix" value="Identity" onclick="form.matr_expr.value='si j==k alors 1; sinon 0; fsi';">
    <input class="bouton" type="button" title="Hilbert matrix" value="Hilbert" onclick="form.matr_expr.value='1/(j+k+1)';">
    <input class="bouton" type="button" title="Clear" value="Clear" onclick="if (form.matr_formule.checked) form.matr_expr.value='';">
  </div>
  <input class="bouton" type="submit" title="ok" value="&#x2705;">
  <input class="bouton" type="button" title="Cancel" value="&#x274C;" onclick="$id('chooselawdiv').style.display='none';form.style.display='none'; UI.focused=UI.savefocused; UI.focused.focus();"> &nbsp;
  <div id="matr" style="display:none">
    <div id="matr_submat" style="display:none">
      Lines <input id="stat_lmin" name="stat_lmin" class="bouton" type="number" min=0 value=0>
      -
      <input id="stat_lmax" name="stat_lmax" class="bouton" type="number" min=0 value=2>,
      columns <input id="stat_cmin" name="stat_cmin" class="bouton" type="number" min=0 value=0>
      -
      <input id="stat_cmax" name="stat_cmax" class="bouton" type="number" min=0 value=1>
    </div>
    <input id="matr_or_sheet" name="matr_or_sheet" class="bouton"
           type="checkbox" title="Switch spreadsheet/matrix mode"
           onchange="UI.is_sheet=checked; if (checked) UI.matrix2spreadsheet(); else UI.spreadsheet2matrix(false);" checked>
    <input type="button" onclick="form.matr_or_sheet.checked=!form.matr_or_sheet.checked;if (form.matr_or_sheet.checked) UI.matrix2spreadsheet(); else UI.spreadsheet2matrix(false);" value="Spreadsheet">
    <input class="bouton" type="button"
           onclick="UI.sheet_edit_cmd(0)" onmousedown="event.preventDefault()"
           title="Copy down" value="cp↓">
    <input class="bouton" type="button"
           onclick="UI.sheet_edit_cmd(1)" onmousedown="event.preventDefault()"
           title="Copy right" value=" →">
    <input class="bouton" type="button"
           onclick="UI.sheet_edit_cmd(2)" onmousedown="event.preventDefault()"
           title="Add line" value="l+">
    <input class="bouton" type="button"
           onclick="UI.sheet_edit_cmd(3)" onmousedown="event.preventDefault()"
           title="Remove line" value="l-">
    <input class="bouton" type="button"
           onclick="UI.sheet_edit_cmd(4)" onmousedown="event.preventDefault()"
           title="Add column" value="c+">
    <input class="bouton" type="button"
           onclick="UI.sheet_edit_cmd(5)" onmousedown="event.preventDefault()"
           title="Remove column" value="c-">
    <input class="bouton" type="button"
           onclick="UI.insert(UI.focused,'=')" onmousedown="event.preventDefault()"
           title="Spreadsheet formula prefix" value="=">
    <input class="bouton" type="button"
           onclick="UI.insert(UI.focused,'$')" onmousedown="event.preventDefault()"
           title="Absolute position prefix" value="$">
    <div id="matr_casediv">
    </div>
  </div>
</form>
<form id="assistant_rand" style="display:none">
  Generation of
  <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="Number of rows of the matrix (0 for a vector)" value=1 min=0>
  <input class="bouton" type="button" onclick="$id('rand_nrows').value++;" value="+">
  by
  <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="Number of columns of the matrix (0 for a single number)"
         value=1 min=0>
  <input class="bouton" type="button" onclick="$id('rand_ncols').value++;" value="+">
  <input class="bouton" type="checkbox" name="rand_int"
         onclick="$id('assistant_rand').rand_intshadow.checked=!checked;UI.assistant_rand_setdisplay();"
         title="Check for integers" checked>
  <input class="bouton" type="button" value="integers"
         onclick="var checked=form.rand_int.checked;form.rand_int.checked=!checked;form.rand_intshadow.checked=checked;UI.assistant_rand_setdisplay();">
  or according to a
  <input class="bouton" type="checkbox" name="rand_intshadow" value="law"
         onclick="$id('assistant_rand').rand_int.checked=!checked;UI.assistant_rand_setdisplay();"
         title="Check to choose a law">
  <input class="bouton" type="button" value="loi"
         onclick="var checked=form.rand_intshadow.checked;form.rand_intshadow.checked=!checked;form.rand_int.checked=checked;UI.assistant_rand_setdisplay();">
  <div id="rand_intdiv">
    Integers between 0 and n or n and -n with n=
    <input class="bouton" type="number" id="rand_maxint"
           title="Integer k such that 0&lt;=k&lt;n or n&lt;k&lt;-n if n<0" value=100>
  </div>
  <br><input class="bouton" type="button" title="ok" value="&#x2705;"
             onclick="UI.assistant_rand_ok()">
  <input class="bouton" type="button" title="random real in 0..1"
         value="rand" onclick="UI.insert(UI.focused,'rand()');"><input class="bouton" type="button" title="randint(a,b): random integer between a and b included"
                                                                       value="int" onclick="UI.insert(UI.focused,'randint(');"><input class="bouton" type="button" title="random real, normal law (default mean=0 and stddev=1)"
                                                                                                                                      value="norm" onclick="UI.insert(UI.focused,'randNorm(');"><input class="bouton" type="button" title="random real, exponential law parameter a"
                                                                                                                                                                                                       value="exp" onclick="UI.insert(UI.focused,'randexp(');">
  <input class="bouton" type="button" title="Random permutation of a list or of n integers"
         value="perm" onclick="UI.insert(UI.focused,'randperm(');">
  <input class="bouton" type="button" title="sample(L,n) sample of n in list L without replacement"
         value="sample" onclick="UI.insert(UI.focused,'sample(');">
  <input class="bouton" type="button" title="Cancel" value="&#x274C;" onclick="$id('chooselawdiv').style.display='none';form.style.display='none'; UI.focused=UI.savefocused; UI.focused.focus();">
</form>
<div id="assistant_boucle" style="display:none">
  Choose <strong>loop</strong>
  <button class="bouton" onmousedown="event.preventDefault()" onclick="$id('assistant_pour').style.display='block';UI.set_focus('pourvarname'); $id('assistant_tantque').style.display='none';">for</button>
  or
  <button class="bouton" onmousedown="event.preventDefault()" onclick="$id('assistant_pour').style.display='none';$id('assistant_tantque').style.display='block';UI.set_focus('tantquecond'); $id('tantquecond').focus();">while</button>
  <div id="assistant_pour" style="display:none">
    for <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                  id="pourvarname" title="variable name, for example j" rows=1></textarea><br>
    from <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                   id="pourvarmin" title="start value" rows=1></textarea><br>
    to <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                 id="pourvarmax" title="end value (not included in Python syntax, included in Xcas syntax)" rows=1></textarea><br>
    step (optional) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                              id="pourvarstep" title="step, default to 1" rows=1></textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_pour_ok();">&#x2705;</button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_boucle').style.display='none';$id('assistant_pour').style.display='none'">&#x274C;</button>
    <button class="bouton"
            onclick="$id('pourvarname').value='';$id('pourvarmin').value='';$id('pourvarmax').value='';">Clear
    </button>
    <button class="bouton" onclick="$id('pourvarname').value='j';$id('pourvarmin').value='1';$id('pourvarmax').value='10';">Example</button>
  </div>
  <div id="assistant_tantque" style="display:none">
    Tests :
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,'==')">==
    </button>
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,'!=')">!=
    </button>
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,'<=')">&lt;=
    </button>
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,'>=')">&gt;=
    </button>
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,'<')">&lt
    </button>
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,'>')">&gt
    </button>
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,' and ')">and
    </button>
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,' or ')">or
    </button>
    <button class="bouton" onmousedown="event.preventDefault()"
            onclick="UI.insert(UI.focused,'!')">!
    </button>
    <br>
    while <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                    id="tantquecond" title="Loops while this condition is true"
                    rows=1></textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_tantque_ok();">&#x2705;</button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_boucle').style.display='none';$id('assistant_pour').style.display='none'">&#x274C;</button>
  </div>
</div>
<div id="assistant_solve" style="display:none">
  Solve
  <button class="bouton" id="solvex" title="Click here for approx"
          onclick="style.display='none';$id('solvenum').style.display='inline'">exact
  </button>
  <button class="bouton" style="display:none" id="solvenum"
          title="Click here for exact"
          onclick="style.display='none';$id('solvex').style.display='inline'">approx
  </button>
  <button class="bouton" id="solveR" title="Click to solve in C"
          onclick="style.display='none';$id('solveC').style.display='inline'">in R
  </button>
  <button class="bouton" style="display:none" id="solveC"
          title="Click to solve in R"
          onclick="style.display='none';$id('solveR').style.display='inline'">in C
  </button>
  <br>
  equation or system
  <br>
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
            id="solveeq" title="for example x^2-3x+1=0" rows=1
            cols=30></textarea>
  <br>
  unknown(s)
  <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
            id="solvevar" title="for example x" rows=1 cols=10></textarea>
  <br>
  <button class="bouton" onclick="UI.assistant_solve_ok();">&#x2705;</button>
  <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_solve').style.display='none'">&#x274C;</button>
  <button class="bouton" onclick="$id('solveeq').value='';$id('solvevar').value='';">Clear</button>
  <button class="bouton" onclick="$id('solveeq').value='x^2-3x+1';$id('solvevar').value='x';">Example</button>
  <button class="bouton" onclick="$id('solveeq').value='[2x^2-y^2=1,x+y=3]';$id('solvevar').value='[x,y]';">Syst&egrave;me</button>
</div>
<div id="assistant_suites" style="display:none">
  Choose
  <button class="bouton"
          onclick="$id('assistant_rsolve').style.display='none';$id('assistant_fixe').style.display='block';UI.set_focus('rsolveexpr')
                ">numerical study of u_(n+1)=f(u_n)
  </button>
  or
  <button class="bouton"
          onclick="$id('assistant_rsolve').style.display='block';$id('assistant_fixe').style.display='none';UI.set_focus('rsolveeq');">
    find expression of u_n
  </button>
  <button class="bouton"
          onclick="UI.focused=UI.savefocused;$id('assistant_suites').style.display='none'">&#x274C;
  </button>
  <br>
  <div id="assistant_rsolve" style="display:none">
    Recurrence
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="rsolveeq" title="for example u(n+1)=2*u(n)+3" rows=1
              cols=40></textarea>
    <br>
    Unknown(s)
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="rsolvevar" title="for example u(n)" rows=1 cols=20>u(n)</textarea>
    <br>
    Initial conditions
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="rsolveinit" title="for example 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.assistant_rsolve_ok();">&#x2705;
    </button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_suites').style.display='none'">&#x274C;</button>
    <button class="bouton" onclick="$id('rsolveeq').value='';$id('rsolvevar').value='';$id('rsolveinit').value='';">Clear</button>
    <button class="bouton" onclick="$id('rsolveeq').value='u(n+1)===2*u(n)+3';$id('rsolvevar').value='u(n)';$id('rsolveinit').value='u(0)===1';">Arit-geo</button>
    <button class="bouton"
            onclick="$id('rsolveeq').value='u(n+1)===(u(n)+2)/(u(n)+1)';$id('rsolvevar').value='u(n)';$id('rsolveinit').value='u(0)===1';">Fixed
    </button>
    <button class="bouton" onclick="$id('rsolveeq').value='u(n+2)===u(n+1)+u(n)';$id('rsolvevar').value='u(n)';$id('rsolveinit').value='u(0)===1,u(1)===1';">Fibonacci</button>
    <button class="bouton" onclick="$id('rsolveeq').value='[u(n+1)===3*v(n)+u(n),v(n+1)===v(n)+u(n)]';$id('rsolvevar').value='[u(n),v(n)]';$id('rsolveinit').value='u(0)===1,v(0)===2'">System</button>
  </div>
  <div id="assistant_fixe" style="display:none">
    u_(n+1)=<textarea onkeyup="$id('rsolvefshadow').innerHTML=value;" onclick="UI.focused=this;" style="height:25px;font-size:large"
                      id="rsolvef" title="Function name" rows=1
                      cols=2>f</textarea>(u_n) with
    <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="for example (x+2)/(x+1)" rows=1 cols=20></textarea>
    and u(0)=
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="rsolveu0" title="for example 1" rows=1
              cols=10></textarea>
    <br>
    Number of terms n=
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="rsolven" title="for example 10" rows=1
              cols=3>10</textarea>
    <br>
    Function graph between
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="rsolvemin" title="for example 0" rows=1
              cols=3>0</textarea> and
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="rsolvemax" title="for example 2" rows=1
              cols=3>2</textarea>
    <br>
    <button class="bouton"
            onclick="UI.assistant_fixe_ok();">&#x2705;
    </button>
    <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_suites').style.display='none'">&#x274C;</button>
    <button class="bouton" onclick="$id('rsolvef').value='';$id('rsolvevarf').value='';$id('rsolveexpr').value='';$id('rsolveu0').value='';$id('rsolven').value='';$id('rsolvemin').value='';$id('rsolvemax').value='';">Clear</button>
    <button class="bouton" onclick="$id('rsolvef').value='f';$id('rsolvevarf').value='x';$id('rsolveexpr').value='(x+2)/(x+1)';$id('rsolveu0').value='1';$id('rsolven').value='10';$id('rsolvemin').value='1';$id('rsolvemax').value='2';">Example</button>
  </div>
</div>
<div id="assistant_test" style="display:none">
  Tests :
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,'==')">==
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,'!=')">!=
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,'<=')">&lt;=
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,'>=')">&gt;=
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,'<')">&lt
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,'>')">&gt
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,' et ')">et
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,' ou ')">ou
  </button>
  <button class="bouton" onmousedown="event.preventDefault()"
          onclick="UI.insert(UI.focused,'!')">!
  </button>
  <br>
  if <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
               id="sicond" title="Test, for example j!=0"
               rows=1></textarea>
  <br>
  then <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                 id="sialors" title="True clause, for example j:=-j;"
                 rows=1></textarea>
  <br>
  else (optional) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                            id="sisinon" title="False clause"
                            rows=1></textarea>
  <br>
  <button class="bouton" onclick="UI.assistant_test_ok();">&#x2705;</button>
  <button class="bouton"
          onclick="UI.focused=UI.savefocused;$id('assistant_test').style.display='none'">&#x274C;
  </button>
  <button class="bouton"
          onclick="$id('sicond').value='';$id('sialors').value='';">Clear
  </button>
  <button class="bouton"
          onclick="$id('sicond').value='j<0';$id('sialors').value=UI.python_mode?'j=-j':'j:=-j;';">Example
  </button>
</div>
<div id="assistant_prog" style="display:none">
  <strong>New function</strong><br>
  function name<textarea onclick="UI.focused=this;"
                         style="height:25px;font-size:large" id="funcname" title="Function name, for example f" rows=1>f</textarea><br>
  arguments <textarea onclick="UI.focused=this;"
                      style="height:25px;font-size:large" id="argsname" title="Function arguments, use comma as separator" rows=1>x</textarea><br>
  <span id="localvarspan">local variables <textarea onclick="UI.focused=this;"
                            style="height:25px;font-size:large" id="localvars"
                            title="Local variables, use comma as separator. Leave empty if you do not need local variables. Symbolic variables should be declared as local and purged after."
                            rows=1></textarea><br></span>
  returned value <textarea onclick="UI.focused=this;"
                           style="height:25px;font-size:large" id="returnedvar" title="Returned value" rows=1></textarea><br>
  <button class="bouton" onclick="UI.assistant_prog_ok();">&#x2705;</button>
  <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_prog').style.display='none'">&#x274C;</button>
  <button class="bouton"
          onclick="$id('funcname').value='';$id('argsname').value='';$id('localvars').value='';$id('returnedvar').value='';">Clear
  </button>
  <button class="bouton" onclick="$id('funcname').value='f';$id('argsname').value='x,y';$id('localvars').value='';$id('returnedvar').value='x*y';">Example 1</button>
  <button class="bouton" onclick="$id('funcname').value='f';$id('argsname').value='x,y';$id('localvars').value='z';$id('returnedvar').value='x*z';">Example 2</button>
</div>
<div id="assistant_seq" style="display:none">
  Create a sequence or a table of values, <br>
  expression <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                       id="seqexpr" title="Expression, for example j^2" rows=1></textarea><br>
  variable <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                     id="seqvarname" title="variable name, for example j" rows=1></textarea><br>
  from <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                 id="seqvarmin" title="start value" rows=1></textarea><br>
  to <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
               id="seqvarmax" title="end value" rows=1></textarea><br>
  Step (optional) <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                            id="seqvarstep" title="step value, default 1" rows=1></textarea>
  <br>
  <button class="bouton" onclick="UI.assistant_seq_ok();">&#x2705;</button>
  <button class="bouton" onclick="UI.focused=UI.savefocused;$id('assistant_seq').style.display='none'">&#x274C;</button>
  <button class="bouton" onclick="$id('seqexpr').value='j^2';$id('seqvarname').value='j';$id('seqvarmin').value='1';$id('seqvarmax').value='10';$id('seqvarstep').value=''">Example 1</button>
  <button class="bouton" onclick="$id('seqexpr').value='[j,j^2]';$id('seqvarname').value='j';$id('seqvarmin').value='-2';$id('seqvarmax').value='2';$id('seqvarstep').value='0.25'">Example 2</button>
  <button class="bouton"
          onclick="$id('seqexpr').value='';$id('seqvarname').value='';$id('seqvarmin').value='';$id('seqvarmax').value='';$id('seqvarstep').value=''">Clear
  </button>
</div>
<div id="assistant_tabvar" style="display:none">
  Choose
  <button class="bouton" onclick="$id('assistant_tabvarfunc').style.display='block';UI.xtn='x';$id('assistant_tabvarparam').style.display='none';UI.set_focus('tabvarfuncexpr')">function</button>
  or
  <button class="bouton"
          onclick="$id('assistant_tabvarfunc').style.display='none';$id('assistant_tabvarparam').style.display='block';UI.xtn='t';UI.set_focus('tabvarparamexprx');">parametric curve
  </button>
  <button class="bouton"
          onclick="UI.focused=UI.savefocused;$id('assistant_tabvar').style.display='none'">&#x274C;
  </button>
  <br>
  <div id="assistant_tabvarfunc" style="display:none">
    Function study (console) and graph of <br>
    <textarea rows=1 cols=3 onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="tabvarfuncname" title="Function name">f</textarea>(
    <textarea rows=1 cols=2 onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="tabvarfuncvarname" title="variable name, for example x">x</textarea>)
    :=<textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                id="tabvarfuncexpr" title="Expression, for example 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="Step (between two successive evaluations of the expression)" rows=1>0.0625</textarea>
    <br>
    Option : <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                       id="tabvarfuncopt" title="diff: no convexity, plot: returns the graph, tabvar: returns the variations table" rows=1>diff</textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_tabvarfunc_ok();">&#x2705;</button>
    <button class="bouton"
            onclick="UI.focused=UI.savefocused;$id('assistant_tabvar').style.display='none'">&#x274C;
    </button>
    <button class="bouton"
            onclick="$id('tabvarfuncname').value='';$id('tabvarfuncexpr').value='';$id('tabvarfuncvarname').value='';$id('tabvarfuncvarmin').value='';$id('tabvarfuncvarmax').value='';$id('tabvarfuncvarstep').value='';">Clear
    </button>
    <button class="bouton" onclick="$id('tabvarfuncname').value='f';$id('tabvarfuncexpr').value='x/(x^2-1)';$id('tabvarfuncvarname').value='x';$id('tabvarfuncvarmin').value='-inf';$id('tabvarfuncvarmax').value='inf';">Example</button>
    <button class="bouton"
            onclick="$id('assistant_tabvar').style.display='none';$id('assistant_seq').style.display='block';$id('seqexpr').value= '['+$id('tabvarfuncvarname').value+','+$id('tabvarfuncexpr').value+']';$id('seqvarname').value=$id('tabvarfuncvarname').value;var tmp=$id('tabvarfuncvarmin').value; if(tmp=='-inf') tmp=-5;$id('seqvarmin').value=tmp;tmp=$id('tabvarfuncvarmax').value; if(tmp=='inf') tmp=5;$id('seqvarmax').value=tmp;$id('seqvarstep').value=$id('tabvarfuncxstep').value;">Table
    </button>
    .
  </div>
  <div id="assistant_tabvarparam" style="display:none">
                <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                          id="tabvarparamnamex" title="x-function name"
                          rows=1 cols=3>x1</textarea>
    (<textarea onkeyup="$id('tabvarparamvarnameshadow').innerHTML=value;" onclick="UI.focused=this;" style="height:25px;font-size:large"
               id="tabvarparamvarname" title="variable name, for example t"
               rows=1 cols=2>t</textarea>):= <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                                                       id="tabvarparamexprx" title="Expression of x(t), for example 2*cos(t)" rows=1></textarea><br>
    <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
              id="tabvarparamnamey" title="y-function name"
              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 of y(t), for example 3*sin(t)" rows=1></textarea><br>
    tmin <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                   id="tabvarparamvarmin" title="start value" rows=1>-4</textarea><br>
    tmax <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                   id="tabvarparamvarmax" title="end value" rows=1>4</textarea><br>
    tstep <textarea onclick="UI.focused=this;" style="height:25px;font-size:large"
                    id="tabvarparamvarstep" title="Step (between two successive evaluations of the expression)" rows=1>0.0625</textarea>
    <br>
    <button class="bouton" onclick="UI.assistant_tabvarparam_ok();">&#x2705;</button>
    <button class="bouton"
            onclick="UI.focused=UI.savefocused;$id('assistant_tabvar').style.display='none'">&#x274C;
    </button>
    <button class="bouton"
            onclick="$id('tabvarparamnamex').value='';$id('tabvarparamnamey').value='';$id('tabvarparamexprx').value='';$id('tabvarparamexpry').value='';$id('tabvarparamvarname').value='';$id('tabvarparamvarnameshadow').innerHTML='';$id('tabvarparamvarmin').value='';$id('tabvarparamvarmax').value='';$id('tabvarparamvarstep').value='';">Clear
    </button>
    <button class="bouton" onclick="$id('tabvarparamnamex').value='x1';$id('tabvarparamnamey').value='y1';$id('tabvarparamexprx').value='cos(2t)';$id('tabvarparamexprx').value='cos(2t)';$id('tabvarparamexpry').value='sin(3t)';$id('tabvarparamvarname').value='t';$id('tabvarparamvarnameshadow').innerHTML='t';$id('tabvarparamvarmin').value='-pi';$id('tabvarparamvarmax').value='pi';">Example</button>
  </div>
</div>
<table border="0" align="center" summary="" id="alpha_keyboard"
       style="display:none" onmousedown="event.preventDefault()">
  <tr>
    <td>
      <input type="button" id="add_alpha_a" value="a"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_z" value="z"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_e" value="e"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_r" value="r"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_t" value="t"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_y" value="y"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_u" value="u"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_i" value="i"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_o" value="o"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_p" value="p"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
    </td>
  </tr>
  <tr>
    <td>
      <input type="button" id="add_alpha_q" value="q"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_s" value="s"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_d" value="d"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_f" value="f"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_g" value="g"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_h" value="h"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_j" value="j"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_k" value="k"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_l" value="l"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_m" value="m"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
    </td>
  </tr>
  <tr>
    <td>
      <input type="button"
             onmousedown="event.preventDefault()"
             onClick='var kbd_a=["a","b","c","d","e",
                        "f","j","n","r","u","x",
                        "g","k","o","s","v","y",
                        "h","l","p","t","w","z",
                        "i","m","q"];
                        for (var i=0;i<kbd_a.length;i++){
                        var tmp=$id("add_alpha_"+kbd_a[i]);
                        if (tmp.value<="Z") tmp.value=String.fromCharCode(tmp.value.charCodeAt(0)+32); else tmp.value=String.fromCharCode(tmp.value.charCodeAt(0)-32);
                        }' id="add_alpha_" value="maj">
      <input type="button" id="add_alpha_w" value="w"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_x" value="x"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_c" value="c"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_v" value="v"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_b" value="b"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_n" value="n"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_{" value="{"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_}" value="}"
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,value)">
      <input type="button" id="add_alpha_space" value=" "
             onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,' ')">
    </td>
  </tr>
</table>
<hr>
<div id="divoutput" style="max-height: 400px; overflow:auto">
  <table id="mathoutput" contextmenu="cmdmenu" title="Historique"
         style="max-width:1000px "></table>
</div>
<div id="history4" style="display:none">
  <button class="bouton" onclick="var tmp=$id('variables'); if(tmp.style.display=='inline') tmp.style.display='none'; else {tmp.style.display='inline';UI.listvars(3);}"><strong>Vars</strong></button>
  <span id="variables" style="display:none">
            <button class="bouton" onclick="UI.insert(UI.focused,'python(')"
                    title="python(f) displays in Python syntax a function stored in a variable f">→python</button>
            <button class="bouton" onclick="UI.insert(UI.focused,'xcas(')"
                    title="xcas(f) displays in Xcas syntax a function stored in a variable f">→xcas</button>
            <button class="bouton" name="add_purge"
                    onmousedown="event.preventDefault()"
                    onClick="UI.insert(UI.focused,'purge(')" title="Clear one or more variables, for example purge(a) or purge(a,b,c)">clear</button>
            <button class="bouton" onclick="UI.addhelp(' ','rm_all_vars(1)')"
                    title="Clear all variables">tout</button>
            <span id="listvars"> </span>
            <br>
            </span>
  <span id="historique">
            <button class="bouton" onclick="UI.exec($id('mathoutput'),0)"
                    title="Execute all history commands">Exec</button>
            <button class="bouton" id="button_show_answers" onclick="UI.show_answers(true)" title="Show answers">+</button>
            <button class="bouton" id="button_hide_answers"
                    onclick="UI.show_answers(false)" title="Hide answers">-</button>
            <button class="bouton" onclick="UI.erase_all($id('mathoutput'))"
                    title="Move all levels to the trash">→Trash</button>
            <button class="bouton" onclick="UI.restoretrash()"
                    title="Restore levels from the trash">Restore</button>
            <button class="bouton" onclick="UI.emptytrash()"
                    title="Empty trash">Empty</button>
            </span>
</div>
<div contextmenu="cmdmenu" title="F1: help on commandname before cursor">
            <textarea name="entree" id="entree" title="Type a command, e.g. 2/3+1/6, then Enter" style="font-size:18px;width:98%"
                      rows=1 onclick="UI.focused=this;" onkeypress="UI.focused=this; if (event.keyCode==13 && event.shiftKey){UI.insert(this,'\n'); UI.indentline(this); return false;} if (event.keyCode!=13 || event.shiftKey) return true;UI.eval_cmdline1(value,true); return false;"></textarea>
  <span>
            <button class="bouton" style="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,'',false);}" title="Eval commandline">
            <strong>&nbsp;&nbsp;&#x2705;&nbsp;&nbsp;</strong></button>
            <button class="bouton" onmousedown="event.preventDefault()"
                    onClick="UI.completion(cmentree)" title="Short help on a command">&nbsp;?&nbsp;</button>
            <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.move_caret_or_focus(UI.focused,-1)" title="Cursor left">&nbsp;&nbsp;←&nbsp;&nbsp;</button><button class="bouton" id="button_droit" onmousedown="event.preventDefault()" onClick="UI.move_caret_or_focus(UI.focused,1)" title="Cursor right"> &nbsp;&nbsp;→&nbsp;&nbsp;</button><button class="bouton" onmousedown="event.preventDefault()" onClick="UI.moveCaretUpDown(UI.focused,-1)" title="Cursor up">&nbsp;↑&nbsp;&nbsp;</button><button class="bouton" onmousedown="event.preventDefault()" onClick="UI.moveCaretUpDown(UI.focused,1)" title="Cursor down">&nbsp;&nbsp;↓&nbsp;</button><button class="bouton" onmousedown="event.preventDefault()" onClick="UI.indentline(UI.focused)" title="Indent">→|</button>
            <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.backspace(UI.focused)" title="Erase">&nbsp;&#x232b;&nbsp;</button>
            <button class="bouton" onmousedown="event.preventDefault()" onClick="UI.insert(UI.focused,'\n')" title="Newline">\n</button>
            <button class="bouton" onmousedown="event.preventDefault()" onclick="UI.search(this,6)" title="Undo"><img width="16" height="16" src="undo.png" alt="Undo" align="center"></button><button class="bouton" onmousedown="event.preventDefault()" onclick="UI.search(this,7)" title="Redo"><img width="16" height="16" src="redo.png" alt="Redo" align="center"></button><button class="bouton" onmousedown="event.preventDefault()" onclick="UI.search(this,0)" title="Find">find</button><button class="bouton" onmousedown="event.preventDefault()" onclick="UI.search(this,1)" title="find next">&#x21D2;</button><button class="bouton" onmousedown="event.preventDefault()" onclick="UI.search(this,2)" title="Find previous">&#x21D0;</button><button class="bouton" onmousedown="event.preventDefault()"
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      onclick="UI.search(this,3)" title="Replace">rep</button><button
      class="bouton" onmousedown="event.preventDefault()" onclick="UI.search(this,5)" title="Go line">go</button>
            <button class="bouton" name="select_button"
                    id="select_button" onmousedown="event.preventDefault()"
                    onClick="UI.selectionne()" title="Select commandline">&nbsp;sel&nbsp;</button>  <button id="stop_button" class="bouton" style="display:none"
                                                                                                            onclick="if (UI.webworker && confirm('Really end session ?')){
                UI.webworker.terminate(); UI.busy=0;UI.webworker=0; alert('Session restarted. All variables have been cleared.');}" title="End current session">STOP</button>
            </span>
</div>
<div id="restoresession" style="display:none">
  <h1>Restoring session</h1>
</div>
<div id="consolediv" style="display:none">
  <hr>
  <h3>Console</h3>
  <button class="bouton" title="Clear console" onclick="var field=$id('output');field.innerHTML='';$id('consolediv').style.display='none';UI.set_config_width();">Clear</button>
  <button class="bouton" title="Increase line number" onclick="var field=$id('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="Decrease line number" onclick="var field=$id('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($id('table_3d').style.display=='none'){
                        $id('table_3d').style.display='inherit';
                        }
                        else {
                        $id('table_3d').style.display='none';
                        }"
                title="Montre ou cache le graphe 3d">3d Graph
        </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="menuen.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="search.js"></script>
<script src="searchcursor.js"></script>
<script src="jump-to-line.js"></script>
<script src="dialog.js"></script>
<link rel="stylesheet" href="dialog.css">
<script src="xcasmode.js"></script>
<script src="python.js"></script>
<script src="micropy.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 src="xcas.js"></script>
<script type='text/javascript'>
    // remove existing codemirror field
    prog = $id('prog');
    if (prog && prog.nextSibling) {
        prog.parentNode.removeChild(prog.nextSibling);
    }
    if (entree && entree.nextSibling) {
        entree.parentNode.removeChild(entree.nextSibling);
    }
    $id('canvas').onmousemove = function (event) {
        UI.canvas_mousemove(event, '');
    };
    $id('output').style.display = 'none';
    $id("config").reset();
    // connect to canvas
    var Module = {
        //TOTAL_MEMORY:134217728,
        worker: false,
        htmlcheck: true,
        htmlbuffer: '',
        preRun: [],
        postRun: [],
        print: (function () {
            var element = $id('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>'
                    var tmp = $id('consolediv');
                    if (tmp.style.display != 'block') {
                        tmp.style.display = 'block';
                        UI.set_config_width();
                    }
                    element.style.display = 'inherit';
                    element.innerHTML += text; // element.value += text + "\n";
                    element.scrollTop = 99999; // focus on bottom
                } else htmlbuffer += text;
              element.scrollIntoView();
            };
        })(),
        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: $id('canvas'),
        setStatus: function (text) {
            if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
            var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
            var statusElement = $id('status');
            var progressElement = $id('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 ? 'Preparing... (' + (this.totalDependencies - left) + '/' + this.totalDependencies + ')' : 'Download finished.');
        }
    };
    Module.setStatus('Downloading and preparing (may take 1 or 2 minutes the first time)');
    Module['onRuntimeInitialized'] = function () {
        console.log('UI is ready');
        UI.ready = true;
    }
</script>
<script type='text/javascript'></script>
<script async>
    var script = document.createElement("script");
    script.type = "text/javascript";
    var supported = (function () {
        try {
            if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") {
                var module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
                if (module instanceof WebAssembly.Module)
                    return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
            }
        } catch (e) {}
        return false;
    })();
    var webAssemblyAvailable = supported;
    /*
    if (Boolean(window.chrome)){
      if (!UI.detectmob()) webAssemblyAvailable = !!window.WebAssembly && window.location.href.substr(0,4)!='file';
    }
    else {
      var ua = window.navigator.userAgent;
      var old_ie = ua.indexOf('MSIE ');
      var new_ie = ua.indexOf('Trident/');
      if (!UI.detectmob() && old_ie<=-1 && new_ie<=-1)
        webAssemblyAvailable =!!window.WebAssembly;
    } */
    if (webAssemblyAvailable) {
        var ck = UI.readCookie('xcas_wasm');
        if (ck) {
            var form = $id('config');
            form.wasm_mode.checked = (ck == '1');
            webAssemblyAvailable = form.wasm_mode.checked;
        }
    }
    console.log('wasm ', supported, webAssemblyAvailable);
    if (webAssemblyAvailable) // fixme: enable
        script.src = "giacwasm.js";
    else
        script.src = "giac.js";
    document.getElementsByTagName("head")[0].appendChild(script);
</script>
<script src="longhelp_en.js"></script>
<script language="javascript">
    $id('thelink').innerHTML='<a href="'+UI.forum_url+'" target=_blank>Forum</a>';
    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 = "file:///usr/share/javascript/mathjax/MathJax.js?config=TeX-AMS_CHTML";
            document.getElementsByTagName("head")[0].appendChild(script);
        })();
    }
</script>
<script language="javascript">
    window.onbeforeunload = function (e) {
        var dialogText = "Etes-vous sur?";
        return dialogText;
    };
    $id('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) {
        console.log('init');
        var mth = $id('bouton_math');
        //mth.style.backgroundImage = "url('logo.png')";
        //mth.style.backgroundSize = '100%';
        //UI.caseval('abc(x=0); [x, y]; z+1;');
        var form = $id('config');
        var hw = window.innerWidth - 50;
        var access = true;
        if (hw >= 900) {
            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;
            $id('button_show_answers').style.display = 'none';
            $id('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 = "Computations would be faster with Firefox.";
            if (0 && 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);
        var mobile = UI.detectmob();
        if (mobile) {
            $id('loadbutton_cookie').style.display = 'inline';
            $id('loadbutton_file').style.display = 'none';
        }
        else {
            $id('loadbutton_cookie').style.display = 'none';
            $id('loadbutton_file').style.display = 'inline';
        }
        if (!UI.is_touch_device()) w3IncludeHTML(); // contextmenu
        //if (bt==1 && hw>=1000 && window.location.href.substr(0,4)=="http") w3IncludeHTML();
        $id('apropos').style.display = 'none';
        $id('help').style.display = 'none';
        console.log("window.onload");
        UI.langue = 0;
        // config in cookies
        var ck;
        ck = UI.readCookie('xcas_lang');
        if (ck) {
            var test = eval(ck) - 1; //console.log(test);
            if (test >= 0 && test < 5) {
                form.lang[2].checked = false;
                form.lang[test].checked = true;
            }
            if (test >= -1) UI.langue = -test - 1;
        }
        ck = UI.readCookie('xcas_calc');
        if (ck) {
            var test = eval(ck) - 1; //console.log(test);
            if (test >= 0 && test < 3) {
                form.calc[0].checked = false;
                form.calc[test].checked = true;
                UI.set_calc_type(test+1);
            }
        }
        ck = UI.readCookie('xcas_from');
        if (ck) {
            form.from.value = ck;
            UI.from = ck;
        }
        ck = UI.readCookie('xcas_to');
        if (ck) {
            form.to.value = ck;
            UI.mailto = 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_warnpy');
        if (ck) UI.warnpy = form.warnpy_mode.checked = (ck == '1');
        ck = UI.readCookie('xcas_python_mode');
        var hashParams = window.location.hash.substr(1);
        var forcepy=hashParams.substr(0,6)=='python';
        if (forcepy) ck='1';
        if (!ck) {
           var tmp=prompt("Choisir l'interpreteur. 1: Xcas compatible Python, 0: Xcas en francais, 4: MicroPython");
           if (tmp=='0' || tmp=='4') ck=tmp; else ck='1'; 
           if (tmp=='xcas' || tmp=='Xcas') ck='0';
           if (tmp=='python' || tmp=='Python') ck='4';
           //if (confirm('Voulez-vous activer la compatibilite de syntaxe Python ?')) ck = 1; else ck = 0;
        }
        form.python_mode.checked = (ck == '1' || ck=='4');
        form.python_xor.checked = (ck=='4');
        UI.python_mode = eval(ck);
        if (UI.python_mode==4) UI.micropy=1;
        $id('add_//').value = UI.python_mode ? '#' : '//';
        if (!UI.kbdshift) $id('add_:').value = UI.python_mode ? ':' : ':=';
        UI.createCookie('xcas_python_mode', UI.python_mode, 10000);
        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.readCookie('xcas_fixeddel');
        if (ck) form.fixeddel.checked = UI.fixeddel = (ck == '1');
        ck = UI.config_string();
        console.log(ck);
        //UI.sleep(200);
        if (0) UI.caseval(ck); else UI.initconfigstring = ck; //UI.set_config_width();
        ck = UI.readCookie('xcas_canvas_w');
        ck = eval(ck);
        if (ck > 0 && ck <= 1000)
            ;
        else ck = (UI.qa ? Math.floor(window.innerWidth / 2) : window.innerWidth - 110)
        console.log('canvas_w', ck);
        UI.canvas_w = ck;
        $id('config').canvas_w.value = ck;
        ck = UI.readCookie('xcas_canvas_h');
        ck = eval(ck);
        if (ck > 0 && ck <= 1000) ; else ck = Math.floor(window.innerHeight / 2);
        if (ck > 200 && mobile) ck = 200;
        console.log('canvas_h', ck);
        UI.canvas_h = ck;
        $id('config').canvas_h.value = ck;
        ck = UI.readCookie('xcas_matrix_maxrows');
        ck = eval(ck);
        if (ck > 0 && ck <= 1000) {
            UI.assistant_matr_maxrows = ck;
            $id('matr_cfg_rows').value = ck;
        }
        ck = UI.readCookie('xcas_matrix_maxcols');
        ck = eval(ck);
        if (ck > 0 && ck <= 100) {
            UI.assistant_matr_maxcols = ck;
            $id('matr_cfg_cols').value = ck;
        }
        ck = UI.readCookie('xcas_matrix_textarea');
        ck = eval(ck);
        if (ck > 0 && ck <= 100) {
            UI.assistant_matr_textarea = ck;
            $id('matr_textarea').checked = ck;
        }
        UI.assistant_matr_setmatrix(UI.assistant_matr_maxrows, UI.assistant_matr_maxcols);
        $id('assistant_matr').adequation[0].checked = true;
        var hist = $id('mathoutput');
        var doexec = false;
        var asked = false;
        if (hist.firstChild) {
            asked = true;
            if (!UI.withworker && confirm('Execute history commands?')) {
                doexec = true;
            }
            // else {alert('History not executed');}
        }
        // substr(1) to remove the `#`
        if (UI.readCookie('xcas_session') != null) {
            $id('startup_restore').style.display = 'inline';
            $id('startup1').style.display = 'none';
        }
        else { if (!forcepy) $id('help').style.display = 'block'; }
        //UI.restoresession(hashParams,hist,asked,doexec);
        var cons = $id('restoresession');
        cons.style.display = 'inherit';
        if (1 || UI.ready)
            window.setTimeout(UI.restoresession, 0, hashParams, hist, asked, doexec);
        else
            window.setTimeout(UI.restoresession, 400, hashParams, hist, asked, doexec);
        if (access)
            $id('startup2').style.display = 'block';
    };
</script>
</body>
</html>