« Formules: Variables dans le texte et dans les équations du texte » : différence entre les versions

De MoodleDocs
Aller à :navigation, rechercher
(Page redirigée vers Types de questions tiers)
 
(15 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
{{Question de type Formules}}
#REDIRECT [[Types_de_questions_tiers]]
{{Traduction}}
 
==Utilisation de variables dans le texte==
 
Il est facile d'insérer des valeurs de variable directement dans le texte. Tout ce qui est nécessaire est d'entourer les noms de variable avec <span style="font-family:monospace;font-size:113%;">{}</span>. Chaque champ de texte a une portée de variables. Toutes les variables <span style="font-family:monospace;font-size:113%;">x</span> de nombre ou de chaîne dans la portée du texte peuvent être utilisées pour remplacer l'espace réservé <span style="font-family:monospace;font-size:113%;">{x}</span> correspondant dans le texte.
 
Il est également possible d'évaluer une expression et d'insérer sa valeur directement dans le texte en ajoutant un signe égal au début de l'accolade tel que <span style="font-family:monospace;font-size:113%;">{=x/1000}</span>. Cette méthode est plus simple si les variables nommées ne sont pas requises. Cependant, aucune vérification d'erreur n'est effectuée à moins que la question ne soit instanciée dans le test. Un exemple est la mise à l'échelle des mètres en kilomètres ci-dessous :
 
<pre style="font-size:113%;width: 98%;">
Quelle est la vitesse de la fusée si elle parcourt {=x/1000} km en {t} s ?
</pre>
 
==Utilisation de variables dans des équations du texte==
 
Les équations de texte sont des expressions ou des équations mathématiques qui sont affichées dans le texte en utilisant une syntaxe mathématique telle que :
 
*'''[http://www.tug.org/ TeX]'''
*'''[https://www.w3.org/TR/MathML3/ MathML]'''
*'''[http://asciimath.org/ AsciiMath]'''
 
Voir [https://docs.moodle.org/33/en/Mathematics#Equation_Construction_and_Display '''Construction et affichage des équations''' (en anglais)] pour plus d'informations sur l'écriture des expressions mathématiques.
 
Values of variables can be inserted in text equations in the same way as in the text, that is, by enclosing the variable names with {}. Values of expressions such as {=x/1000} can also be inserted.
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:20px 0 25px;">
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
Write the following equation in TeX syntax. Upon display, {a}, {b} and {c} will be substituted by the value of these variables:
 
::{a}''x''<sup>2</sup> + {b}''x'' + {c} = 0
 
<pre style="font-size:113%;width: 98%;>
\( {a} x^2 + {b} x + {c} = 0 \)
</pre>
 
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:20px 0 25px;">
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
Write the following equation in MathML syntax. Upon display, {a}, {b} and {c} will be substituted by the value of these variables:
 
::{a}''x''<sup>2</sup> + {b}''x'' + {c} = 0
 
<pre style="font-size:113%;width: 98%;">
«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»
  «mn»{a}«/mn»
  «msup»«mi»x«/mi»«mn»2«/mn»«/msup»
  «mo»+«/mo»
  «mn»{b}«/mn»
  «mi»x«/mi»
  «mo»+«/mo»
  «mn»{c}«/mn»
  «mo»=«/mo»
  «mn»0«/mn»
«/math»
</pre>
 
MathML equations are usually created with the aid of an editor. When creating the equation with an editor, it is easier to write a number, say 99, in lieu of the variables, for example:
 
<pre style="font-size:113%;width: 98%;margin-top:0px;">
«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»
  «mn»99«/mn»
  «msup»«mi»x«/mi»«mn»2«/mn»«/msup»
  «mo»+«/mo»
  «mn»99«/mn»
  «mi»x«/mi»
  «mo»+«/mo»
  «mn»99«/mn»
  «mo»=«/mo»
  «mn»0«/mn»
«/math»
</pre>
and then replace the numbers 99 by the variables {a}, {b} and {c} in the HTML code.
 
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:20px 0 25px;">
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
Write the following equation in the AsciiMath syntax. Upon display, {a}, {b} and {c} will be substituted by the value of these variables:
 
::{a}''x''<sup>2</sup> + {b}''x'' + {c} = 0
 
<pre style="font-size:113%;width: 98%;">
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML"></script>
`{a} x^2 + {b} x + {c} = 0`
</pre>
</div>
 
<div style="border:1px solid #bce8f1;border-radius:4px;padding: 0px 15px 0px; margin:20px 0 25px;">
<div style="font-family:Lucida Sans Unicode;font-size:150%;color:#f98012;margin:10px 0 10px;>Example</div>
 
Use variables and expressions in text equations that appear in the main question text, the general feedback and the part's feedback of a Formulas question. Use MathML syntax.
 
''Downloadable question file:'' [https://drive.google.com/open?id=1MVUhvncCMHYl3LM-XpklggV-bpku5L8v QuadraticEquation.xml]
 
This Formulas question looks like this:
 
[[File:QuadraticEquation.png|695px]]
 
<div style="margin:20px 0 20px;">
[http://35.193.77.29/mod/quiz/view.php?id=125 <span style="background-color:#f98012;box-shadow: 0 5px 10px #cbcbcb;border: none;color:white;padding: 8px 16px;text-align:center;text-decoration: none;cursor:pointer;">Play it</span>]
</div>
 
</div>
 
 
 
[[#top|Accéder au haut de la page]]
 
[[Question de type Formules|← QUESTION DE TYPE FORMULES]]
 
===Autres langues===
[https://docs.moodle.org/33/en/Formulas:_Variables_in_text_and_text_equations English]<br>
[https://docs.moodle.org/all/es/F%C3%B3rmulas:_Variables_en_el_texto_y_en_las_ecuaciones_del_texto Español]

Dernière version du 1 février 2018 à 01:41

Rediriger vers :