Subversion Repositories wimsdev

Rev

Rev 5755 | Rev 5912 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5755 Rev 5903
Line 8... Line 8...
8
between -10 and 10 (inclusive):
8
between -10 and 10 (inclusive):
9
<pre>
9
<pre>
10
\integer{x1=random(-10..10)}
10
\integer{x1=random(-10..10)}
11
</pre>
11
</pre>
12
This random parameter may then be called by the word
12
This random parameter may then be called by the word
13
<b><tt class="wims_code_variable">x1</tt></b>, in the statement, the replis, the hint and the solution.
13
<b><span class="tt wims_code_variable">x1</span></b>, in the statement, the replis, the hint and the solution.
14
That is, each word <tt class="wims_code_variable">x1</tt> in these texts will be replaced
14
That is, each word <span class="tt wims_code_variable">x1</span> in these texts will be replaced
15
by the random value of the parameter. This substitution will also take
15
by the random value of the parameter. This substitution will also take
16
place in the definitions of other parameters which follow that of x1.
16
place in the definitions of other parameters which follow that of x1.
17
<p>
17
<p>
18
Suppose now that you have entered
18
Suppose now that you have entered
19
<pre>
19
<pre>
Line 27... Line 27...
27
in the statement of the exercise. Suppose that for a certain request of
27
in the statement of the exercise. Suppose that for a certain request of
28
the exercise, a random value <font color="red">-7</font>
28
the exercise, a random value <font color="red">-7</font>
29
is attributed to \x1. Then the following parameter \y1 will take the value
29
is attributed to \x1. Then the following parameter \y1 will take the value
30
-4, and the statement of the exercise will be presented under the form <div class="wimscenter">Compute the multiplication of -7 by -4.
30
-4, and the statement of the exercise will be presented under the form <div class="wimscenter">Compute the multiplication of -7 by -4.
31
</div>
31
</div>
32
You may then define a numerical reply in the name of <tt>The product</tt>,
32
You may then define a numerical reply in the name of <span class="tt">The product</span>,
33
having for the good solution <tt class="wims_code_words">(\x1)*(\y1)</tt>. (Remark that here
33
having for the good solution <span class="tt wims_code_words">(\x1)*(\y1)</span>. (Remark that here
34
the parentheses are necessary, because the substitution is done literarily.)
34
the parentheses are necessary, because the substitution is done literarily.)
35
<a name="list"></a>
35
<a name="list"></a>
36
!if oefparm isitemof $special_parm
36
!if oefparm isitemof $special_parm
37
 !changeto help/oefparm.phtml
37
 !changeto help/oefparm.phtml
38
!endif
38
!endif
39
<p>$table_header
39
<p>$table_header
40
<caption>Some other examples of parameters
40
<caption>Some other examples of parameters
41
!href cmd=help&special_parm=$special_parm,oefparm#list [complete list]
41
!href cmd=help&special_parm=$special_parm,oefparm#list [complete list]
42
</caption>
42
</caption>
43
$table_hdtr<th>Definition<th>Effect
43
$table_hdtr<th>Definition<th>Effect
44
$table_tr<td><tt class="wims_code_words">\real{x=random(-5..5)}</tt>
44
$table_tr<td><span class="tt wims_code_words">\real{x=random(-5..5)}</span>
45
    <td>\x will be a random real number<br/>between -5 and 5
45
    <td>\x will be a random real number<br/>between -5 and 5
46
$table_tr<td><tt class="wims_code_words">\real{a=random(-5,-3,0.3,4)}</tt>
46
$table_tr<td><span class="tt wims_code_words">\real{a=random(-5,-3,0.3,4)}</span>
47
    <td>\a will be a real number taken randomly<br/>among -5,-3,0.3 and 4
47
    <td>\a will be a real number taken randomly<br/>among -5,-3,0.3 and 4
48
$table_tr<td><tt class="wims_code_words">\complex{z=(1+2*i)^3}</tt>
48
$table_tr<td><span class="tt wims_code_words">\complex{z=(1+2*i)^3}</span>
49
    <td>\z will be the complex number (1+2*i)^3
49
    <td>\z will be the complex number (1+2*i)^3
50
$table_tr<td><tt class="wims_code_words">\text{sign=random(+,-)}</tt>
50
$table_tr<td><span class="tt wims_code_words">\text{sign=random(+,-)}</span>
51
    <td>\sign will be a random sign: + ou -
51
    <td>\sign will be a random sign: + ou -
