<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Question%2Ftype%2Fstack%2Fdoc%2Fdoc.php%2FAuthoring%2FKeyVals.md</id>
	<title>Question/type/stack/doc/doc.php/Authoring/KeyVals.md - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Question%2Ftype%2Fstack%2Fdoc%2Fdoc.php%2FAuthoring%2FKeyVals.md"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Question/type/stack/doc/doc.php/Authoring/KeyVals.md&amp;action=history"/>
	<updated>2026-05-08T06:10:11Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Question/type/stack/doc/doc.php/Authoring/KeyVals.md&amp;diff=10135&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Question/type/stack/doc/doc.php/Authoring/KeyVals.md&amp;diff=10135&amp;oldid=prev"/>
		<updated>2024-10-18T06:56:54Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 06:56, 18 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Question/type/stack/doc/doc.php/Authoring/KeyVals.md&amp;diff=10134&amp;oldid=prev</id>
		<title>1&gt;Rsturley: /* STACK Question Variables */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Question/type/stack/doc/doc.php/Authoring/KeyVals.md&amp;diff=10134&amp;oldid=prev"/>
		<updated>2012-07-13T03:09:27Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;STACK Question Variables&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==STACK Question Variables==&lt;br /&gt;
This field is for variables that are used later in the question. The values can be quite general: integers, floating point numbers, symbols or expressions, or random selections of any of the preceding elements.  The variables can be access in other fields of the question by including them in [[question/type/stack/doc/doc.php/Authoring/CAStext.md|CAStext]].  The assignment operator is the colon (:), as is consistent with the maxima program which processes expressions in STACK.  These assignments can be used to build up complicated expressions from simple ones using maxima syntax.&lt;br /&gt;
===Simple Assignments===&lt;br /&gt;
An example of a simple variable assignment is&lt;br /&gt;
&lt;br /&gt;
p:5;&lt;br /&gt;
&lt;br /&gt;
This assigns the value of 5 to the variable p.  In your question text, but example the appearance of @p@, will be replaced by 5.  The line need not end in a semicolon, but its good practice in case you want to cut and past the assignments into a maxima session for testing.&lt;br /&gt;
&lt;br /&gt;
q:x^2+2;&lt;br /&gt;
&lt;br /&gt;
This assigns the symbolic expression representing &amp;#039;x&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;+2&amp;#039; to the variable q.  This can be used as a model answer, for instance or part or a later expression.&lt;br /&gt;
&lt;br /&gt;
===Random Assignments===&lt;br /&gt;
The significant power of question variables becomes evident when they are used to generate randomly chosen values for a question by means of the rand operator.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE&amp;#039;&amp;#039;&amp;#039;: If you use random variables in your Question Variables you need to be sure and include them in the [[question/type/stack/doc/doc.php/Authoring/Question note.md|Question Note]] as well.  Otherwise, you (and Moodle) won&amp;#039;t be able distinguish between the various question variants when analyzing the questions and reporting results.&lt;br /&gt;
&lt;br /&gt;
Using rand with an integer argument produces a random integer between 0 and one less than that number.  In other words, rand(4) would randomly return either 0, 1, 2, or 3.  An assignment like&lt;br /&gt;
&lt;br /&gt;
x:rand(6)+1;&lt;br /&gt;
&lt;br /&gt;
would produce a random number between 1 and 6 inclusive that could be used in other parts of the question or answer.  A random floating point number is generated by including a number with a decimal point as an argument.  It returns a floating point number between 0 and the given value.  Thus,&lt;br /&gt;
&lt;br /&gt;
y:rand(10.0)-5;&lt;br /&gt;
&lt;br /&gt;
would return a random floating point number between -5.0 and 5.0.&lt;br /&gt;
&lt;br /&gt;
The rand function can also return a random element in a list.  So, for instance,&lt;br /&gt;
&lt;br /&gt;
q:rand([a,b,c,d,e]);&lt;br /&gt;
&lt;br /&gt;
would return a random selection of a, b, c, d, or e.  Using this facility, one could build random symbolic expressions in the questions for each student.&lt;br /&gt;
&lt;br /&gt;
====Variations on rand====&lt;br /&gt;
There are a couple of specialized rand functions you can use for unique situations.  The function rand_with_step takes three arguments:&lt;br /&gt;
* the lower bound of the number&lt;br /&gt;
* the upper bound of the number &lt;br /&gt;
* the step size&lt;br /&gt;
Thus rand(1,5,2) would randomly choose 1, 3, or 5.  A related function is rand_with_prohib.  It also take three arugments:&lt;br /&gt;
* the lower bound of the numbers&lt;br /&gt;
* the upper bound of the numbers&lt;br /&gt;
* a list of values to be excluded&lt;br /&gt;
For instance, rand_with_prohib(-5,5,[0]) would generate random integers between -5 and 5 inclusive, but not including 0.&lt;/div&gt;</summary>
		<author><name>1&gt;Rsturley</name></author>
	</entry>
</feed>