LON-CAPA User Help: Authoring Problems LON-CAPA User Help : Authoring : Authoring Problems Homework Problems, etc + Subcategories: + + Answers in this category: + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + <(*) (missing or broken file) + LON-CAPA User Help : Authoring : Authoring Problems : HTML to TeX conversions Will s get converted well to TeX tables for printing-- or should one set up tables in TeX and use to convert them to HTML? Yes, html tables will be converted to TeX in the print script. If you wish, you can put a TeX table in the resource using the tag instead. Either method will work. LON-CAPA User Help : Authoring : Authoring Problems : Why can't the students see the <img>s that the author sees? Trivial answer: Possibly because the author needs to include appropriate tags in the XML for the specific images. These tags are generated automatically for "non-dynamic" tags but not for dynamically specified ones. Thus, for example: will cause the tag to be automatically generated and appear just prior to the tag. However, that is non-functional because there is no specific image having that name. (It would probably be better if it were not generated at all.) The author will have to hand-generate an appropriate allow tag for any images that may translate to $variable.gif. A global specification such as seems to work OK. LON-CAPA User Help : Authoring : Authoring Problems : Can one safely omit "<th>" tags in "<table>"s if headers are undesired? tag is not necessary, but headers can help make your resource more accessible, especially with users with visual impairments that use screen-readers to view the web. LON-CAPA User Help : Authoring : Authoring Problems : Why did I get text boxes instead of drop-down boxes in the option-response editior? If you create an option response problem, the options that correspond to all of your foils MUST be listed as an option. The template defaults with the options "True" and "False", but you want the options "Red", "Blue", and "Green". If you delete "True" and "False" first, you will notice that the foils have the words "True" and "False" in text boxes now. This is because the option does not exist in the main list. To avoid this problem, add all your new options first, change the foils to what you want them to be and pick the correct option for each foil. Finally, you can delete the options you don't want, in this case "True" and "False" When deleting an option from a multiple option response problem, in order to avoid losing the information associated with the foils associated with the option, the "correct option" entry is made a text entry box. This allows you to add a new option and change the preexisting foils to match this new option. Otherwise you would have to reenter the foils to change the option name. All foils for an question only will present the options from the list of options you defined. The "Typed In Value" option does not allow a student to "type in" a value but for an instructor to say that the correct option for ths foil comes from a variable. This option is most often used when coupled with a problem. Or where you are randomizing the probelm text. If you want the student to provide a typed in answer, use the String Response. LON-CAPA User Help : Authoring : Authoring Problems : What's a foil? "Foil" is the term we used for the statements in radio-response and option-response problems. For example: Which of the statements are true and which are false: 2 is greater than 4 5 is less than 10 7 is odd 6 is odd 4 is even Each of the statements above are a foil and the "options" are True and False given in the drop-down boxes. LON-CAPA User Help : Authoring : Authoring Problems : My students see 1.33333333333 as their answer, can I format this? Yes. In the parameter for the numerical response, you can use the following: 2e (answer will display as 1.33e01) 2f (answer will display as 1.33) $format (you can use a variable where $format evaluates to something like "2e". For those who use XML to code thier problems: (shows all digits) (for example prints 1.23e-04) (shows all digits of all answers) (shows all answers in 2e) If you want your answers to a numerical problem to display only digits after the decimal when answers are shown, then enter "2f" in the format box next to the numerical answer box. 2f - 3.333333 will be displayed 3.33 0f - 3.333333 will be displayed 3 2E - 333.3333 will be displayed 3.33 E2 LON-CAPA User Help : Authoring : Authoring Problems : How can I add a picture to my problem? First, you will need to upload the graphic (e.g. .gif or .jpg file) to your construction space and then publish it. THen in the text area of your problem, add the following: (Advanced Users) You can also have: If $picture is one of many ranomized graphics, you will need to "Edit XML" and add all the various graphics to the tags at the bottom. Look at other problems that have images to see how the tag should be formatted. More complete is the following: (Picture of Large Duck) This will probably alternate text for ADA-compliance and non-graphical browsers. The Web version will show up at 400 pixels wide (though it's typically better to use the natural width of the figure). In this case, the width of the figure in TeX will be half of one column. LON-CAPA User Help : Authoring : Authoring Problems : How do I create a problem? To create problems, do the following: 1.) Become author 2.) Go into the appropriate folder 3.) In the drop-down box near the very top that says "Select Action" select the option "New Problem" 4.) In the text-box next to the drop-down box that says "Type Name Here" type the name of your new problem. 5.) Click Go 6.) Click the continue button after you are prompted on the new screen. 7.) Select a problem template on the new screen from the drop-down box. 8.) Click the Create Problem button. 9.) Use the Edit button to edit the problem template. LON-CAPA User Help : Authoring : Authoring Problems : How do I display dollar signs in my problem? if you did $dollar='$'; this will work however this is a bad idea. Have them do this: Script: $a=&random(1,10,.01); Text: You have $${a} monies. If they want to use $ in the answer they will need to do a string answer type. They will also need to do this: Script: $a=&random(1,10,.01); $answer='$'.$a; Text: You have $${a} or $answer monies. Response: You can also use: &prettyprint($var,'$2f') LON-CAPA User Help : Authoring : Authoring Problems : How do I code an absolute value? in the script block: $a=-2; $c=&abs($a); in the text block: I have $a and $c. displays: I have -2 and 2. LON-CAPA User Help : Authoring : Authoring Problems : Parameters for parts problems You should fill in the parameter fields as Name: tol Description: Tolerance no matter which part it is in. The system will take care of putting the [Part: num] for you when it is published. The same goes for sig and "Signficant Digits" LON-CAPA User Help : Authoring : Authoring Problems : Where are the LON-CAPA units defined? /res/adm/includes/capa.units As of April 11, 2002: # The LearningOnline Network with CAPA # Physical Unit definitions # # $Id: 94,v 1.9 2003/06/13 20:08:58 apache Exp $ # # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). # # LON-CAPA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # LON-CAPA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with LON-CAPA; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # /home/httpd/html/adm/gpl.txt # # http://www.lon-capa.org/ # # # ======================= Unit section ============= # Base Unit # name symbol comment << Base Unit >> meter m # length kilogram kg # mass second s # time ampere A # electric current kelvin K # thermodynamic temperature mole mol # amount of substance candela cd # luminous intensity decibel dB # log of pressure amplitude # Prefix symbol factor << Prefix >> yotta Y 10^{24} zetta Z 10^{21} exa E 10^{18} peta P 10^{15} tera T 10^{12} giga G 10^9 mega M 10^6 kilo k 10^3 hecto h 10^2 deci d 10^-1 centi c 10^-2 milli m 10^-3 micro u 10^-6 nano n 10^-9 pico p 10^{-12} femto f 10^{-15} atto a 10^{-18} zepto z 10^{-21} yocto y 10^{-24} # Derived Unit # name symbol unit comment # name must be in oneword <> gram g 0.001 kg # mass day day 24.0 hr # time year yr 365.24 day # time hour hr 3600. s # time hour h 3600. s # time minute min 60 s # time pound lb 0.45359237 kg # mass ounce oz 1.77185E-3 kg # mass inch in 2.54 cm # length foot ft 12 in # length mile mi 5280 ft # length yard yd 0.9144 m # length nautical_mile n_mi 6080 ft # length, nautical mile (UK) rood rood 1210 yd^2 # area, rood acre acre 4840 yd^2 # area, acre hertz Hz 1/s # frequency litre L 10^3*cm^3 # volume newton N m*kg/s^2 # force pound_force lbf 4.44822 N # force dyne dyn 1E-5 N # force pascal Pa N/m^2 # pressure, stress bar bar 1E5 Pa # pressure mmHg mmHg 1.33322E2 Pa # pressure, millimeter of mercury torr torr 1 mmHg # pressure atm atm 760 torr # standard atmosphere joule J N*m # energy, work, heat electronvolt eV 1.6021892E-19 J # energy calorie cal 4.1868 J # energy Btu Btu 1.05506E3 J # energy watt W J/s # power, radiant flux coulomb C A*s # electric charge volt V J/C # electric potential, electromotive force ohm ohm V/A # electric resistance, use this in /ANS ohm ohms V/A # electric resistance ohm Ohm V/A # electric resistance ohm Ohms V/A # electric resistance siemens S 1/Ohm # electric conductance farad F C/V # electric capacitance tesla T V*s/m^2 # magnetic flux density weber Wb V*s # magnetic flux henry H V*s/A # inductance radian rad m/m # plane angle degree deg 1.745329E-2 rad # plane angle (Pi rad=180 deg) steradian sr m^2 /m^2 # solid angle lumen lm cd*sr # luminous flux lux lx cd*sr/m^2 # illuminance becquerel Bq 1/s # activity (radioactive) gray Gy J/kg # absorbed dose (of radiation) sievert Sv J/kg # dose equivalent (dose equivalent index) astroUnit AU 1.49598E11 m # mean distance earth to sun celcius degC 1 K # multiplicatively OK farenheight degF .5555555555 K # multiplicatively OK LON-CAPA User Help : Authoring : Authoring Problems : How do units work? English http://capa4.lite.msu.edu/devolibrary/Links/UnitsSymbolsT2.html Hungarian http://capa4.lite.msu.edu/devolibrary/Links/UnitsSymbolsTh.html The above pages describe how units are used in CAPA (and LON-CAPA). If you enter two units with a space, multiplication assumed. For example, if you enter "N m", that is that equivalent to a J. Spaces are not allowed for the multiplier prefixes? In other words, you can't enter "k m" and have that be equivalent to a km. LON-CAPA User Help : Authoring : Authoring Problems : How do I define the default tolerance of a problem? > I have a pink parameters box so I can enter a tolerance. > > What do I put in for Name? tol > What do I put in for Type? tolerance > What do I put in for Description? Numerical Tolerance > What do I put in for Default? 2% > Are all of those fields necessary, or can I just put in "tol" for Name > and "2%" for Default and leave the rest blank? That would work, but without the tolerance for type, you can't change it without changing the problem, and without a description it will call it (tol) in the parmset screen. LON-CAPA User Help : Authoring : Authoring Problems : temperature units There is K degC and degF degC == K So don't ask for absolute temperatures, only delta tempatures. LON-CAPA User Help : Authoring : Authoring Problems : Is there anything special I need to do to prepare for exam-style questions? The following is from an email from myself, Guy Albertelli, and Ed Kashy. > As for the exam dual mode, I wonder if there is a way for Guy to program > LON-CAPA such that if a problem is put in a *.exam file and it happens > to be a problem, then the conversion to exam mode > will happen automatically. This is the plan. There might need to be some hints from the instructor about whether it is an online vs. a bubble sheet style exam. > I'm copying this message to Guy. If Guy thinks that we will need to > use an tag, We decided that this was an unnesseary idea. Additionally when a .problem/.exam/.quiz/.survey file is stuck in to a map you can change it's "behavior" from the default of what the extension implies to however you care to use it. LON-CAPA User Help : Authoring : Authoring Problems : tolerance? A tolerance of 2% means the student can be off by 2% and still get the answer correct. A tolerance of 2 means that the student can be off by +/-2 LON-CAPA User Help : Authoring : Authoring Problems : Formula response questions with XML example Answer is $ $answer $ The samples is supposed to be the points you sample the equation at. It lists the variables first (comma seperated) then an @ then ( (a comma seperated list of numbers equal to the number of variables) or (a comma seperated list of numbers equal to the number of variables, followed by an : followed by a comma seperated list of numbers equal to the number of variables, followed by a # folowed by an integer) ) Then optionally a ; and more of the numbers LON-CAPA User Help : Authoring : Authoring Problems : How do I put a table in my problem? Make your variables in a script block: $a = 1; $b = 2; $c = 3; $d = 4; Two ways to make a table: First Method: Make a table in dreamweaver (or any other html editor). Use the variables ($a, $b, etc.) in the table. Take the html code from your table (everything between
and
) and paste into the text block. Auxilliary First Method: (I've never tried this, but give it a shot). Save your table as some file name, example table.html, and upload it to your construction space. In the textblock of your problem, type: /res/msu/ciskepau/your-directory/table.html Tell me if this works! Second Method: Type the HTML code into the textblock yourself:
stuff for row one, column one stuff for row one, column two $a
stuff for row two, column one stuff for row two, column two $b
stuff for row three, column one stuff for row three, column two $c
stuff for row four, column one stuff for row four, column two $d
I've written a routine to produce tables easily for my problems which might be useful to people. Here's a quick description of how to use it: 1) import the library put this at the top of your problem (before any script blocks) /res/msu/hamlinmi/lib/MyLib.library 2) construct the table In your perl script block, collect your table entries into an array (each row in sequence): $p1 = random(450,500); # some random data... ... # the table entries in order... @data = ('age','number of births (thousands)', '18-25',$p1, '26-35',$p2, '36-50',$p3, '51-65',$p4); $table = &DTable(2,@data); # create a 2-column table 3) display the table In your problem text (or even outside of an "outtext" block) simply $table Notes using DTable: 1) the table is centered. If you don't like that, use the GTable routine instead. Currently thats the only difference between them. 2) because the table is displayed usnig , entries in the table cannot contain markup (HTML), unless you specifically prepare them for both output modes, by using the web() function for example. In other words, don't feed this to DTable: @data = ( 'heading', 'data', ... ); because although this would look fine on the web, it would NOT print properly. If you really want those italics, do something like this instead, which should print fine: @data = ( web('','{\em heading}','heading'), '', ... ); 3) columns are usually center aligned by default, although you can change this: $o_calign = 'rl'; # column alignments: right, left $table = &DTable(2,@data); The $o_calign string has one letter for each column, acceptable letters are {r, l, c}. For those familiar with LaTeX, this string is passed as the first parameter for a tabular environment, and you may also include vertical bars "|" for vertical dividers in your table: $o_calign = 'c|cl'; # vertical bar between column 1 and 2 $table = &DTable(3,@data); # 3 columns Currently you can only add bars to the LaTeX output, not the web output.. (hope to get it for web too eventually) 4) other options to control the display of the table are also working. Simply set the value of these variables before calling the DTable routine. This one sets the absolute text size: $o_tsize = 3; # use a large text font $o_tsize = -2; # use small text (any value -4 to 5 accepted) This one appends (or prepends) text to all table entries: $o_utag = ' cm'; # append ' cm' to every table entry $o_utag = '^the '; # prepend 'the ' to every entry $o_utag = web('^$','^\$','^$'); # prepend $ This one prepends each table entry with a label (Note: if you use this, column alignment defaults to left instead of center): $o_labelt = 'A'; # label entries with capital letters $o_labelt = 'a'; # label with lowercase letters $o_labelt = '1'; # label with numbers These options currently affecting LaTeX output only (at some point they should affect web output too): $o_vskip = 2; # add 2mm space after each line $o_hbars = ' - '; # horizontal line below 1st row (3-row table) $o_hbars = '- -'; # horizontal line above and below 4-row table More improvements are eventually coming... [hamlinmi@msu.edu] Click on the link titled "Show this answer as Text" to see the code examples I gave in the correct form. The FAQ-o-Matic has its own markup rules and it doesn't show the text as I typed it... [hamlinmi@msu.edu] LON-CAPA User Help : Authoring : Authoring Problems : What do I do about warnings? GET RID OF THEM! Make sure all your tags have a closing tag or have a slash at the end (