52
$table_tr<td><tt class="wims_code_words">\integer{n=3*exp(\a)}</tt>
52
$table_tr<td><span class="tt wims_code_words">\integer{n=3*exp(\a)}</span>
53
    <td>\n will be the closest integer to 3*e<sup>\a</sup> <br/>(it depends on
53
    <td>\n will be the closest integer to 3*e<sup>\a</sup> <br/>(it depends on
54
    the value of \a)
54
    the value of \a)
55
$table_tr<td><tt class="wims_code_words">\function{f=random<br/> (x^2+1,sin(x),log(x))}</tt>
55
$table_tr<td><tt class="wims_code_words">\function{f=random<br/> (x^2+1,sin(x),log(x))}</tt>
56
    <td>\f will be a random function: either x^2+1,<br/>or sin(x), or
56
    <td>\f will be a random function: either x^2+1,<br/>or sin(x), or
57
    log(x)
57
    log(x)
58
$table_tr<td><tt class="wims_code_words">\real{a=evalue(x^2+sin(y),x=3,y=4)}</tt>
58
$table_tr<td><span class="tt wims_code_words">\real{a=evalue(x^2+sin(y),x=3,y=4)}</span>
59
    <td>Evaluation of the function x^2+sin(y),<br/>
59
    <td>Evaluation of the function x^2+sin(y),<br/>
60
    for x=3, y=4
60
    for x=3, y=4
61
$table_tr<td><tt class="wims_code_words">\real{r=solve(x^3-3*x+1,x=0..1)}</tt>
61
$table_tr<td><span class="tt wims_code_words">\real{r=solve(x^3-3*x+1,x=0..1)}</span>
62
    <td>\r will the the simple root of x^3-3x+1 between 0 and 1
62
    <td>\r will the the simple root of x^3-3x+1 between 0 and 1
63
$table_tr<td><tt class="wims_code_words">\function{h=simplify(x^5*y^3*x^2/y)}</tt>
63
$table_tr<td><span class="tt wims_code_words">\function{h=simplify(x^5*y^3*x^2/y)}</span>
64
    <td>Simplified expression: x<sup>7</sup>y<sup>2</sup>
64
    <td>Simplified expression: x<sup>7</sup>y<sup>2</sup>
65
$table_tr<td><tt class="wims_code_words">\function{g=diff(sin(x)+cos(y),x)}</tt>
65
$table_tr<td><span class="tt wims_code_words">\function{g=diff(sin(x)+cos(y),x)}</span>
66
    <td>\g will the the derivative of sin(x)+cos(y) with respect to x
66
    <td>\g will the the derivative of sin(x)+cos(y) with respect to x
67
$table_tr<td><tt class="wims_code_words">\function{F=int(x^2+3*x+1,x)}</tt>
67
$table_tr<td><span class="tt wims_code_words">\function{F=int(x^2+3*x+1,x)}</span>
68
    <td>\F will an antiderivative of x^2+3*x+1,<br/>
68
    <td>\F will an antiderivative of x^2+3*x+1,<br/>
69
     the constant term being not garanteed to be always the same
69
     the constant term being not garanteed to be always the same
70
!!$table_tr<td><tt class="wims_code_words">\function{F=int(t^2+3*t+1,t=1..x)}
70
!!$table_tr<td><tt class="wims_code_words">\function{F=int(t^2+3*t+1,t=1..x)}
71
!!    <td>\F will the antiderivative of x^2+3*x+1 with g(1)=0
71
!!    <td>\F will the antiderivative of x^2+3*x+1 with g(1)=0
72
$table_tr<td><tt class="wims_code_words">\real{a=int(t^2+3*t+1,t=0..1)}</tt>
72
$table_tr<td><span class="tt wims_code_words">\real{a=int(t^2+3*t+1,t=0..1)}</span>
73
    <td>\a will the numerical integral of x^2+3*x+1 from 0 to 1
73
    <td>\a will the numerical integral of x^2+3*x+1 from 0 to 1
74
$table_tr<td><tt class="wims_code_words">\text{f=htmlmath(2*x^2+3*x)}</tt>
74
$table_tr<td><span class="tt wims_code_words">\text{f=htmlmath(2*x^2+3*x)}</span>
75
    <td>\f will be rendered in html as: 2x<sup>2</sup>+3x
75
    <td>\f will be rendered in html as: 2x<sup>2</sup>+3x
76
$table_tr<td><tt class="wims_code_words">\text{f=texmath(2*x^2+3*x)}</tt>
76
$table_tr<td><span class="tt wims_code_words">\text{f=texmath(2*x^2+3*x)}</span>
77
    <td>\f will be the TeX source for the expression.
