Selecting independent subsets of Question Calculation variables

Selecting independent subsets of Question Calculation variables

by bjem Milne -
Number of replies: 4
I have an electrical questions that I am trying to code as a calculated quiz question:

A {R} Ω resistor has a rated power dissipation of {P} W. What is the maximum current (in A) that the resistor can pass while not exceeding its rated power?

The formula is pow({P}/{R}, 0.5), which works fine.

However, what I want to do is to select {P} and {R} from two independent sets with predefined values.

For example, I would like the resistance set to be this:
{R} = [1, 2, 5, 10, 20, 50, 100, 200, 500]

And the power set to be this:
{P} = [0.25, 0.5, 1, 5, 10, 25, 50, 100, 250, 500]

And have the sets selected independently. In other words, there should be 90 possible questions.

Is it possible to do this easily? It seems that you cannot edit the sets of values independently, and have to enter fixed values pair by pair.

I cannot determine the version of Moodle our institution is using.

Thanks
Bart
Average of ratings: -
In reply to bjem Milne

Re: Selecting independent subsets of Question Calculation variables

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Not easy to do this with the standard calculated question type. Nor with the add-on 'variable numeric sets'.

(Well, it is possible, but you need to create all 90 pairs of values as separate datasets.)

The alternative is to just generate 10 or so pairs of values yourself. Given the formula, any case where R is equal to P is easier because the division is just 1, as are cases where P/R is 1, 25 or 100, because then the sqrt is obvious. So if you do 'randomly' select some pairs yourself, you can ensure that they are all about equally difficult.

It is possible to do exactly what you want with add-on question types STACK, and I assume with Formulas, since they give you much more control but obviously they require installing extra plugins.
Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Selecting independent subsets of Question Calculation variables

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Definitely can be done with Formulas question type.
Average of ratings: Useful (1)
In reply to AL Rachels

Re: Selecting independent subsets of Question Calculation variables

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

and most easily!

Random variables
   R = {1,2,5,10,20,50,100,200,500};
   P = {0.25,0.5,1,5,10,25,50,100,250,500};
Global variables
   I = pow(P/R,0.5);
Answer
   I
Unit
   A
Part's text
   {_0}{_u}
Average of ratings: Useful (1)
In reply to Dominique Bauer

Re: Selecting independent subsets of Question Calculation variables

by bjem Milne -
Thank you all. I am in the process of getting this question type installed.