can be denoted
). Problems should have no warnings! Plain HTML pages _may_ be able to handles some of the warnings, but problems should be warning free. LON-CAPA User Help : Authoring : Authoring Problems : Display TeX, using &tex, <tex >, <web >, etc &tex('tex argument','web argument') could become tex argumentweb argument inside of , , and &tex(): $ math mode $ $$ display equation mode $$ \[ display equation mode \] LON-CAPA User Help : Authoring : Authoring Problems : Is there a LON-CAPA analog to the CAPA functions? Yes, for example random(1.0,10.0,0.5) can be replaced by &random(1.0,10.0,0.5). All of the CAPA functions can work in the LON-CAPA script - just put a "&" in front. LON-CAPA User Help : Authoring : Authoring Problems : When I click ScriptVars in constructions space, what does $" mean? $" is the default list seperator value. It always shows up. Don't worry about it. LON-CAPA User Help : Authoring : Authoring Problems : How do I center an entire problem, including the [Submit Answers] button? > > The centering problem: > > > > > > > >
> > > > > > > > > >
> > > >
> > > > Works. There is the problem of having no part 0 anymore, but if all of > > their problems are based of this template all new problems will be a > > part 11 problem. > > Is the necessary? > Yes, if you want the submit button and computer feedback centered as well. LON-CAPA User Help : Authoring : Authoring Problems : How do I make a dynamically generated plot? Dynamically generated plots are used to produce graphs which will be different for each student who views them. The plots are produced by calling 'gnuplot', and in fact the xml tag for the plots is . Online help for the tag is available by accessing the 'help' link when editing the problem. Dynamically generated plots should be used in conjunction with a perl script block which generates the data to be plotted. If you are using static data a dynamically generated plot is not appropriate because of the overhead associated with generating the plot. There are a great deal of parameters that can be set for a plot. These parameters are accessed by including various sub-tags. By default only the tag and tag are present in a plot. The sub-tags allow you to define the axes of the plot, the presence of a key, the placement of gridlines, and the title and legends on the plot. The example given below shows the use of the sub-tag to set the domain and range shown in the graph. Below is an example which produces a simple plot. To use it, create a new problem and [edit xml]. Remove all of the text and replace it with the text below: @X @Y
What is the amplitude of this function?
Below is a screenshot (in construction space) of the resulting plot. baginline:dynamically_generated_plot.gif It's likely that the above plot doesn't quite look right. It would be nice to have the gridlines drawn every 1 unit instead of every 2 units. A title, and labels on the axes, would be a nice addition. Although it's overkill for this example, we can also add a key for the plot. We can accomplish these changes by inserting sub-tags into the tag. Gridlines can be set using the and tags. The names of these tags correspond to the names of the commands used in gnuplot. We specify the beginning, end, and increment of the tick marks. Gnuplot only puts gridlines on the tick marks. Inserting the , <xlabel>, and <ylabel> commands allows us to set the title and axes labels as one would expect. Inserting a <key> tag, but not changing any of the information in it, signals gnuplot to place a key in the graph. If we decide we don't want the key, deleting the <key> tag will remove it from the graph. These changes in the xml are shown below and a screenshot of the new plot is provided as well. <problem> <script type="loncapa/perl"> $amplitude = &random(3,5,1); for ($x=-6.0; $x<=6.0; $x+=0.05) { push @X,$x; push @Y, $amplitude * sin($x); } </script> <gnuplot font="medium" width="400" grid="on" height="300" border="on" fgcolor="x000000" alttag="dynamically generated plot" align="center" bgcolor="xffffff" transparent="off"> <key title="" pos="top right" box="off" /> <ylabel >Y</ylabel> <xlabel >X</xlabel> <title >A sample plot @X @Y
What is the amplitude of this function? baginline:dynamic_plot_2.gif LON-CAPA User Help : Authoring : Authoring Problems : How can I create a dynamic plot of a piecewise defined function? I want to plot a piecewise defined function similar to f(x)= a*x + b if (x < 4.5) f(x)= a*x if (x >= 4.5) Below is xml for creating a dynamic plot based on this. The work is done in the block that generates the data sets used in the plot. @X @Y The above script works, but it produces a plot that looks like the one below: baginline:dynamic_plot_piecewise_crappy_example.gif A better solution is to use two seperate statements to plot two separate curves. So on the second piece of the function we use @X2 and @Y2 instead of @X and @Y. Then in the tag we include a second sub-tag. @X @Y @X2 @Y2 baginline:dynamic_plot_piecewise_better.gif This is still not a desirable result. Typically one wants an open circle or closed circle defining the domain of each piece. Unfortunately there is no easy way to do this in gnuplot currently. If this effect is desired, perhaps using a static image and a randomlabel problem would be the best approach. A second solution would be to add data which draws a circle to your curves. LON-CAPA User Help : Authoring : Authoring Problems : Gnuplot Example 1 <problem> <script type="loncapa/perl"> # Enter computations here $m = random(-3,3,2); $b = random(-4,3,1); $equation = "$m*x+$b"; </script> <gnuplot font="small" samples="100" width="500" grid="on" height="300" alttag="Linear Plot" border="on" fgcolor="x000000" align="center" bgcolor="xffffff" transparent="off"> <xtics end=" 10.0" location="border" start="-10.0" increment="1.0" mirror="on" /> <ytics end=" 10.0" location="border" start="-10.0" increment="1.0" mirror="on" /> <axis ymin="-4.0" ymax="4.0" xmin="-6.0" xmax="6.0" color="x000099" /> <xlabel>X</xlabel> <ylabel>Y</ylabel> <curve linestyle="lines" pointtype="0" name="Line" color="x000000"> <function>$equation</function> </curve> <curve linestyle="lines" pointtype="1" pointsize="1" name="" color="x000000" > <data>-10,0,10</data> <data>0,0,0</data> </curve> <curve linestyle="lines" pointtype="1" pointsize="1" name="" color="x000000" > <data>0,0,0</data> <data>-10,0,10</data> </curve> </gnuplot> <startouttext /><br /> What is the slope of the line graphed above? <endouttext /> <numericalresponse answer="$m"> <responseparam name="tol" type="tolerance" description="Numerical Tolerance" default="5%" /> <responseparam name="sig" type="int_range,0-16" description="Significant Figures" default="0,15" /> <textline /> </numericalresponse> </problem> [hallmat3@msu.edu] LON-CAPA User Help : Authoring : Authoring Problems : Gnuplot Example 2 <problem> <script type="loncapa/perl"> # Enter computations here # # We will plot the graph of y=a sin((x-b)/2pi) by generating points # # The points will be stored in two arrays, @X and @Y. # $a = &random(2,5,0.5); $b = &random(0,4,1); $x_min = -8; $x_max = 8; $x_delta = 0.1; for ($x = $x_min;$x<=$x_max;$x+=$x_delta) { push (@X,$x); push (@Y,($a*sin(($x-$b)/2*$pi)) ); } </script> <gnuplot font="large" width="600" samples="100" grid="on" height="300" alttag="Sine Curve Plot" border="on" fgcolor="x000000" align="center" bgcolor="xffffff" transparent="off"> <axis ymin="-5" ymax="5" xmin="$x_min" xmax="$x_max" color="x000000" /> <curve linestyle="linespoints" pointtype="0" color="x000000" name="Sine Curve"> <data>@X</data> <data>@Y</data> </curve> </gnuplot> <startouttext /><br /> What is the amplitude of the sine curve graphed above? <endouttext /> <numericalresponse answer="$a"> <responseparam name="tol" type="tolerance" description="Numerical Tolerance" default="5%" /> <responseparam name="sig" type="int_range,0-16" description="Significant Figures" default="0,15" /> <textline /> </numericalresponse> </problem> [hallmat3@msu.edu] LON-CAPA User Help : Authoring : Authoring Problems : Can I create a problem which presents a choice from completely different questions? Yes. e.g. (where * = a response type, such as "radiobutton", "string", "numerical") <*response id="11"> ...statement and response parameters etc... < /*response> <*response id="12"> ...statement and response parameters etc... < /*response> <*response id="13"> ...statement and response parameters etc... < /*response> < /randomlist> The above will produce a single question that is selected randomly from the different questions delineated by the <*response >< /*response> tags. OR You could put the individual problem choices in libraries -- and choose problem parts from selected groups: sample1.library< /import> sample2.library< /import> sample3.library< /import> < /randomlist> < /part> sample4.library< /import> sample5.library< /import> sample6.library< /import> < /randomlist> < /part> The above will make a two-part problem where there is one library chosen from each group of three. CAUTION: It is advisable NOT to use whatever< /part> whatever< /part> whatever< /part> < /randomlist> as this will create multiple (redundant or useless) part numbers in PARM and SPRS and make grading and course management more difficult. [batchelo@sfu.ca] LON-CAPA User Help : Authoring : Authoring Problems : Equation Entry Example <problem> <script type="loncapa/perl"> # Enter computations here $x1 = random(2,4,1); $y1 = random(3,7,1); $x2 = random($x1+1,9,1); $y2 = random($y1+1,15,1); $m = "($y2-$y1)/($x2-$x1)"; $b = "$y1-$m*$x1"; $answer = "$m*x+$b"; $answer =~ s/\+-/-/g; $answer =~ s/-\+/-/g; </script> <startouttext /> <p> What is the equation of the line which passess through ($x1,$y1) and ($x2,$y2)? </p> y = <endouttext /> <formularesponse samples="x@-5:5#11" id="11" answer="$answer"> <textline size="25" /> </formularesponse> </problem> [hallmat3@msu.edu] LON-CAPA User Help : Authoring : Authoring Problems : When to use <display> tag Functions that must be inside of a <display> when outputting text: &prettyprint &tex &web &xmlparse Functions that shouldn't be used but if used need it &dollarformat (use pretty print instead with '$2f') &var_in_tex More gory details: When coverting the HTML of a problem to LaTeX, Lon-CAPA assumes that the contents of the entire problem, and the contents of all variables that it expands is HTML,. LaTeX has some charactes that are special, as they tell it to do special things. In order to not have the characters that HTML generates confuse LaTeX we need to protect them. The problem with the &xmlparse(), &prettyprint() etc functions is that when printing, these functions rather than genearte HTML, they generate LaTeX code. So the assumption that everything is in HTML is wrong, and can cause things to break. Thus enters the <display> tag. The <display> tag says, that this variable's value or function's result is safe to pass directly to the LaTeX engine. LON-CAPA User Help : Authoring : Authoring Problems : Adaptive Hints Adaptive or conditional hints in LON-CAPA Note: an extra space has been added before each tag closure in any tags included below so that the text will be displayed correctly by the FAQ-O-Matic. Hints are placed within tags. The first part of the hint is the condition, which includes a specification of the foil(s) and foil answer(s) required to trigger the hint. The answers specified in the hint condition are compared with the user's submission, and if the condition is met, the hint action included in the conditional hint block will be executed (for example this could be the display of a block of text). You can set multiple hint conditions for a particular problem. Hint conditions are identified by a name. The corresponding hint action includes this hint condition name in the "on" parameter). When a hint condition evaluates to true, the corresponding hint action is triggered. Besides providing hint actions within tags for each named (NAME) hint condition, a hint can be designated for display if none of the conditional hints evaluate to true. The default hint is not displayed if the conditions were met for any of the conditional hints. The default hint action is included between tags. There are five types of hint condition: Formula Hint condition Numerical Hint condition Option Response Hint condition Radiobutton Hint condition String Hint condition The syntax used to describe the foil(s) and the foil answer(s) differ for the five types: 1. Formula Hint condition The formulahint tag takes three parameters: answer, name, and samples. The "name" is the unique name given to the hint condition. The formula answer for which you wish to provide conditional is included in the answer parameter. The samples parameter includes the points (or range of points) over which sampling of the student's submitted answer and the formula included in the formula hint answer parameter are to be compared. The syntax is the same as used to specify sampling points in the samples parameter of the formula reponse tag itself. The formula submitted by the student is evaluated at the sample points for the hint and the calculated values are compared with the corresponding values determined by evaluating the "hint" answer at the same sampling points. A close correspondence between the two sets of values will trigger the hint action specified in the tag.