77
    <td>\f will be the TeX source for the expression.
78
$table_tr<td><tt class="wims_code_words">\integer{n=items(a,b,c,d,e,f)}</tt>
78
$table_tr<td><span class="tt wims_code_words">\integer{n=items(a,b,c,d,e,f)}</span>
79
    <td>\n will be the number of items (here it is 6) in the list
79
    <td>\n will be the number of items (here it is 6) in the list
80
     {a,b,c,d,e,f}
80
     {a,b,c,d,e,f}
81
$table_tr<td><tt class="wims_code_words">\text{i=item(3,a,b,c,d,e,f)}</tt>
81
$table_tr<td><span class="tt wims_code_words">\text{i=item(3,a,b,c,d,e,f)}</span>
82
    <td>\i will be the item number 3 of the list
82
    <td>\i will be the item number 3 of the list
83
     {a,b,c,d,e,f} (hence c).
83
     {a,b,c,d,e,f} (hence c).
84
$table_tr<td><tt class="wims_code_words">\text{s=shuffle(6)}</tt>
84
$table_tr<td><span class="tt wims_code_words">\text{s=shuffle(6)}</span>
85
    <td>\s will be the list of 6 integers 1,2,...,6, in random order.
85
    <td>\s will be the list of 6 integers 1,2,...,6, in random order.
86
$table_tr<td><tt class="wims_code_words">\text{s=shuffle(a,b,c,d,e)}</tt>
86
$table_tr<td><span class="tt wims_code_words">\text{s=shuffle(a,b,c,d,e)}</span>
87
    <td>\s will be the letters {a,b,c,d,e} in random order.
87
    <td>\s will be the letters {a,b,c,d,e} in random order.
88
$table_tr<td><tt class="wims_code_words">\matrix{m=1,2,3<br/>4,5,6<br/>7,8,9}</tt>
88
$table_tr<td><tt class="wims_code_words">\matrix{m=1,2,3<br/>4,5,6<br/>7,8,9}</tt>
89
    <td>\m will be the matrix of 3 rows and 3 columns.
89
    <td>\m will be the matrix of 3 rows and 3 columns.
90
$table_tr<td><tt class="wims_code_words">\text{t=asis(How do you do? item(1,2,3))}</tt>
90
$table_tr<td><span class="tt wims_code_words">\text{t=asis(How do you do? item(1,2,3))}</span>
91
    <td>The string as it is, with no transformation nor conditionality.
91
    <td>The string as it is, with no transformation nor conditionality.
92
 
92
 
93
$table_end <p>
93
$table_end <p>
94
 
94
 
95
Conditional parameters: You may write
95
Conditional parameters: You may write
96
<pre>
96
<pre>
97
\text{ttt=_condition?_def1}
97
\text{ttt=_condition?_def1}
98
\text{ttt=_condition?_def1:_def2}
98
\text{ttt=_condition?_def1:_def2}
99
</pre>
99
</pre>
100
<p>
100
<p>
101
In this case, <tt>ttt</tt> will be set to <tt>_def1</tt> if
101
In this case, <span class="tt">ttt</span> will be set to <span class="tt">_def1</span> if
102
<tt>_condition</tt> is true, or to <tt>_def2</tt> otherwise (in the second
102
<span class="tt">_condition</span> is true, or to <span class="tt">_def2</span> otherwise (in the second
103
syntax).
103
syntax).
104
!href target=wims_mhelp cmd=help&special_parm=if List of conditions
104
!href target=wims_mhelp cmd=help&special_parm=if List of conditions
105
<p>
105
<p>
106
The relative positionning of the definition and the statement is important:
106
The relative positionning of the definition and the statement is important:
107
if a variable is defined AFTER the statement, the evaluation of the variable
107
if a variable is defined AFTER the statement, the evaluation of the variable
108
will take place only AFTER the user has replied to the question. In this
108
will take place only AFTER the user has replied to the question. In this
109
case, the definition may involve user replies, via <tt class="wims_code_variable">\reply1</tt>,
109
case, the definition may involve user replies, via <span class="tt wims_code_variable">\reply1</span>,
110
<tt class="wims_code_variable">\reply2</tt>, etc. And the variable can be used in testing
110
<span class="tt wims_code_variable">\reply2</span>, etc. And the variable can be used in testing
111
conditions or feedbacks.
111
conditions or feedbacks.
112
 
112
 
113
 
113