"Fossies" - the Fresh Open Source Software Archive 
Member "TeXmacs-2.1.2-src/plugins/giac/doc/giac-demo.en.tm" (5 May 2022, 26356 Bytes) of package /linux/misc/TeXmacs-2.1.2-src.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the latest
Fossies "Diffs" side-by-side code changes report for "giac-demo.en.tm":
2.1.1_vs_2.1.2.
1 <TeXmacs|2.1.1>
2
3 <style|<tuple|tmdoc|giac|old-lengths>>
4
5 <\body>
6 <tmdoc-title|Example <name|Giac> session>
7
8 Here follows a sample session, which was started using
9 <menu|Insert|Session|Giac>. Note that you may also use <name|Giac> as a
10 scripting language in ordinary documents.
11
12 <\session|giac|default>
13 <\output>
14 <hrule>
15
16 Giac 1.7.0 for TeXmacs, released under the GPL license (3.0)
17
18 See www.gnu.org for license details
19
20 May contain BSD licensed software parts (lapack, atlas, tinymt)
21
22 \<copyright\> 2003\U2021 B. Parisse & al (giac), J. van der Hoeven
23 (TeXmacs), L. Marohni¢ (interface)
24
25 <hrule>
26
27 Xcas (C-like) syntax mode
28
29 Type ? for documentation or ?commandname for help on commandname
30
31 Type tabulation key to complete a partial command
32 </output>
33
34 <\unfolded-io>
35 \<gtr\>\
36 <|unfolded-io>
37 f(x):=x*sin(x)
38 <|unfolded-io>
39 <\equation*>
40 x\<mapsto\>x*sin <around*|\<nobracket\>|x|\<nobracket\>>
41 </equation*>
42
43 <\errput>
44 // Parsing f
45
46 // Success
47
48 // compiling f
49 </errput>
50 </unfolded-io>
51
52 <\textput>
53 Some basic calculus examples:
54 </textput>
55
56 <\unfolded-io>
57 \<gtr\>\
58 <|unfolded-io>
59 diff(f(x),x,2)
60 <|unfolded-io>
61 <\equation*>
62 -x*sin <around*|\<nobracket\>|x|\<nobracket\>>+2*cos
63 <around*|\<nobracket\>|x|\<nobracket\>>
64 </equation*>
65 </unfolded-io>
66
67 <\unfolded-io>
68 \<gtr\>\
69 <|unfolded-io>
70 integrate(f(x),x)
71 <|unfolded-io>
72 <\equation*>
73 -x*cos <around*|\<nobracket\>|x|\<nobracket\>>+sin
74 <around*|\<nobracket\>|x|\<nobracket\>>
75 </equation*>
76 </unfolded-io>
77
78 <\unfolded-io>
79 \<gtr\>\
80 <|unfolded-io>
81 integrate(f(x),x=0..pi)
82 <|unfolded-io>
83 <\equation*>
84 \<mathpi\>
85 </equation*>
86 </unfolded-io>
87
88 <\unfolded-io>
89 \<gtr\>\
90 <|unfolded-io>
91 integrate(sqrt(tan(x)),x)
92 <|unfolded-io>
93 <\equation*>
94 2*<around*|(|<frac|1|8>*<sqrt|2>*ln <around*|(|tan
95 <around*|\<nobracket\>|x|\<nobracket\>>-<sqrt|2>*<sqrt|tan
96 <around*|\<nobracket\>|x|\<nobracket\>>>+1|)>+<frac|1|4>*<sqrt|2>*arctan
97 <around*|(|<frac|2*<around*|(|<sqrt|tan
98 <around*|\<nobracket\>|x|\<nobracket\>>>-<frac|<sqrt|2>|2>|)>|<sqrt|2>>|)>-<frac|1|8>*<sqrt|2>*ln
99 <around*|(|tan <around*|\<nobracket\>|x|\<nobracket\>>+<sqrt|2>*<sqrt|tan
100 <around*|\<nobracket\>|x|\<nobracket\>>>+1|)>+<frac|1|4>*<sqrt|2>*arctan
101 <around*|(|<frac|2*<around*|(|<sqrt|tan
102 <around*|\<nobracket\>|x|\<nobracket\>>>+<frac|<sqrt|2>|2>|)>|<sqrt|2>>|)>|)>
103 </equation*>
104 </unfolded-io>
105
106 <\unfolded-io>
107 \<gtr\>\
108 <|unfolded-io>
109 g(x,y):=(1+x*y)/(1+sqrt(x))
110 <|unfolded-io>
111 <\equation*>
112 <around*|(|x,y|)>\<mapsto\><frac|1+x*y|1+<sqrt|x>>
113 </equation*>
114
115 <\errput>
116 // Parsing g
117
118 // Success
119
120 // compiling g
121 </errput>
122 </unfolded-io>
123
124 <\unfolded-io>
125 \<gtr\>\
126 <|unfolded-io>
127 simplify(diff(g(x,y),x,x,y))
128 <|unfolded-io>
129 <\equation*>
130 <frac|-<sqrt|x>-3|4*x<rsup|2>+12*x*<sqrt|x>+12*x+4*<sqrt|x>>
131 </equation*>
132 </unfolded-io>
133
134 <\unfolded-io>
135 \<gtr\>\
136 <|unfolded-io>
137 simplify(hessian(g(x,y),[x,y]))
138 <|unfolded-io>
139 <\equation*>
140 <matrix|<tformat|<table|<row|<cell|<frac|-x*y*<sqrt|x>-3*x*y+3*<sqrt|x>+1|4*x<rsup|3>+12*x<rsup|2>*<sqrt|x>+12*x<rsup|2>+4*x*<sqrt|x>>>|<cell|<frac|<sqrt|x>+2|2*x+4*<sqrt|x>+2>>>|<row|<cell|<frac|<sqrt|x>+2|2*x+4*<sqrt|x>+2>>|<cell|0>>>>>
141 </equation*>
142 </unfolded-io>
143
144 <\textput>
145 Plots and charts:
146 </textput>
147
148 <\unfolded-io>
149 \<gtr\>\
150 <|unfolded-io>
151 plot(sin(x)/x,x=0..10)
152 <|unfolded-io>
153 <htab|><image|giac-demo.en-image-1.pdf|0.618par|||><htab|>
154 </unfolded-io>
155
156 <\unfolded-io>
157 \<gtr\>\
158 <|unfolded-io>
159 plot3d(sin(sqrt(x^2+y^2))/sqrt(x^2+y^2),x=-10..10,y=-10..10)
160 <|unfolded-io>
161 <htab|><image|giac-demo.en-image-2.pdf|0.618par|||><htab|>
162 </unfolded-io>
163
164 <\unfolded-io>
165 \<gtr\>\
166 <|unfolded-io>
167 bar_plot([[2,"Yesterday","Today"],["A",2,5],["B",5,6],["C",7,7]])
168 <|unfolded-io>
169 <htab|><image|giac-demo.en-image-3.pdf|0.618par|||><htab|>
170 </unfolded-io>
171
172 <\unfolded-io>
173 \<gtr\>\
174 <|unfolded-io>
175 camembert([["France",6],["Allemagne",12],["Suisse",5]])
176 <|unfolded-io>
177 <htab|><image|giac-demo.en-image-4.pdf|0.618par|||><htab|>
178 </unfolded-io>
179
180 <\unfolded-io>
181 \<gtr\>\
182 <|unfolded-io>
183 histogram(seq(rand(1000),k,0,100),0,100)
184 <|unfolded-io>
185 <htab|><image|giac-demo.en-image-5.pdf|0.618par|||><htab|>
186 </unfolded-io>
187
188 <\textput>
189 <abbr|2D> geometry example:
190 </textput>
191
192 <\unfolded-io>
193 \<gtr\>\
194 <|unfolded-io>
195 P1:=point(3,4); P2:=point(6,2); P3:=point(4,3);
196
197 Sq:=square(P1,P2,color=blue);
198
199 Cr:=circle(P3,2);
200
201 Q:=inter(Sq,Cr);
202
203 T1:=tangent(Cr,Q[0],color=magenta);
204
205 T2:=tangent(Cr,Q[1],color=green)
206 <|unfolded-io>
207 <htab|><image|giac-demo.en-image-6.pdf|0.618par|||><htab|>
208 </unfolded-io>
209
210 <\textput>
211 Graph drawing example:
212 </textput>
213
214 <\unfolded-io>
215 \<gtr\>\
216 <|unfolded-io>
217 G:=graph("groetzsch")
218 <|unfolded-io>
219 <\equation*>
220 <text|an undirected unweighted graph with 11 vertices and 20 edges>
221 </equation*>
222 </unfolded-io>
223
224 <\unfolded-io>
225 \<gtr\>\
226 <|unfolded-io>
227 draw_graph(highlight_vertex(G,vertices(G),greedy_color(G)))
228 <|unfolded-io>
229 <htab|><image|giac-demo.en-image-7.pdf|0.618par|||><htab|>
230 </unfolded-io>
231 </session>
232
233 <name|Giac> plugin has a good support for mathematical input mode. Besides
234 the usual algebraic expressions, the following standard notations are
235 supported:
236
237 <\itemize-dot>
238 <item>(partial) derivatives
239
240 <item>integrals, sums and products
241
242 <item>limits
243
244 <item>piecewise defined functions
245
246 <item>simplified notation for powers of trigonometric and other
247 elementary functions (e.g. <math|sin<rsup|2>
248 <around*|\<nobracket\>|x|\<nobracket\>>>)
249
250 <item>absolute values, floor, ceiling
251
252 <item>sets, lists, and matrices
253
254 <item>special functions
255
256 <item>complex conjugates, real and imaginary parts
257 </itemize-dot>
258
259 Note that <name|Giac> output (or a part of it) can be selected and copied
260 to an input field.
261
262 Parentheses around function arguments are mandatory in <name|Giac>.
263 However, in <TeXmacs> mathematical input mode one can enter hidden
264 parentheses by pressing <key|(> <key|Tab>, which work the same as the
265 ordinary ones. Therefore it is possible to enter e.g.<nbsp><math|sin
266 <around*|\<nobracket\>|x|\<nobracket\>>> (note the hidden parentheses
267 around <math|x>!) instead of <math|sin <around*|(|x|)>>.
268
269 When entering derivatives, the function application symbol (entered by
270 pressing <key|Space>) between the derivative operator and the argument is
271 mandatory, as well as the (hidden) parentheses around the argument.
272
273 In the following examples we switch to the mathematical input mode.
274
275 <\session|giac|default>
276 <\textput>
277 Hidden parentheses example:
278 </textput>
279
280 <\unfolded-io-math>
281 \<gtr\>\
282 <|unfolded-io-math>
283 sin <around*|\<nobracket\>|\<pi\>|\<nobracket\>>
284 <|unfolded-io-math>
285 <\equation*>
286 0
287 </equation*>
288 </unfolded-io-math>
289
290 <\textput>
291 Derivatives:
292 </textput>
293
294 <\unfolded-io-math>
295 \<gtr\>\
296 <|unfolded-io-math>
297 <frac|\<mathd\><rsup|2>|\<mathd\> x<rsup|2>> <around*|(|x*ln
298 <around*|\<nobracket\>|x|\<nobracket\>>-<frac|1|1-x>|)>
299 <|unfolded-io-math>
300 <\equation*>
301 <frac|x<rsup|3>-3*x<rsup|2>+5*x-1|x<rsup|4>-3*x<rsup|3>+3*x<rsup|2>-x>
302 </equation*>
303 </unfolded-io-math>
304
305 <\unfolded-io-math>
306 \<gtr\>\
307 <|unfolded-io-math>
308 collect <around*|(|<frac|\<partial\><rsup|3>|\<partial\> x*\<partial\>
309 y<rsup|2>> <around*|(|<frac|y*\<mathe\><rsup|-x>|x<rsup|2>+y<rsup|2>>|)>|)>
310 <|unfolded-io-math>
311 <\equation*>
312 <frac|2*y*<around*|(|3*x<rsup|4>+12*x<rsup|3>+2*x<rsup|2>*y<rsup|2>-12*x*y<rsup|2>-y<rsup|4>|)>*\<mathe\><rsup|-x>|<around*|(|y<rsup|2>+x<rsup|2>|)><rsup|4>>
313 </equation*>
314 </unfolded-io-math>
315
316 <\textput>
317 Limits:
318 </textput>
319
320 <\unfolded-io-math>
321 \<gtr\>\
322 <|unfolded-io-math>
323 lim<rsub|x\<rightarrow\>0> <around*|\<nobracket\>|<frac|1-<frac|1|2>*x<rsup|2>-cos
324 <around*|(|<frac|x|1-x<rsup|2>>|)>|x<rsup|4>>|\<nobracket\>>
325 <|unfolded-io-math>
326 <\equation*>
327 <frac|23|24>
328 </equation*>
329 </unfolded-io-math>
330
331 <\unfolded-io-math>
332 \<gtr\>\
333 <|unfolded-io-math>
334 lim<rsub|x\<rightarrow\>0<rsup|+>> <around*|\<nobracket\>|\<mathe\><rsup|-1/x>|\<nobracket\>>
335 <|unfolded-io-math>
336 <\equation*>
337 0
338 </equation*>
339 </unfolded-io-math>
340
341 <\textput>
342 Integrals, sums, and products:
343 </textput>
344
345 <\unfolded-io-math>
346 \<gtr\>\
347 <|unfolded-io-math>
348 <big|int><frac|1|<around*|(|x<rsup|2>+9|)><rsup|3>>*\<mathd\> x
349 <|unfolded-io-math>
350 <\equation*>
351 <frac|x<rsup|3>+15*x|216*<around*|(|x<rsup|2>+9|)><rsup|2>>+<frac|arctan
352 <around*|(|<frac|x|3>|)>|648>
353 </equation*>
354 </unfolded-io-math>
355
356 <\unfolded-io-math>
357 \<gtr\>\
358 <|unfolded-io-math>
359 <big|int><rsub|-\<infty\>><rsup|+\<infty\>>\<mathe\><rsup|-x<rsup|2>>*\<mathd\>
360 x
361 <|unfolded-io-math>
362 <\equation*>
363 <sqrt|\<mathpi\>>
364 </equation*>
365 </unfolded-io-math>
366
367 <\unfolded-io-math>
368 \<gtr\>\
369 <|unfolded-io-math>
370 <big|sum><rsub|k=1><rsup|+\<infty\>><frac|1|1+\<mathpi\><rsup|2>*k<rsup|2>>
371 <|unfolded-io-math>
372 <\equation*>
373 <frac|1|\<mathe\><rsup|2>-1>
374 </equation*>
375 </unfolded-io-math>
376
377 <\unfolded-io-math>
378 \<gtr\>\
379 <|unfolded-io-math>
380 trigsimplify <around*|(|2<rsup|10>*sin
381 <around*|\<nobracket\>|<frac|x|2<rsup|10>>|\<nobracket\>>*<big|prod><rsub|k=1><rsup|10><around*|\<nobracket\>|cos
382 |\<nobracket\>><frac|x|2<rsup|k>>|)>
383 <|unfolded-io-math>
384 <\equation*>
385 sin <around*|\<nobracket\>|x|\<nobracket\>>
386 </equation*>
387 </unfolded-io-math>
388
389 <\textput>
390 Simplification:
391 </textput>
392
393 <\unfolded-io-math>
394 \<gtr\>\
395 <|unfolded-io-math>
396 simplify <around*|(|<sqrt|5+2*<sqrt|6>>+<sqrt|9-2*<sqrt|6>-4*<sqrt|5-2*<sqrt|6>>>|)>
397 <|unfolded-io-math>
398 <\equation*>
399 2*<sqrt|2>+2
400 </equation*>
401 </unfolded-io-math>
402
403 <\unfolded-io-math>
404 \<gtr\>\
405 <|unfolded-io-math>
406 simplify <around*|(|cot <around*|(|atan <around*|(|<frac|12|13>|)>+acos
407 <around*|(|<frac|4|5>|)>|)>|)>
408 <|unfolded-io-math>
409 <\equation*>
410 <frac|16|87>
411 </equation*>
412 </unfolded-io-math>
413
414 <\unfolded-io-math>
415 \<gtr\>\
416 <|unfolded-io-math>
417 normal <around*|(|1+x-<frac|1-x|1-x<rsup|2>>|)>
418 <|unfolded-io-math>
419 <\equation*>
420 <frac|x<rsup|2>+2*x|x+1>
421 </equation*>
422 </unfolded-io-math>
423
424 <\unfolded-io-math>
425 \<gtr\>\
426 <|unfolded-io-math>
427 trigsimplify <around*|(|1-<frac|1|4>*sin<rsup|2>
428 <around*|(|2*x|)>-sin<rsup|2> <around*|\<nobracket\>|y|\<nobracket\>>-cos<rsup|4>
429 <around*|\<nobracket\>|x|\<nobracket\>>|)>
430 <|unfolded-io-math>
431 <\equation*>
432 sin<rsup|2> <around*|\<nobracket\>|x|\<nobracket\>>-sin<rsup|2>
433 <around*|\<nobracket\>|y|\<nobracket\>>
434 </equation*>
435 </unfolded-io-math>
436
437 <\textput>
438 Equation solving:
439 </textput>
440
441 <\unfolded-io-math>
442 \<gtr\>\
443 <|unfolded-io-math>
444 solve<around*|(|x<rsup|3>-x+1-<frac|1|2-x<rsup|2>>=0,x|)>
445 <|unfolded-io-math>
446 <\equation*>
447 <around*|[|<frac|-<sqrt|5>-1|2>,-1,<frac|<sqrt|5>-1|2>,1|]>
448 </equation*>
449 </unfolded-io-math>
450
451 <\unfolded-io-math>
452 \<gtr\>\
453 <|unfolded-io-math>
454 linsolve <around*|(|<around*|[|x+y=2,x-2*y=3|]>,<around*|[|x,y|]>|)>
455 <|unfolded-io-math>
456 <\equation*>
457 <around*|[|<frac|7|3>,-<frac|1|3>|]>
458 </equation*>
459 </unfolded-io-math>
460
461 <\unfolded-io-math>
462 \<gtr\>\
463 <|unfolded-io-math>
464 fsolve <around*|(|x=\<mathe\><rsup|-x>,x=0|)>
465 <|unfolded-io-math>
466 <\equation*>
467 0.56714329041
468 </equation*>
469 </unfolded-io-math>
470
471 <\unfolded-io-math>
472 \<gtr\>\
473 <|unfolded-io-math>
474 csolve <around*|(|z<rsup|2>\<cdot\><wide|z|\<bar\>>=\<Re\>
475 <around*|(|z|)>-8*\<mathi\>,z|)>
476 <|unfolded-io-math>
477 <\equation*>
478 <around*|[|-2*\<mathi\>|]>
479 </equation*>
480 </unfolded-io-math>
481
482 <\textput>
483 Solving ordinary differential equations (note that various notational
484 formats are supported):
485 </textput>
486
487 <\unfolded-io-math>
488 \<gtr\>\
489 <|unfolded-io-math>
490 dsolve <around*|(|<frac|\<mathd\><rsup|2> y|\<mathd\>
491 x<rsup|2>>-y=2*sin <around*|\<nobracket\>|x|\<nobracket\>>,x,y|)>
492 <|unfolded-io-math>
493 <\equation*>
494 c\<nosymbol\><rsub|0>*\<mathe\><rsup|x>+c\<nosymbol\><rsub|1>*\<mathe\><rsup|-x>-sin
495 <around*|\<nobracket\>|x|\<nobracket\>>
496 </equation*>
497 </unfolded-io-math>
498
499 <\unfolded-io-math>
500 \<gtr\>\
501 <|unfolded-io-math>
502 dsolve <around*|(|<wide|x|\<ddot\>>=x,t,x|)>
503 <|unfolded-io-math>
504 <\equation*>
505 c\<nosymbol\><rsub|0>*\<mathe\><rsup|t>+c\<nosymbol\><rsub|1>*\<mathe\><rsup|-t>
506 </equation*>
507 </unfolded-io-math>
508
509 <\unfolded-io-math>
510 \<gtr\>\
511 <|unfolded-io-math>
512 dsolve <around*|(|y<rprime|''>-y=2*sin
513 <around*|\<nobracket\>|x|\<nobracket\>>\<wedge\>y<around*|(|0|)>=0\<wedge\>y<rprime|'><around*|(|0|)>=1,x,y|)>
514 <|unfolded-io-math>
515 <\equation*>
516 \<mathe\><rsup|x>-\<mathe\><rsup|-x>-sin
517 <around*|\<nobracket\>|x|\<nobracket\>>
518 </equation*>
519 </unfolded-io-math>
520
521 <\unfolded-io-math>
522 \<gtr\>\
523 <|unfolded-io-math>
524 simplify <around*|(|dsolve <around*|(|y<rsup|<around*|(|3|)>>=8*y,t,y|)>|)>
525 <|unfolded-io-math>
526 <\equation*>
527 <frac|c\<nosymbol\><rsub|0>*<around*|(|\<mathe\><rsup|t>|)><rsup|3>*tan<rsup|2>
528 <around*|(|<frac|1|2>*t*<sqrt|3>|)>+c\<nosymbol\><rsub|0>*<around*|(|\<mathe\><rsup|t>|)><rsup|3>-c\<nosymbol\><rsub|1>*tan<rsup|2>
529 <around*|(|<frac|1|2>*t*<sqrt|3>|)>+c\<nosymbol\><rsub|1>+2*c\<nosymbol\><rsub|2>*tan
530 <around*|(|<frac|1|2>*t*<sqrt|3>|)>|\<mathe\><rsup|t>*tan<rsup|2>
531 <around*|(|<frac|1|2>*t*<sqrt|3>|)>+\<mathe\><rsup|t>>
532 </equation*>
533 </unfolded-io-math>
534
535 <\textput>
536 Solving inequalities in one variable:
537 </textput>
538
539 <\unfolded-io-math>
540 \<gtr\>\
541 <|unfolded-io-math>
542 solve <around*|(|x-<around*|\||x-<around*|\||x<rsup|2>-3*x-2|\|>|\|>-1\<gtr\>0,x|)>
543 <|unfolded-io-math>
544 <\equation*>
545 <around*|[|x\<gtr\><frac|<sqrt|13>+1|2>\<wedge\>x\<less\><frac|<sqrt|13>+3|2>,x\<gtr\><frac|<sqrt|21>+3|2>\<wedge\>x\<less\><frac|<sqrt|29>+5|2>,<frac|<sqrt|29>+5|2>|]>
546 </equation*>
547 </unfolded-io-math>
548
549 <\unfolded-io-math>
550 \<gtr\>\
551 <|unfolded-io-math>
552 domain <around*|(|<sqrt|3-<sqrt|2-<sqrt|1-x>>>,x|)>
553 <|unfolded-io-math>
554 <\equation*>
555 x\<geqslant\>-3\<wedge\>x\<leqslant\>1
556 </equation*>
557 </unfolded-io-math>
558
559 <\textput>
560 Vectors and matrices (note that double symbols such as <verbatim|AA>
561 and <verbatim|vv> are interpreted as bold symbols in <TeXmacs> and vice
562 versa):
563 </textput>
564
565 <\unfolded-io-math>
566 \<gtr\>\
567 <|unfolded-io-math>
568 \<b-up-A\>\<assign\>hilbert <around*|(|3|)>
569 <|unfolded-io-math>
570 <\equation*>
571 <matrix|<tformat|<table|<row|<cell|1>|<cell|<frac|1|2>>|<cell|<frac|1|3>>>|<row|<cell|<frac|1|2>>|<cell|<frac|1|3>>|<cell|<frac|1|4>>>|<row|<cell|<frac|1|3>>|<cell|<frac|1|4>>|<cell|<frac|1|5>>>>>>
572 </equation*>
573 </unfolded-io-math>
574
575 <\unfolded-io-math>
576 \<gtr\>\
577 <|unfolded-io-math>
578 det <around*|(|\<b-up-A\>|)>
579 <|unfolded-io-math>
580 <\equation*>
581 <frac|1|2160>
582 </equation*>
583 </unfolded-io-math>
584
585 <\unfolded-io-math>
586 \<gtr\>\
587 <|unfolded-io-math>
588 \<b-up-v\>\<assign\><around*|[|1,2,3|]>
589 <|unfolded-io-math>
590 <\equation*>
591 <around*|[|1,2,3|]>
592 </equation*>
593 </unfolded-io-math>
594
595 <\unfolded-io-math>
596 \<gtr\>\
597 <|unfolded-io-math>
598 <around*|\<\|\|\>|\<b-up-v\>|\<\|\|\>>
599 <|unfolded-io-math>
600 <\equation*>
601 <sqrt|14>
602 </equation*>
603 </unfolded-io-math>
604
605 <\textput>
606 If <math|A> is a matrix, then its element <math|a<rsub|i\<nocomma\>j>>
607 can be obtained by using the usual notation. Note that the indices in
608 the subscript must be enclosed within invisible parentheses and
609 separated by (invisible) comma.
610 </textput>
611
612 <\unfolded-io-math>
613 \<gtr\>\
614 <|unfolded-io-math>
615 \<b-up-A\><rsub|<around*|\<nobracket\>|2\<nocomma\>1|\<nobracket\>>>
616 <|unfolded-io-math>
617 <\equation*>
618 <frac|1|4>
619 </equation*>
620 </unfolded-io-math>
621
622 <\unfolded-io-math>
623 \<gtr\>\
624 <|unfolded-io-math>
625 \<b-up-v\><rsub|<around*|\<nobracket\>|1|\<nobracket\>>>+\<b-up-v\><rsub|<around*|\<nobracket\>|2|\<nobracket\>>>
626 <|unfolded-io-math>
627 <\equation*>
628 5
629 </equation*>
630 </unfolded-io-math>
631
632 <\textput>
633 Finite sequences, lists, and sets can be generated as in the examples
634 below. The symbol <math|\<barsuchthat\>> is entered by pressing
635 <key|\|><key|Tab><key|Tab><key|Tab><key|Tab> and it corresponds to the
636 <verbatim|$> operator in Giac, which has a very high priority.
637 Therefore the compound expressions on both sides of
638 <math|\<barsuchthat\>> should be surrounded by hidden parentheses.
639 </textput>
640
641 <\unfolded-io-math>
642 \<gtr\>\
643 <|unfolded-io-math>
644 euler <around*|(|k|)>\<barsuchthat\><around*|\<nobracket\>|k=1\<ldots\>20|\<nobracket\>>
645 <|unfolded-io-math>
646 <\equation*>
647 1,1,2,2,4,2,6,4,6,4,10,4,12,6,8,8,16,6,18,8
648 </equation*>
649 </unfolded-io-math>
650
651 <\unfolded-io-math>
652 \<gtr\>\
653 <|unfolded-io-math>
654 <around*|[|ithprime <around*|(|j|)>\<barsuchthat\><around*|\<nobracket\>|j=1\<ldots\>20|\<nobracket\>>|]>
655 <|unfolded-io-math>
656 <\equation*>
657 <around*|[|2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71|]>
658 </equation*>
659 </unfolded-io-math>
660
661 <\unfolded-io-math>
662 \<gtr\>\
663 <|unfolded-io-math>
664 A\<assign\><around*|{|k<rsup|2>\<barsuchthat\><around*|\<nobracket\>|k=1\<ldots\>10|\<nobracket\>>|}>
665 <|unfolded-io-math>
666 <\equation*>
667 <around*|{|1,4,9,16,25,36,49,64,81,100|}>
668 </equation*>
669 </unfolded-io-math>
670
671 <\unfolded-io-math>
672 \<gtr\>\
673 <|unfolded-io-math>
674 B\<assign\><around*|{|<around*|\<nobracket\>|1+8*k|\<nobracket\>>\<barsuchthat\><around*|\<nobracket\>|k=1\<ldots\>10|\<nobracket\>>|}>
675 <|unfolded-io-math>
676 <\equation*>
677 <around*|{|9,17,25,33,41,49,57,65,73,81|}>
678 </equation*>
679 </unfolded-io-math>
680
681 <\unfolded-io-math>
682 \<gtr\>\
683 <|unfolded-io-math>
684 C\<assign\><around*|{|9,18,27|}>
685 <|unfolded-io-math>
686 <\equation*>
687 <around*|{|9,18,27|}>
688 </equation*>
689 </unfolded-io-math>
690
691 <\textput>
692 Set operations:
693 </textput>
694
695 <\unfolded-io-math>
696 \<gtr\>\
697 <|unfolded-io-math>
698 <around*|(|A\<cap\> B|)>\<cup\> C
699 <|unfolded-io-math>
700 <\equation*>
701 <around*|{|9,25,49,81,18,27|}>
702 </equation*>
703 </unfolded-io-math>
704
705 <\unfolded-io-math>
706 \<gtr\>\
707 <|unfolded-io-math>
708 A\<setminus\>B
709 <|unfolded-io-math>
710 <\equation*>
711 <around*|{|1,4,16,36,64,100|}>
712 </equation*>
713 </unfolded-io-math>
714
715 <\textput>
716 Using the notation <math|a\<in\>A> we get the 1-based index of the
717 element <math|a> in the set <math|A>, or 0 if <math|a\<nin\>A>:
718 </textput>
719
720 <\unfolded-io-math>
721 \<gtr\>\
722 <|unfolded-io-math>
723 19\<in\> A
724 <|unfolded-io-math>
725 <\equation*>
726 0
727 </equation*>
728 </unfolded-io-math>
729
730 <\unfolded-io-math>
731 \<gtr\>\
732 <|unfolded-io-math>
733 57\<in\> B
734 <|unfolded-io-math>
735 <\equation*>
736 7
737 </equation*>
738 </unfolded-io-math>
739
740 <\textput>
741 Binomial coefficients are entered using the <markup|binom> tag:
742 </textput>
743
744 <\unfolded-io-math>
745 \<gtr\>\
746 <|unfolded-io-math>
747 <binom|49|6>
748 <|unfolded-io-math>
749 <\equation*>
750 13983816
751 </equation*>
752 </unfolded-io-math>
753
754 <\unfolded-io-math>
755 \<gtr\>\
756 <|unfolded-io-math>
757 assume <around*|(|n,integer|)>;additionally
758 <around*|(|n\<geqslant\>2|)>
759 <|unfolded-io-math>
760 <\equation*>
761 \<bbb-Z\>,n
762 </equation*>
763 </unfolded-io-math>
764
765 <\unfolded-io-math>
766 \<gtr\>\
767 <|unfolded-io-math>
768 <binom|n|2>
769 <|unfolded-io-math>
770 <\equation*>
771 <frac|n!|2\<cdot\><around*|(|n-2|)>!>
772 </equation*>
773 </unfolded-io-math>
774
775 <\textput>
776 Composition of functions:
777 </textput>
778
779 <\unfolded-io-math>
780 \<gtr\>\
781 <|unfolded-io-math>
782 <around*|(|cos\<circ\>sin|)><around*|(|\<mathpi\>|)>
783 <|unfolded-io-math>
784 <\equation*>
785 1
786 </equation*>
787 </unfolded-io-math>
788
789 <\unfolded-io-math>
790 \<gtr\>\
791 <|unfolded-io-math>
792 f\<assign\>x\<mapsto\>x<rsup|2>+1
793 <|unfolded-io-math>
794 <\equation*>
795 x\<mapsto\>x<rsup|2>+1
796 </equation*>
797
798 <\errput>
799 // Success
800
801 // End defining f
802 </errput>
803 </unfolded-io-math>
804
805 <\unfolded-io-math>
806 \<gtr\>\
807 <|unfolded-io-math>
808 g\<assign\>y\<mapsto\>y-1
809 <|unfolded-io-math>
810 <\equation*>
811 y\<mapsto\>y-1
812 </equation*>
813
814 <\errput>
815 // Success
816
817 // End defining g
818 </errput>
819 </unfolded-io-math>
820
821 <\unfolded-io-math>
822 \<gtr\>\
823 <|unfolded-io-math>
824 <around*|(|f\<circ\>g|)><around*|(|u|)>
825 <|unfolded-io-math>
826 <\equation*>
827 <around*|(|u-1|)><rsup|2>+1
828 </equation*>
829 </unfolded-io-math>
830
831 <\unfolded-io-math>
832 \<gtr\>\
833 <|unfolded-io-math>
834 <around*|(|g\<circ\>f|)><around*|(|v|)>
835 <|unfolded-io-math>
836 <\equation*>
837 v<rsup|2>
838 </equation*>
839 </unfolded-io-math>
840
841 <\textput>
842 Conditionals:
843 </textput>
844
845 <\unfolded-io-math>
846 \<gtr\>\
847 <|unfolded-io-math>
848 1\<longequal\>2
849 <|unfolded-io-math>
850 <\equation*>
851 false
852 </equation*>
853 </unfolded-io-math>
854
855 <\unfolded-io-math>
856 \<gtr\>\
857 <|unfolded-io-math>
858 1\<neq\>2
859 <|unfolded-io-math>
860 <\equation*>
861 true
862 </equation*>
863 </unfolded-io-math>
864
865 <\unfolded-io-math>
866 \<gtr\>\
867 <|unfolded-io-math>
868 1\<less\>2
869 <|unfolded-io-math>
870 <\equation*>
871 true
872 </equation*>
873 </unfolded-io-math>
874
875 <\unfolded-io-math>
876 \<gtr\>\
877 <|unfolded-io-math>
878 1\<geqslant\>2
879 <|unfolded-io-math>
880 <\equation*>
881 false
882 </equation*>
883 </unfolded-io-math>
884
885 <\textput>
886 Polynomials may be entered as lists of coefficients with double-struck
887 brackets:
888 </textput>
889
890 <\unfolded-io-math>
891 \<gtr\>\
892 <|unfolded-io-math>
893 p\<assign\><around*|\<llbracket\>|-1,3,2|\<rrbracket\>>
894 <|unfolded-io-math>
895 <\equation*>
896 <around*|\<llbracket\>|-1,3,2|\<rrbracket\>>
897 </equation*>
898 </unfolded-io-math>
899
900 <\unfolded-io-math>
901 \<gtr\>\
902 <|unfolded-io-math>
903 expand <around*|(|poly2symb <around*|(|p,x|)>|)>
904 <|unfolded-io-math>
905 <\equation*>
906 -x<rsup|2>+3*x+2
907 </equation*>
908 </unfolded-io-math>
909
910 <\unfolded-io-math>
911 \<gtr\>\
912 <|unfolded-io-math>
913 q\<assign\><around*|\<llbracket\>|2,0,-2,1|\<rrbracket\>>
914 <|unfolded-io-math>
915 <\equation*>
916 <around*|\<llbracket\>|2,0,-2,1|\<rrbracket\>>
917 </equation*>
918 </unfolded-io-math>
919
920 <\unfolded-io-math>
921 \<gtr\>\
922 <|unfolded-io-math>
923 p\<cdot\>q
924 <|unfolded-io-math>
925 <\equation*>
926 <around*|\<llbracket\>|-2,6,6,-7,-1,2|\<rrbracket\>>
927 </equation*>
928 </unfolded-io-math>
929
930 <\unfolded-io-math>
931 \<gtr\>\
932 <|unfolded-io-math>
933 p+q
934 <|unfolded-io-math>
935 <\equation*>
936 <around*|\<llbracket\>|2,-1,1,3|\<rrbracket\>>
937 </equation*>
938 </unfolded-io-math>
939
940 <\textput>
941 Piecewise functions can be entered by using the <markup|choice> tag
942 (note that any textual condition, i.e.<nbsp>a <markup|text> tag, is
943 interpreted as \Potherwise\Q, no matter of its contents):
944 </textput>
945
946 <\unfolded-io-math>
947 \<gtr\>\
948 <|unfolded-io-math>
949 f <around*|(|x|)>\<assign\><choice|<tformat|<table|<row|<cell|0,>|<cell|x\<less\>0>>|<row|<cell|x,>|<cell|x\<less\>1>>|<row|<cell|1,>|<cell|x\<less\>3>>|<row|<cell|\<mathe\><rsup|3-x>,>|<cell|<text|in
950 all other cases>>>>>>
951 <|unfolded-io-math>
952 <\equation*>
953 x\<mapsto\><choice|<tformat|<table|<row|<cell|0,>|<cell|x\<less\>0>>|<row|<cell|x,>|<cell|x\<less\>1>>|<row|<cell|1,>|<cell|x\<less\>3>>|<row|<cell|\<mathe\><rsup|3-x>,>|<cell|<text|otherwise>>>>>>
954 </equation*>
955
956 <\errput>
957 // Parsing f
958
959 // Success
960
961 // compiling f
962 </errput>
963 </unfolded-io-math>
964
965 <\textput>
966 Periodic functions can be entered as well:
967 </textput>
968
969 <\unfolded-io-math>
970 \<gtr\>\
971 <|unfolded-io-math>
972 h\<assign\>periodic <around*|(|<around*|(|1-x<rsup|4>|)>*\<mathe\><rsup|1-x<rsup|3>>,x=-1\<ldots\>1|)>
973 <|unfolded-io-math>
974 <\equation*>
975 <around*|(|1-<around*|(|x-2*<around*|\<lfloor\>|<frac|x+1|2>|\<rfloor\>>|)><rsup|4>|)>*\<mathe\><rsup|1-<around*|(|x-2*<around*|\<lfloor\>|<frac|x+1|2>|\<rfloor\>>|)><rsup|3>>
976 </equation*>
977 </unfolded-io-math>
978 </session>
979 </body>
980
981 <initial|<\collection>
982 </collection>>