What is the equation of the line which passess through ($x1,$y1) and ($x2,$y2)?

y = You have inverted the slope in the question. Slope is (y2-y1)/(x2 - x1) you have the slope as (x2-x1)/(y2-y1).
2. Numerical Response condition The numericalhint tag takes four parameters: answer, name, unit and format. The "name" is the unique name given to the hint condition. The numerical answer for which you wish to provide conditional is included in the answer parameter. Student submission of that answer in combination with the "unit" parameter in the hint condition will trigger the hint action specified in the tag. A car travels 10 km in 10 min. What is the speed of the car? You multiplied the distance by the time. Remember speed = distance/time 3. Option Response Hint condition There are two types of option response hint conditions: one for standalone foils and one for concept groups. In both cases the option hint tag includes two parameters: answer and name for standalone foils, and concept and name for foils grouped together in a concept group. For the answer parameter, the names and submitted values for each of the foils that are being included in the hint condition are provided in a hash, i.e., in the format: ('Foil1'=>'True','Foil2'=>'False'). In the case of a conditional hint for a concept group, the format of the concept parameter is also a hash that links the name of each concept group included in the hint condition to either 'correct' or 'incorrect' - e.g., If 'correct' is specified for a named concept then when the conditional hint is evaluated answers for each of the foils selected by a student must be correct for the hint action to be triggered. If anything other than 'correct' is provided in the concept hash in the optionhint tag then then students answers will be compared with the set answers for the foils in the concept group and as long as at least one answer is incorrect (i.e., the concept group was not correctly answered) then the corresponding hint action will be triggered. (a) optionresponse For each of the following rock types, indicate whether or not the rock is a volcanic rock. Schist Marble Basalt Gabbro Granite Schist and Marble are both examples of metamorphic rocks as described on page 2 of the textbook.

