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
  
     | 
    
      
<h3>
Voorbeelden van interactieve opgaven <br/>
in het OEF formaat</h3>
Hier staan enkele voorbeelden van interactieve oefeningen gemaakt met Createxo
<ol>
<li> <hr style="width:50%"/>
<b>Lengte van een 2D vector </b>,
een simpele berekening van de lengte van een vector in het platte vlak.
Hier is de broncode van deze oefening/opgave:
<p><pre>
\title{Norm of vector 2D}
\language{en}
\computeanswer{no}
\format{html}
\integer{x=random(-10..10)}
\integer{y=random(-10..10)}
\real{norm=sqrt((\x)^2+(\y)^2)}
\statement{Wat is de lengte van de vector (\x,\y) in R<sup>2</sup>?}
\hint{de lengte van een vector  (x,y) is gelijk aan
sqrt(x^2+y^2).}
\answer{De lengte}{\norm}
</pre> <p>
In this exercise, one has defined 2 random integers, x and y, who are the
coordinates of the vector. Then a third parameter, this time real, is defined
by the formula of the length. The exercise takes a freestyle reply under the
name of ``the length'', and the good reply should be the value of the third
parameter``norm''. A hint is prepared in the exercise, which recalls the
formula of the length. </p><p>
You can
!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= $
!href cmd=reply&mode=guided&$parm load this example into the menu
 to test it. (You can also copy the source into the menu under raw mode.)
<li><hr style="width:50%"/> <b>Trace of matrix 2x2</b>, computes the trace of a matrix. The question
 is formatted by TeX, for a better presentation of the matrix. Here is
 the complete source of the exercise.
<p><pre>
\title{Trace of matrix 2x2}
\language{en}
\computeanswer{yes}
\format{tex}
\integer{range=20}
\integer{a=random(-\range..\range)}
\integer{b=random(-\range..\range)}
\integer{c=random(-\range..\range)}
\integer{d=random(-\range..\range)}
\integer{trace=(\a)+(\d)}
\statement{Compute the trace of the matrix
$$\pmatrix{\a&\b\cr \c&\d}$$.}
\answer{The trace}{\trace}
</pre> <p>
We have first defined an integer ``range'', to be used to bound the
random values a,b,c,d which are the elements of the matrix. And the trace is
of course defined by the sum of the elements on the diagonal. Please take
care to the definition <span class="tt">trace=(\a)+(\d)</span>: the pairs of parentheses
are necessary, for the substitution is literary. If you define
<span class="tt">trace=\a+\d</span> and if a and d take the values of 3 and -15 respectively,
you woule have <span class="tt">trace=3+-15</span>, a bad mathematical expression. </p><p>
Remark that in this exercise, the non-computed replies are admitted
(such as 2+15 or 3*105).</p> <p>
You can
!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= $
!href cmd=reply&mode=guided&$parm load this example into the menu
 to test it. (You can also copy the source into the menu under raw mode.)
 </p>
</ol>
 
     |