This is great module. I look forward to getting it up and running on my site.
I would like to be able to ask math questions using a mix of randomly generated numbers and randomly selected values from an set of fixed values. Is this possible?
For example, a physics question could ask a student to calculate the weight (in Newtons) of an object given its mass and the gravity of the planet it is on. The mass could be calculated using a=random() then a=round(a*995+5,0) to create a mass between 5 and 1000 g.
The second variable needed is the force of gravity. If the question allows the object to be on either Earth, Mars or our Moon, each new iteration of the question would need to chose a planet. using PHP the process could be done using something like the following:
$planet = mt_rand(1,3);
if ($planet = 1) { // Earth
$gravity = 9.8 ;
} elseif ( $planet = 2 ) { // the Moon
$gravity = 1.6;
} else {
$gravity = 3.7; // Mars
}
$gravity would then be used to calculate the ans value.
Comments
Comment #1
jvdkolk commentedWhat if you tried something like:
a=random()
g=1.6 + round(a+0.5-0.333)*2.1 + round(a+0.5-0.666)*6.1
What I did: I calculated the step sizes between the g's (so from 1.6 --> 3.7 = 2.1, from 3.7 --> 9.8 = 6.1).
The formula starts with 1.6,
1) it will add 2.1 to 1.6 if the random a is between 0 and 0.333 (so g will be 1.6+2.1 = 3.7)
2) it will add another 6.1 if the random a is between 0 and 0.666 (so g will be 1.6+2.1+6.1 = 9.8)
So in fact,
when a <= 0.333, g will be 1.6
when 0.333 <= a <= 0.666, g will be 3.7
when 0.666 <= a <= 1, g will be 9.8
Comment #2
amstar commentedrekor,
Thanks for the reply. Your solution will allow me to do exactly what I need with the numbers.
How about if I added the complication of wanting to assign a variable to hold the name of the planet so that could be used in the question as well?
In the php example above, I'd assign a new variable $planet_name to either "Earth", "Mars", or "the Moon" depending on the value of $planet.
$planet_name could then be used in the question:
Comment #3
jvdkolk commenteddear amstar,
I do not think that is possible right now..
But of course you could also rephrase your question into 'On the planet Amstaria, the gravity is', and then use the random number.
Comment #4
amstar commentedI'd like to make this a feature request. Using fictional names is a good work around but that level of abstraction is not ideal. Especially for adult learners who value applied knowledge.
Comment #5
jvdkolk commentedOk. So basically what you are asking it the ability to map numbers created with a math expression to text labels, and the ability to add these text labels in the question text.
The ClosedQuestion XML is would then become something like this:
It seems to be a quite interesting feature to me. The more users/use cases we can find supporting it, the more likely that this feature will be implemented :).
Comment #6
amstar commentedYes. That is the idea. I can not speak for other users but this structure is one I make use of often in introductory science. Other questions that I have written using straight PHP are:
In all of these cases I don't go crazy with options. I just try to have 3 or 4 sets for the system to select from. It makes the questions a little more engaging and complicates the math a bit.
Comment #7
HylkeVDS commentedIt's a very interesting feature, I'll have a look if I have time to implement it.
Comment #8
HylkeVDS commentedI've implemented the feature as follows (small example):
It is also possible to check against the users answer and use that in feedback.
Let me know what you think :)
Comment #9
amstar commentedHylkeVDS - The textlabel trigger is a great added feature. I've used it quite a bit. How hard would it be to get the trigger to return a variable instead of a text field?
The reason I ask is that I'd like the ability to add some more dynamism into each question. As an example, here is a question I am working on.
The question creates a population of between 100 to 500 rabbits. It then makes between 10 and 25% of them homozygous recessive for the trait of interest.
Closed question makes it very easy to set up a question that asks any one of the following questions:
But, I'd like to structure a single question to dynamically chose one of these options each time the question is reset.
Following the structure of the textlabel element, what I'd like to do is find the answer dynamically using something like this:
I can approximate this behavior with the solution given by koosvdkolk in comment #1 but it is very cumbersome.
Comment #10
HylkeVDS commentedHave you tried
I don't know if that will work though. It's been too long since I had a look at the code.
Comment #11
jvdkolk commentedMore information is needed from amstar...
Comment #12
amstar commentedI am sorry for the delay in replying. I did not notice HylkeVDS's comment (#10) and have been using the solution given by koosvdkolk in comment #1, aided by a small javascript script that helps me generate the multi-step rounding equations.
This has allowed me to write dynamic fillblanks with math problems with as many variations as I need.
I have recently started looking at the other question types offered by closed question and am interested in creating dynamic question for these question types as well.
I can use the single hotspot example available at the Wageningen MultiMedia Research Center (http://wmmrc.nl/drupal-modules/closedquestion/example-questions/hotspot-...) to illustrate. As written, the answer is always the enzyme-substrate complex.
It would be great if the question could vary by choosing among the following prompts each time the question was reset:
1 - Point out the enzyme-substrate complex
2 - Point out the enzyme-product complex
3 - Point out the free enzyme
The textlabel feature allows me to create variable text:
The textlabel feature also allows me to generated the question text:
<text>Point to the <textlabelresult id="featureName" variable="correctFeature" />.</text>What I have been unable to figure out is how to make the correct answer mapping vary based on the question variation. I think all of the features needed exist within the module, but I can not get them to work inside the hotspot question type. If range would work for hotspots the way it does for fillblanks, I could do something like this:
I've tried this but am unable to use range without inlineChoice or value attributes.
Comment #13
amstar commentedChanging status to invite comment.
Comment #15
jvdkolk commented