Granite and Gabbro are both examples of igneous rocks that crystallized beneath the surface, i.e., they are plutonic rocks.

Volcanic rocks are described on page 22 of the textbook.
(b) optionresponse with concept groups Choose the likely plate boundary type, where you are most likely to encounter each of the following geologic features or phenomena. Normal faults Strike-slip faults Thrust faults Large Magntitude, deep and intermediate focus earthquakes Large magnitude, shallow focus earthquakes Low magnitude shallow focus earthquakes Broad area of elevated topography with a central rift valley. A narrow linear fault zone with limited topgraphic expression. A deep trench adjacent to a volcanic arc. Explosive volcanism involving volatile-rich viscous magma. Non-explosive outpourings of low-viscosity magma. No volcanic activity. Volcanism requires a source of magma. Magma can be generated by either a depression in the solidus caused by an influx of volatiles, or by decompression melting. Magma rich in volatiles tends to cause explosive volcanism. Earthquakes require brittle failure, so there is a correlation between the depth of earthquake foci and the geotherm. The geotherm is depressed in subduction zones, and elevated at mid-ocean ridges. On a broad scale topography is an expression of density variation, as embodied in the concept of isostasy. Density variation in the earth is a function of temperature and composition. Cold oceanic crust entering a subduction zone is dense, whereas as magma is buoyant and of lower density.

