Rev 6133 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 6133 | Rev 11003 | ||
|---|---|---|---|
| Line 5... | Line 5... | ||
| 5 | 5 | ||
| 6 | Hier staan enkele voorbeelden van interactieve oefeningen gemaakt met Createxo |
6 | Hier staan enkele voorbeelden van interactieve oefeningen gemaakt met Createxo |
| 7 | <ol> |
7 | <ol> |
| 8 | 8 | ||
| 9 | <li> <hr style="width:50%"/> |
9 | <li> <hr style="width:50%"/> |
| 10 | <b>Lengte van een 2D vector </b>, |
10 | <b>Lengte van een 2D vector </b>, |
| 11 | een simpele berekening van de lengte van een vector in het platte vlak. |
11 | een simpele berekening van de lengte van een vector in het platte vlak. |
| 12 | Hier is de broncode van deze oefening/opgave: |
12 | Hier is de broncode van deze oefening/opgave: |
| 13 | 13 | ||
| 14 | <p><pre> |
14 | <p><pre> |
| 15 | \title{Norm of vector 2D} |
15 | \title{Norm of vector 2D} |
| Line 20... | Line 20... | ||
| 20 | \integer{x=random(-10..10)} |
20 | \integer{x=random(-10..10)} |
| 21 | \integer{y=random(-10..10)} |
21 | \integer{y=random(-10..10)} |
| 22 | \real{norm=sqrt((\x)^2+(\y)^2)} |
22 | \real{norm=sqrt((\x)^2+(\y)^2)} |
| 23 | \statement{Wat is de lengte van de vector (\x,\y) in R<sup>2</sup>?} |
23 | \statement{Wat is de lengte van de vector (\x,\y) in R<sup>2</sup>?} |
| 24 | 24 | ||
| 25 | \hint{de lengte van een vector (x,y) is gelijk aan |
25 | \hint{de lengte van een vector (x,y) is gelijk aan |
| 26 | sqrt(x^2+y^2).} |
26 | sqrt(x^2+y^2).} |
| 27 | \answer{De lengte}{\norm} |
27 | \answer{De lengte}{\norm} |
| 28 | </pre> <p> |
28 | </pre> <p> |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | In this exercise, one has defined 2 random integers, x and y, who are the |
31 | In this exercise, one has defined 2 random integers, x and y, who are the |
| 32 | coordinates of the vector. Then a third parameter, this time real, is defined |
32 | coordinates of the vector. Then a third parameter, this time real, is defined |
| 33 | by the formula of the length. The exercise takes a freestyle reply under the |
33 | by the formula of the length. The exercise takes a freestyle reply under the |
| 34 | name of ``the length'', and the good reply should be the value of the third |
34 | name of ``the length'', and the good reply should be the value of the third |
| 35 | parameter``norm''. A hint is prepared in the exercise, which recalls the |
35 | parameter``norm''. A hint is prepared in the exercise, which recalls the |
| 36 | formula of the length. <p> |
36 | formula of the length. </p><p> |
| 37 | You can |
37 | You can |
| 38 | !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= $ |
38 | !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= $ |
| 39 | !href cmd=reply&mode=guided&$parm load this example into the menu |
39 | !href cmd=reply&mode=guided&$parm load this example into the menu |
| 40 | to test it. (You can also copy the source into the menu under raw mode.) |
40 | to test it. (You can also copy the source into the menu under raw mode.) |
| 41 | 41 | ||
| 42 | 42 | ||
| 43 | <li><hr style="width:50%"/> <b>Trace of matrix 2x2</b>, computes the trace of a matrix. The question |
43 | <li><hr style="width:50%"/> <b>Trace of matrix 2x2</b>, computes the trace of a matrix. The question |
| 44 | is formatted by TeX, for a better presentation of the matrix. Here is |
44 | is formatted by TeX, for a better presentation of the matrix. Here is |
| 45 | the complete source of the exercise. |
45 | the complete source of the exercise. |
| 46 | <p><pre> |
46 | <p><pre> |
| 47 | \title{Trace of matrix 2x2} |
47 | \title{Trace of matrix 2x2} |
| 48 | \language{en} |
48 | \language{en} |
| 49 | \computeanswer{yes} |
49 | \computeanswer{yes} |
| Line 63... | Line 63... | ||
| 63 | We have first defined an integer ``range'', to be used to bound the |
63 | We have first defined an integer ``range'', to be used to bound the |
| 64 | random values a,b,c,d which are the elements of the matrix. And the trace is |
64 | random values a,b,c,d which are the elements of the matrix. And the trace is |
| 65 | of course defined by the sum of the elements on the diagonal. Please take |
65 | of course defined by the sum of the elements on the diagonal. Please take |
| 66 | care to the definition <span class="tt">trace=(\a)+(\d)</span>: the pairs of parentheses |
66 | care to the definition <span class="tt">trace=(\a)+(\d)</span>: the pairs of parentheses |
| 67 | are necessary, for the substitution is literary. If you define |
67 | are necessary, for the substitution is literary. If you define |
| 68 | <span class="tt">trace=\a+\d</span> and if a and d take the values of 3 and -15 respectively, |
68 | <span class="tt">trace=\a+\d</span> and if a and d take the values of 3 and -15 respectively, |
| 69 | you woule have <span class="tt">trace=3+-15</span>, a bad mathematical expression. <p> |
69 | you woule have <span class="tt">trace=3+-15</span>, a bad mathematical expression. </p><p> |
| 70 | Remark that in this exercise, the non-computed replies are admitted |
70 | Remark that in this exercise, the non-computed replies are admitted |
| 71 | (such as 2+15 or 3*105). <p> |
71 | (such as 2+15 or 3*105).</p> <p> |
| 72 | You can |
72 | You can |
| 73 | !set parm=oef_answercnt=1&oef_choicecnt=0&oef_title=Trace of matrix 2x2&oef_format=tex&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 |
73 | !set parm=oef_answercnt=1&oef_choicecnt=0&oef_title=Trace of matrix 2x2&oef_format=tex&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= $ |
| 74 | !href cmd=reply&mode=guided&$parm load this example into the menu |
74 | !href cmd=reply&mode=guided&$parm load this example into the menu |
| 75 | to test it. (You can also copy the source into the menu under raw mode.) |
75 | to test it. (You can also copy the source into the menu under raw mode.) |
| - | 76 | </p> |
|
| 76 | 77 | ||
| 77 | 78 | ||
| 78 | </ol> |
79 | </ol> |
| 79 | 80 | ||