Subversion Repositories wimsdev

Rev

Rev 619 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23 reyssat 1
 
2
<h3>How to write mathematical formulas in your exercises.</h3>
3
 
4
You may embed mathematical symbols and formulas into the statement (when it
5
is of html format), hint and solution.
6
<p>
7
If you simply want to insert some mathematical symbols or greek letters,
4091 bpr 8
you just need to type a <tt class="wims_code_words">\</tt> followed by the name of
4427 bpr 9
the symbol or greek letter (if you have not used this name in your parameter
4091 bpr 10
definitions). For example, <tt class="wims_code_variable">\pi</tt> gives you $m_pi,
11
<tt class="wims_code_variable">\le</tt> gives $m_le, <tt class="wims_code_variable">\pm</tt> gives $m_pm, <tt class="wims_code_variable">\rightarrow</tt> gives
23 reyssat 12
$m_rightarrow, etc. The names of the symbols follow the standard TeX
13
convention. Here is a
14
!href target=wims_help module=help/wimsdoc.en&subject=mathfonts#mathfonts list of mathematical symbols and their names
4091 bpr 15
 (replace <tt class="wims_code_words">$$m_</tt> by <tt class="wims_code_words">\</tt> in the names).
23 reyssat 16
<p>
17
More generally, to insert a whole mathematical formula, you
18
can type the formula in the usual way as if you enter it into any
19
mathematical software or any computational tool under WIMS. In order to make
20
the formula formatted and shown beautifully, you have
21
only to enclose it in a pair of parentheses preceded by a backslash \. For
4091 bpr 22
example, <tt class="wims_code_words">\(x^3-3x+cos(2pi*x)^5)</tt> gives you
23 reyssat 23
!insmath x^3-3*x+cos(2pi*x)^5
4091 bpr 24
, or <tt class="wims_code_words">\(sqrt(x^2+y^2))</tt> gives you
23 reyssat 25
!insmath sqrt(x^2+y^2)
4091 bpr 26
. You can type <tt class="wims_code_words">\(integrate(x^2+1)dx)</tt> for
23 reyssat 27
!insmath integrate(x^2+1)*dx
4091 bpr 28
, or <tt class="wims_code_words">\(integrate(exp(x^2+1),x=1..infinity))</tt> for
23 reyssat 29
!insmath integrate(exp(x^2+1),x=1..infinity)
30
. You can also write the sum
31
!insmath sum(1/n^2,n=1..infinity)
4091 bpr 32
 using <tt class="wims_code_words">\(sum(1/n^2,n=1..infinity)</tt>, or the product
23 reyssat 33
!insmath product(n/(n+1),n=1..infinity)
4091 bpr 34
 using <tt class="wims_code_words">\(product(n/(n+1),n=1..infinity)</tt>.
23 reyssat 35
<p>
36
More helps on how to enter mathematical expressions are in
37
!href target=wims_help module=help/main&chapter=1&open=1_math#math this page
38
.
39
<p>
40
To show a matrix
41
!insmath [1,2,3;4,5,6;7,8,9]
4091 bpr 42
, you should type <tt class="wims_code_words">\([1,2,3;4,5,6;7,8,9])</tt>. Nested matrices are
23 reyssat 43
accepted (and will be rendered correctly).
44
<p>
45
For experts in TeX or LaTeX, please notice that whenever the software sees a formula
4091 bpr 46
enclosed in a pair of parentheses preceded by <tt class="wims_code_words">\</tt> which contains
23 reyssat 47
backslashes, it will interpret it as a TeX source, and will directly try to
48
format it by TeX. This will allow you to write very sophisticated formulas if
49
you know how to write them in the TeX way.
4091 bpr 50
TeX ou LaTeX, you can write inside the parentheses <tt class="wims_code_words">\displaystyle</tt> or
51
an empty pair of braces <tt class="wims_code_words">{}</tt>.
280 reyssat 52
For example, you will get &nbsp;
242 bpr 53
!insmath \displaystyle a
4091 bpr 54
&nbsp;  &nbsp; via <tt class="wims_code_words">\(\displaystyle a )</tt>
55
or <tt class="wims_code_words">\({} a )</tt>
242 bpr 56
and &nbsp;
57
!insmath a
4091 bpr 58
&nbsp;  &nbsp; via <tt class="wims_code_words">\( a )</tt>.
242 bpr 59
 
23 reyssat 60
<p>
61
And the most complete way to use TeX in your exercise is to choose
62
!href cmd=help&special_parm=format TeX format
63
 (for the statement only).