Rev 2448 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2448 | Rev 4091 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | - | ||
2 | <center><h3>Examples of interactive exercises under OEF format</h3></center> <p> |
- | |
3 | - | ||
4 | Here are some exampls of interactive exercises one can create by Createxo. |
- | |
5 | <ol> |
- | |
6 | <p><hr width="50%"> <p> |
- | |
7 | <li> <b>Length of vector 2D</b>, a simple computation of the length of |
- | |
8 | a vector in the plane. Here is the complete source of this exercise. |
- | |
9 | - | ||
10 | <p><pre> |
- | |
11 | \title{Norm of vector 2D} |
- | |
12 | \language{en} |
- | |
13 | \computeanswer{no} |
- | |
14 | \format{html} |
- | |
15 | - | ||
16 | \integer{x=random(-10..10)} |
- | |
17 | \integer{y=random(-10..10)} |
- | |
18 | \real{norm=sqrt((\x)^2+(\y)^2)} |
- | |
19 | \statement{What is the length of the vector (\x,\y) in R<sup>2</sup>?} |
- | |
20 | - | ||
21 | \hint{The length of a vector (x,y) is equal to |
- | |
22 | sqrt(x^2+y^2).} |
- | |
23 | \answer{The length}{\norm} |
- | |
24 | </pre> <p> |
- | |
25 | - | ||
26 | In this exercise, one has defined 2 random integers, x et y, who are the |
- | |
27 | coordinates of the vector. Then a third parameter, this time real, is defined |
- | |
28 | by the formula of the length. The exercise takes a freestyle reply under the |
- | |
29 | name of ``the length'', and the good reply should be the value of the third |
- | |
30 | parameter``norm''. A hint is prepared in the exercise, which recalls the |
- | |
31 | formula of the length. <p> |
- | |
32 | You can |
- | |
33 |
|
1 | !!provisoire --to translate |
34 | !href cmd=reply&mode=guided&$parm load this example into the menu |
- | |
35 | to test it. (You can also copy the source into the menu under raw mode.) |
- | |
36 | - | ||
37 | <p><hr width="50%"> <p> |
- | |
38 | <li> <b>Trace of matrix 2x2</b>, computes the trace of a matrix. The question |
- | |
39 | is formatted by TeX, for a better presentation of the matrix. Here is |
- | |
40 | the complete source of the exercise. |
- | |
41 | <p><pre> |
- | |
42 | \title{Trace of matrix 2x2} |
- | |
43 | \language{en} |
- | |
44 | \computeanswer{yes} |
- | |
45 | \format{tex} |
- | |
46 | - | ||
47 | \integer{range=20} |
- | |
48 | \integer{a=random(-\range..\range)} |
- | |
49 | \integer{b=random(-\range..\range)} |
- | |
50 | \integer{c=random(-\range..\range)} |
- | |
51 | \integer{d=random(-\range..\range)} |
- | |
52 | \integer{trace=(\a)+(\d)} |
- | |
53 | \statement{Compute the trace of the matrix |
- | |
54 | $$\pmatrix{\a&\b\cr \c&\d}$$.} |
- | |
55 | - | ||
56 | \answer{The trace}{\trace} |
- | |
57 | </pre> <p> |
- | |
58 | We have first defined an integer ``range'', to be used to bound the |
- | |
59 | random values a,b,c,d which are the elements of the matrix. And the trace is |
- | |
60 | of course defined by the sum of the elements on the diagonal. Please take |
- | |
61 | care to the definition <tt>trace=(\a)+(\d)</tt>: the pairs of parentheses |
- | |
62 | are necessary, for the substitution is literary. If you define |
- | |
63 | <tt>trace=\a+\d</tt> and if a and d take the values of 3 and -15 respectively, |
- | |
64 | you woule have <tt>trace=3+-15</tt>, a bad mathematical expression. <p> |
- | |
65 | Remark that in this exercise, the non-computed replies are admitted |
- | |
66 | (such as 2+15 or 3*105). <p> |
- | |
67 | You can |
- | |
68 | ! |
2 | !changeto help/en/examples.phtml |
69 | !href cmd=reply&mode=guided&$parm load this example into the menu |
- | |
70 | to test it. (You can also copy the source into the menu under raw mode.) |
- | |
71 | - | ||
72 | - | ||
73 | </ol> |
- | |
74 | - |