Rev 6133 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6133 | Rev 11003 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | 3 | ||
4 | Here are some exampls of interactive exercises one can create by Createxo. |
4 | Here are some exampls of interactive exercises one can create by Createxo. |
5 | <ol> |
5 | <ol> |
6 | 6 | ||
7 | <li> |
7 | <li> |
8 | <hr style="width:50%"/> |
- | |
9 | <b>Length of vector 2D</b>, a simple computation of the length of |
8 | <b>Length of vector 2D</b>, a simple computation of the length of |
10 | a vector in the plane. Here is the complete source of this exercise. |
9 | a vector in the plane. Here is the complete source of this exercise. |
11 | 10 | ||
12 | <pre> |
11 | <pre> |
13 | \title{Norm of vector 2D} |
12 | \title{Norm of vector 2D} |
Line 18... | Line 17... | ||
18 | \integer{x=random(-10..10)} |
17 | \integer{x=random(-10..10)} |
19 | \integer{y=random(-10..10)} |
18 | \integer{y=random(-10..10)} |
20 | \real{norm=sqrt((\x)^2+(\y)^2)} |
19 | \real{norm=sqrt((\x)^2+(\y)^2)} |
21 | \statement{What is the length of the vector (\x,\y) in R<sup>2</sup>?} |
20 | \statement{What is the length of the vector (\x,\y) in R<sup>2</sup>?} |
22 | 21 | ||
23 | \hint{The length of a vector (x,y) is equal to |
22 | \hint{The length of a vector (x,y) is equal to |
24 | sqrt(x^2+y^2).} |
23 | sqrt(x^2+y^2).} |
25 | \answer{The length}{\norm} |
24 | \answer{The length}{\norm} |
26 | </pre> |
25 | </pre> |
27 | 26 | ||
28 | In this exercise, one has defined 2 random integers, x et y, who are the |
27 | In this exercise, one has defined 2 random integers, x et y, who are the |
Line 35... | Line 34... | ||
35 | !set parm=oef_answercnt=1&oef_choicecnt=0&oef_title=Norm of vector 2D&oef_format=html&oef_computeanswer=no&level=2&oef_parms=%5Cinteger%7Bx%3Drandom%28-10..10%29%7D%0D%0A%5Cinteger%7By%3Drandom%28-10..10%29%7D%0D%0A%5Creal%7Bnorm%3Dsqrt%28%28%5Cx%29%5E2%2B%28%5Cy%29%5E2%29%7D&oef_statement=What is the length of the vector %28%5Cx%2C%5Cy%29 in R%3Csup%3E2%3C%2Fsup%3E%3F&ansprompt1=The length&ansgood1=%5Cnorm&oef_hint=The length f a vector %28x%2Cy%29 is equal to %0D%0Asqrt%28x%5E2%2By%5E2%29.&oef_solution= $ |
34 | !set parm=oef_answercnt=1&oef_choicecnt=0&oef_title=Norm of vector 2D&oef_format=html&oef_computeanswer=no&level=2&oef_parms=%5Cinteger%7Bx%3Drandom%28-10..10%29%7D%0D%0A%5Cinteger%7By%3Drandom%28-10..10%29%7D%0D%0A%5Creal%7Bnorm%3Dsqrt%28%28%5Cx%29%5E2%2B%28%5Cy%29%5E2%29%7D&oef_statement=What is the length of the vector %28%5Cx%2C%5Cy%29 in R%3Csup%3E2%3C%2Fsup%3E%3F&ansprompt1=The length&ansgood1=%5Cnorm&oef_hint=The length f a vector %28x%2Cy%29 is equal to %0D%0Asqrt%28x%5E2%2By%5E2%29.&oef_solution= $ |
36 | !href cmd=reply&mode=guided&$parm load this example into the menu |
35 | !href cmd=reply&mode=guided&$parm load this example into the menu |
37 | to test it. (You can also copy the source into the menu under raw mode.) |
36 | to test it. (You can also copy the source into the menu under raw mode.) |
38 | </p> |
37 | </p> |
39 | </li> |
38 | </li> |
40 | <li |
39 | <li> |
41 | <b>Trace of matrix 2x2</b>, computes the trace of a matrix. The question |
40 | <b>Trace of matrix 2x2</b>, computes the trace of a matrix. The question |
42 | is formatted by TeX, for a better presentation of the matrix. Here is |
41 | is formatted by TeX, for a better presentation of the matrix. Here is |
43 | the complete source of the exercise. |
42 | the complete source of the exercise. |
44 | <pre> |
43 | <pre> |
45 | \title{Trace of matrix 2x2} |
44 | \title{Trace of matrix 2x2} |
46 | \language{en} |
45 | \language{en} |
47 | \computeanswer{yes} |
46 | \computeanswer{yes} |
48 | \format{ |
47 | \format{html} |
49 | 48 | ||
50 | \integer{range=20} |
49 | \integer{range=20} |
51 | \integer{a=random(-\range..\range)} |
50 | \integer{a=random(-\range..\range)} |
52 | \integer{b=random(-\range..\range)} |
51 | \integer{b=random(-\range..\range)} |
53 | \integer{c=random(-\range..\range)} |
52 | \integer{c=random(-\range..\range)} |
54 | \integer{d=random(-\range..\range)} |
53 | \integer{d=random(-\range..\range)} |
55 | \integer{trace=(\a)+(\d)} |
54 | \integer{trace=(\a)+(\d)} |
56 | \statement{Compute the trace of the matrix |
55 | \statement{Compute the trace of the matrix |
57 |
|
56 | \([\a,\b;\c,\d]\).} |
58 | 57 | ||
59 | \answer{The trace}{\trace} |
58 | \answer{The trace}{\trace} |
60 | </pre> |
59 | </pre> |
61 | We have first defined an integer ``range'', to be used to bound the |
60 | We have first defined an integer ``range'', to be used to bound the |
62 | random values a,b,c,d which are the elements of the matrix. And the trace is |
61 | random values a,b,c,d which are the elements of the matrix. And the trace is |
63 | of course defined by the sum of the elements on the diagonal. Please take |
62 | of course defined by the sum of the elements on the diagonal. Please take |
64 | care to the definition <span class="tt">trace=(\a)+(\d)</span>: the pairs of parentheses |
63 | care to the definition <span class="tt">trace=(\a)+(\d)</span>: the pairs of parentheses |
65 | are necessary, for the substitution is literary. If you define |
64 | are necessary, for the substitution is literary. If you define |
66 | <span class="tt">trace=\a+\d</span> and if a and d take the values of 3 and -15 respectively, |
65 | <span class="tt">trace=\a+\d</span> and if a and d take the values of 3 and -15 respectively, |
67 | you woule have <span class="tt">trace=3+-15</span>, a bad mathematical expression. <p> |
66 | you woule have <span class="tt">trace=3+-15</span>, a bad mathematical expression. <p> |
68 | Remark that in this exercise, the non-computed replies are admitted |
67 | Remark that in this exercise, the non-computed replies are admitted |
69 | (such as 2+15 or 3*105). <p> |
68 | (such as 2+15 or 3*105). <p> |
70 | You can |
69 | You can |
71 | !set parm=oef_answercnt=1&oef_choicecnt=0&oef_title=Trace of matrix 2x2&oef_format= |
70 | !set parm=oef_answercnt=1&oef_choicecnt=0&oef_title=Trace of matrix 2x2&oef_format=html&oef_computeanswer=yes&level=2&oef_parms=%5Cinteger%7Brange%3D20%7D%0D%0A%5Cinteger%7Ba%3Drandom%28-%5Crange..%5Crange%29%7D%0D%0A%5Cinteger%7Bb%3Drandom%28-%5Crange..%5Crange%29%7D%0D%0A%5Cinteger%7Bc%3Drandom%28-%5Crange..%5Crange%29%7D%0D%0A%5Cinteger%7Bd%3Drandom%28-%5Crange..%5Crange%29%7D%0D%0A%5Cinteger%7Btrace%3D%28%5Ca%29%2B%28%5Cd%29%7D&oef_statement=Compute the trace of the matrix \\([\a,\b;\c,\d]\\).&ansprompt1=The trace&ansgood1=%5Ctrace&oef_hint= &oef_solution= $ |
72 | !href cmd=reply&mode=guided&$parm load this example into the menu |
71 | !href cmd=reply&mode=guided&$parm load this example into the menu |
73 | to test it. (You can also copy the source into the menu under raw mode.) |
72 | to test it. (You can also copy the source into the menu under raw mode.) |
74 | 73 | ||
75 | </li> |
74 | </li> |
76 | </ol> |
75 | </ol> |