The characteristics of plate boundaries are described on page 52 of the textbook.
4. Radiobutton Hint condition The radiobutton hint tag takes two parameters: answer and name. The name is the name of the hint condition, and the answer is an array. The first element of the array will be 'foil'; the remaining elements are the names of the foils that you require to have been checked by the student for the hint to be displayed. For example, if you create a radiobutton response problem with six foils named: granite, gabbro, gneiss, shale, sandstone and schist, and you want your hint named: igneous to be displayed when either granite or basalt had been checked your radiobutton hint would be as follows: In order to trigger display of this hint you also need to create a block that will include a textblock that contains the text of the actual hint. This type of rock is composed of interlocking crystals, a characteristic of igneous rocks. The complete radiobutton response would look as follows: Which of the following is a sedimentary rock? Granite Gabbro Schist Gneiss Shale Sandstone This type of rock is composed of interlocking crystals, a characteristic of igneous rocks.

This type of rock is composed of oriented crystals, a characteristic of foliated metamorphic rocks.
5. String Hint condition The radiobutton hint tag takes two parameters: answer and name. The name is the name of the hint condition, and the answer is a text string. The type parameter allows you to choose between case sensitive, case insensitive, and case insensitive in any order. A simple example is shown below. Which US state has Lansing as its capital? The state capital of Wisconsin is Madison. The state capital of Minnesota is St. Paul. The state you are looking for is also known as the 'Great Lakes State' An adaptive hint example for string response with detailed explanation of the code is available at: http://www.mockster.net/school/loncapa/adaptivestringhint.htm [raeburn@msu.edu, felicia@lon-capa.org] LON-CAPA User Help : Authoring : Authoring Problems : How do I make a multi-part problem DATA FOR ALL PROBLEM PARTS USE PART TAGS LIKE PROBLEM TAGS [felicia@lon-capa.org] LON-CAPA User Help : Authoring : Authoring Problems : How do I have hints show up after more than 1 try? The following problem code displays the hint for all tries greater than 1: This is the hint text LON-CAPA User Help : Authoring : Authoring Problems : How can I hard code the default maximum number of tries in a problem. The xml for this is Change the default="1" to whatever value you want. Note that this parameter applies to a problem part and is NOT a parameter inside a response block. It must appear outside the response block tags e.g. before < numericalresponse> but within the tags for a parted problem. You can use the CSTR graphical Edit features to aid you in inserting the correct xml when doing this. However, as of LON-CAPA v1.2, there was not a drop list item to insert parameter tags inside a problem or problem part. You will have to go to "editXML" and enter a pair of tags in the appropriate place. Once you have done that you will find in Edit that there is available a template for the maxtries parameter. [batchelo@sfu.ca] LON-CAPA User Help : Authoring : Authoring Problems : how to display variables that must be parsed first In script block: $equation=&xmlparse('$ \theta $ θ '); In text block: $equation [felicia@lon-capa.org] LON-CAPA User Help : Authoring : Authoring Problems : Specifying wrong answers for exam mode Example code shows how wrong answers are coded into a numerical response problem. What is the perimeter of a rectangle with a width of $a cm and length of $b meters? Make sure you are solving for the perimeter and not the area! [felicia@lon-capa.org] LON-CAPA User Help : Authoring : Authoring Problems : multiple correct answers for String Response problems using Regular Expressions An example: Not small, but [felicia@lon-capa.org] LON-CAPA User Help : Authoring : Authoring Problems : How can I use the quantity "pi" in a formularesponse? Define "pi" as a variable in the expression, but evaluate it at only one value, equal to the Perl variable "$pi". Example:

What is the area of a circle w.r.t. the radius, r.

You need to include π in your response.
Try "pi".
See the online contextual help for formularesponse in CSTR Edit mode for the syntax of the argument 'samples'. [batchelo@sfu.ca] LON-CAPA User Help : Authoring : Authoring Problems : New Item This document is at: http://help.loncapa.org/cgi-bin/fom?file=5 Generated by FAQ-O-Matic 2.719, available at http://faqomatic.sourceforge.net/