Quiz

 
 
Picture of Peter Halverson
Wishing for graphing question type
 

Hello again...

I asked about this about a year ago, and nothing came of it. But it doesn't hurt to keep asking, I guess.

In science GRAPHS are very important.  Virtually every discovery in modern physics has come to a researcher's attention as a bump or a blip or some oddity in a graph.  I really really have to make my students proficient at reading and creating graphs.

Reading graphs:   We need a add-on to the calculated question type, where Moodle creates graphs that can then be used as the basis a question.   "Given this graph [Moodle generated graph goes here] estimate the velocity of the car."

Creating graphs:  We need some sort of tool where the student clicks on a "graph paper" and connecting lines show up and form the basis of a student-created graph.  The x,y coordinates of the click would somehow be analyzed and feedback (a grade and/or comments) provided.  I asked about this in the past and I did follow the suggestion of using drag-and-drop markers.  The drag-and-drop question type works if you just want the student to indicate a few points.  But its no good if you want a line graph. Also every student will get exactly the same question.  There's no way to make the question randomly calculated to prevent students copying each other.

Have I missed some key features of moodle?

Anyhow, I really appreciate all the good stuff that is already in Moodle.  Its a fantastic time-saver and the students like it.

Sincerely,

Peter Halverson

 
Average of ratings: -
Picture of Jean-Michel Védrine
Re: Wishing for graphing question type
Group DevelopersGroup Particularly helpful Moodlers

Hello Peter,

I don't have a good answer to point #2 (creating graphs) but I think that Stack question type is a good answer to point #1 (Reading graphs) because it use gnuplot to generate graphs included into questions and these graphs can be different for each attempt.

 
Average of ratings:Useful (1)
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Thank you for the suggestion.  I'm just wondering about the learning curve for the Stack Question Type.  How long will it take me to become proficient at creating content with this approach?  (I am already familiar with LaTex)

 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Hello,

The Stack question type looks very promising, but I am having trouble installing it.  I'm getting errors (see attachment) where the stack question type is dependent on other things.

I'm using moodle 2.4.

What I have done in this installation attemps is to download all of the Stack question type files from here: https://moodle.org/plugins/browse.php?list=set&id=17

and I put them all into the moodle/question/type and unpacked them.

The error message complains about missing these items, but they are there, or at least I did put them and unpack them.

Any ideas?To get unstuck from the error, I have to delete the Stack folder.  After I do that I get a list of items to be installed, which I am also attaching.  Don't know how useful this information is.  Finally I get this error when I click "upgrade moodle database"

Plugin "qtype_adaptivemultipart" is defective or outdated, can not continue, sorry.  Debug info: Plugin installed in wrong folder.
Error code: detectedbrokenplugin   Stack trace:
line 387 of /lib/upgradelib.php: plugin_defective_exception thrown
line 1544 of /lib/upgradelib.php: call to upgrade_plugins()
line 349 of /admin/index.php: call to upgrade_noncore()

Also, will I have to install maxima and gnuplot?  I attempted to install maximum but I do not have super-user privileges on the Hostgator machine that my web site and moodle is on.

Sincerely,

Peter Halverson



 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Don't bother replying to my previous post.  I figured it out.

In order to install Stack without errors...

This goes into /moodle/question/type: qtype_stack, which unpacks to a folder called stack

This goes into /moodle/question/format:   qformat_stack, which unpacks to a folder called stack

These go into
/moodle/question/behaviour:    adaptivemultipart    dfcbmexplicitvaildate    dfexplicitvaildate

Success (I think)

BUT:   Now Stack is asking for commands to execute gnuplot and maxima.   As far as I can tell, these are NOT installed on the Hostgator server that I use.

I guess I will have to ask the Hostgator system managers for help.

---Halverson

Update:  It seems that Gnuplot is avilable in Hostgator via something called "ruby on rails"   (What???)

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Wishing for graphing question type
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

I just want to note taht STACK comes with good install instructions:

https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/Installation/index.md

and a good tutorial explaining how to author questions:

https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/Authoring/Authoring_quick_start.md

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Wishing for graphing question type
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

The way to do [Moodle generated graph goes here] is probably using a Generate graph filter. Wow! This is ancient: https://moodle.org/mod/forum/discuss.php?d=59356 but it illustrates the concept.

This example, outside Moodle, shows the kind of thing that is possible: http://www.open.ac.uk/openmarkexamples/p5_3.shtml. We could make a question type like that for Moodle.

 
Average of ratings:Useful (1)
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Hello Tim,

I followed your link.  Can the "walterzorn" filter make graphs that will be different for different students?

Also, it didn't seem there was any final distribution of a ready-to-use filter.  If there, where would it be?

 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Hi all,

The makers of jsxgraph, at the University of Bayreuth, have just posted a graphing filter for moodle 2.x.  (There is also one for moodle 1.9)

Its here: http://jsxgraph.uni-bayreuth.de/wp/download/tools/

It did try it and while it seems to work in Moodle web pages, I have not succeeded in making it work in Moodle quiz questions.

It would be really nice if a Moodle expert could look into it.  We can't really expect the jsxgraph folks to do it all for us.---Peter

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Wishing for graphing question type
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

For easier online browsing of the code, see https://github.com/jsxgraph/jsxgraph/tree/master/plugins/moodle/moodle2

This filter will execute arbitrary JavaScript typed by the user, and so is horribly insecure.

However, it is also quite a small amount of quite simple code, so it would be possible to make a more secure filter quite easily.

 
Average of ratings: -
Picture of Bernat Martinez
Re: Wishing for graphing question type
 

Hi,

Reading graphs is possible using formulas question type in Physics, see attachment (sorry in Spanish)

Graphs are displayed using google apis, and it uses the random variables generated by the formulas question, so different students have different-graphs.

Hope it helps


 
Average of ratings:Useful (1)
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Dear Bernat,

The example you attached looks great.  Can you show me how you did it?

Thanks,

Peter Halverson

 
Average of ratings: -
Picture of Bernat Martinez
Re: Wishing for graphing question type
 

Dear Peter,

I'm glad you like it and I will be pleased to show you how I do it

I'm a Physics teacher. We are using M1.19 and formulas question helps us to do many differnt types of Physics quizzes as it deals with units also. Obviously, when upgrading to M2.5 we will use STACK. But for the moment we are using the STACK for "poors" wink

First, you have to have installed  the formulas question type  created by Hon Wai Lau.  The refrence is Hon Wai Lau's Google code page : http://code.google.com/p/moodle-coordinate-question/

Once installed you can import the xml attached, it is a set of questions  about kinematics, some with graphs which change for every attempt.

Hope you find it useful

Bernat

 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Dear Bernat,

Thank you so much.  After much effort, I got the graphing questions to work!  That's the good news.

The bad news is that this type of question depends on a graphing service from Google.  When I started to use it I discovered it has been "officially deprecated" which means that they don't promise to keep it available.

First I want to document that to get the graphing questions to work with Moodle 2.4 I had to install

1)  https://moodle.org/plugins/view.php?plugin=qbehaviour_adaptivemultipart

2)  https://github.com/jmvedrine/moodle-qtype_formulas, the zip file in the lower right.  (Be careful not to use older versions, as it will damage your Moodle installation.)

Once those are installed, the formulas question type examples from http://code.google.com/p/moodle-coordinate-question/downloads/list work fine.

I tried your examples with graphs (from your previous response), and they work just fine too.

I want to use them!  But I'm worried that Google will blow the Image Chart feature https://developers.google.com/chart/image/ away.

In case other readers are interested, the key thing about Google's Image Chart is that they are generated by a single line of HTML code that is easily constructed by moodle.  For example, try to cut and paste this into a new browser window: http://chart.apis.google.com/chart?cht=lc&chd=t:-1&chco=FF0000&chfd=0,x,0,5,0.1,10*%28-1%29*%28x--1%29*%28x-5%29&chg=20,4&chs=400x400&chxt=x,y,x,y&chxl=0:|0|1|2|3|4|5|1:|0|25|50|75|100|125|2:||t|3:||h

You'll immediately see a projectile motion chart.  Perfect!  Fantastic!  BUT will Google take it away from us?

What a headache!  Are there any other ways to get this functionality?

Sincerely,

Peter Halverson

 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Hello Bernat (and anyone else who is interested),

So the combination of the Formulas Question Type or Calculated Question Type, linked with Google's Image Charts https://developers.google.com/chart/image/ works great for making questions with graphs.   BUT Google won't guarantee the continued existence of Image Charts.

BIG Problem.  I don't want my questions to die overnight because of Google. 

Here is a solution:

Its not too hard to create graphs using Javascript.  I think that all modern browsers work well with it.  The solution I am proposing works with Firefox 22 (Mac), Safari 6.05 (Mac), and Internet Explorer 10.0 (Windows 7).

To do it, you write a Formulas question or a Calculated question, and in the question text you embed a link to the graph.  Clicking the link causes the graph to pop up.  The graph can change for different instance of the question since you can pass a formula to it with randomized parameters.  Here's what it looks like:

I got the Javascript from a really cool repository of free code:

http://www.javascriptsource.com/math-related/function-grapher.html

Note that this link gets you code that is out-of-date.  It was posted in 2000 and won't work due to the evolution of js.  I am attaching code that I modified so it works with modern browsers.

This graphing routine is really minimalist.  I have found a nicer, more complete graphing routine here:

http://www.javascriptsource.com/math-related/jsgrapher-07-alpha-877051.html

but I haven't been able to adapt it to Moodle.  (Its more complex and I haven't had the time)

And it is possible to write javascript that records mouse positions and mouse clicks, so in principle, one could make the other thing I want: a way for students to draw graphs and submit them to Moodle.

The files I am attaching are:

1)  jsgraph0.html   --  Draws the graph

2)  test_javascript_graph.html  -- This allows you to test the graphing without Moodle.  Try it here first, to study how it passes data.

3)   graph.gif and 4) espace.gif   --  files needed by jsgraph0.html

To test:  Create a directory, call it something like jsgraph0.  Put the two .html and the two .gif files in it.  Double-click test_javascript_graph.html (or open it explicitly with your web browser).   You can make graphs right away.

To integrate into Moodle:  copy (via sftp or whatever) the folder you created (eg jsraph0) into your server's /public_html/moodle/ directory (or any other convenient place that browsers can access).  Test the code using test_javascript_graph.html

When you create a question, paste the URL from the testing into a link in the question text box.  Its easy, but you need to pay attention to get variables to pass their contents right.  (If there are questions about this step, please ask.)

So...  Bottom line:  its possible to make graphing question on a limited resource system (ie my Hostgator account).

---Peter Halverson

PS:  I did explore the STACK question type for making graphing questions.  The problem is that Hostgator won't let me install LISP and GnuPlot.

 
Average of ratings:Useful (1)
Picture of Bernat Martinez
Re: Wishing for graphing question type
 

Hi Peter, 

Yes we are also worried also about Google guarantee the continued existence of Image Charts.

Your solution seems right, anyway we are considering to try  JSXGraphhttp://jsxgraph.uni-bayreuth.de/wp/

It has a plugin for moodle http://jsxgraph.uni-bayreuth.de/wp/download/tools/

It looks promising, but we are not sure if it works in Moodle 1.19, so we are going to investigate if it works for formula questions

Hope it helps

Bernat

 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Hello Bernat, and anyone interested,I'm very close to getting practical, easy-to-use graphs in quizzes.  I have managed to interface jsxgraph xy plots to calculated and formulas type questions.  The result is graphs that vary student-to-student as different random coefficients are used.

I'm attaching the code that makes it possible.  I'm calling it "jsxgraph0"  (0 means its my 0th attempt...)  Put this folder with code on your hard drive at first, just for testing, then later, put it in your moodle server.  I put it in my public_html/moodle directory.

Here is what you do:  First, using Firefox or IE or whatever, open GenericFunctionForMoodle0Tester.html and click "plot".  A window with a plot will open.  Close it and try different formulas, to get familiar with the syntax.

I will explain how to make a question that looks like this:

First: Create a question.  For this explanation, I will use a Calculated Question, but it will work just as well with a Formulas Question.

You should know the form of the equation that will be graphed, and you should know which number will be randomly varied. 

In this example the equation is y=x^e, where e is a random number between 0.1 and 1.5.  To output e, the syntax in Moodle is {e}.

Create a link, such a "click HERE" by selecting the "HERE" and clicking the chain icon.  Select "pop-up", select "javascript".  Now here is the tricky part:

Go back to your testing and copy the URL that went into the the GenericFunctionForMoodle0 window, and paste it into the Moodle Pop-up URL. 

Replace the number for the randomly chosen exponent with {e} or whatever variable name your used in the question.

Set the window size to 420x420 pixels, and enter "c" and "c" (center) for the window position.

In my case, the PopupURL was this: 

http://halverchemphysics.net/moodle/jsxgraph0/GenericFunctionForMoodle0.html?graph=Math.pow%28x,{e}%29

Interestingly, parentheses are converted by Moddle into escape sequences.  %28 means  "(" and %29 means ")".  I didn't do that.  It just happened. 

Notice the {e}.  When a student takes a quiz, the {e} is replaced by a random number.  (In the first picture, the {e} became "1.23")

It works very well!

There are, however, a few things that need to be done before it is really practical for student use.

1)  I want to not have to access the Bayreuth University every time my students take a quiz.  In other words, we need to download and install the jsxgraph code locally.  This is especially important due to the fact that the jsxgraph code is likely to change as it is still under development.  We don't want their changes to cause all the quizzes to suddenly stop functioning.

2)  The ability to control the x and y limits is needed.  3)  It would be nice to be able to have more than one graph at a time  4) it would be nice to be able to graph a series of numbers.

Fun fun fun!

Peter Halverson

 
Average of ratings:Useful (1)
Picture of Bernat Martinez
Re: Wishing for graphing question type
 

Hi Peter, 

Your approach is very clever but if you would like to avoid the pop up, you could embed the code in a iframe like this

<iframe width="420" height="420" border="0" src="http://halverchemphysics.net/moodle/jsxgraph0/GenericFunctionForMoodle0.html?graph=Math.pow%28x,{e}%29"></iframe> 

I've made a test and it works, see attach

Hope this helps

Bernat


 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Hi everyone,

FYI, I posted "version 1" of a graphing interface for jsxgraph.  Its here:

https://moodle.org/mod/forum/discuss.php?d=233741

---Peter Halverson

 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

By the way,

Has anyone gotten the jsxgraph Moodle Filter (link) to work?   I can't figure it out.

Halverson

 
Average of ratings: -
Dr. Peter Gehbauer, PhD
Re: Wishing for graphing question type
 

Embedding jsxgraph images into a web page is easy and the dependency on an external site may be eliminated.

What you need to do is to upload the jxgraph zip file and upzip it to a known and accessible location. I created a folder called "moodle_supplements" for this purpose. Now, create equivalents to the java script statements:

<link rel="stylesheet" type="text/css" href="http://your location here/jsxgraph/jsxgraph.css" />
<script type="text/javascript" src="http://your location here/jsxgraph//jsxgraphcore.js"></script>

and add the above to the WITHIN HEAD section in:

administration ==> appearance ==> additional HTML ==> 

To see a graph, paste the following into the HTML view of a moodle page:

<div id="jxgbox" class="jxgbox" style="width: 350px; height: 350px;"></div>
<script type="text/javascript">// <![CDATA[
var f = function(x) { return x*x+2*x-3; };

var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-4,2,2,-5], axis:false, grid: true, keepaspectratio:false});

var axisx = brd.create('axis', 0,0], [1,0,
{
firstArrow: true,
lastArrow: true,
label: {offset: [-40, -20]},
    ticks: {
      drawZero: false,
      ticksDistance: 1,
      tickEndings: [1,1],
      minorTicks: 1,
majorHeight: 30,
minorHeight: 10
    }
});

var axisy = brd.create('axis', 0,0], [0,1
  {
    firstArrow: true,
    lastArrow: true,
    ticks: {
      drawZero: false,
      ticksDistance: 1,
      tickEndings: [1,1],
      minorTicks: 1,
majorHeight: 20,
minorHeight: 10
    }
  });

var start = -5,
end = 5,
x = start,
step = 0.1,
turtle = brd.create('turtle', [x, f(x)], {strokeColor:'#0000ff',strokeWidth:2});

var moveForward = function() {
x += step;
if (x>end) {
return;
}
turtle.moveTo([x, f(x)]);
setTimeout(moveForward, 25);
};

turtle.hideTurtle();
moveForward();
// ]]></script>

Give this a try. It works for me. Of course, you want to replace the function with one of your own or indeed use other jsxgraph features. I did try to upload the so-called jsxgraph moodle filter, and moodle recognizes it but I'm sure that I'm not actually using it. In the same way, I am using the mathjax equation rendering tool. I'll remove the jsxgraph filter as unnecessary.

Please let me know how you get along with this. I still want to get the STACK question type going; I have limited access to my domain and have asked the ISP to intall both the gnuplot and maxima tools in support of STACK. Maybe there is a version of STACK that can use jsxgraph instead?

Useful links:

 Cheers,

-- 

Peter
Peter Gehbauer PhD
 100 Words: My Philosophy of Educational Leadership 
 
I see myself as instructional leader and change agent. Acknowledging that the current generation of screenagers is different from previous generations of learners, I accept the challenge to collaboratively prepare them for a future that, today, we cannot clearly describe. I believe we should build competencies; yes, our students should learn “the content” (skills and knowledge) but also positive attitudes and ethical behaviours to be successful in life. A lifelong learner, I see learning as bi-directional, willingly sharing what I learn with others. I encourage others to emulate this. Used correctly, I believe in the power of technology to magnify intellect.

 

 
Average of ratings: -
Dr. Peter Gehbauer, PhD
Re: Wishing for graphing question type -- Addendum
 

Calculated question types use wildcards. In the HTML, it is straightforward to create, for example, a quadratic equation using wildcards; it appears that this substitution takes place before anything else happens. Try this:

In the above (my previous post), replace:

var f = function(x) { return x*x+2*x-3; };

with:

var f = function(x) { return {a}*x*x+{b}*x+{c}; };

I've not verified this, but previous experience with equation rendering using the codecogs tool suggests that this too would work nicely.

 
Average of ratings: -
Picture of Peter Halverson
Re: Wishing for graphing question type
 

Hello Peter G.   (I guess I would be "Peter H.")

Thank you for the suggestions regarding inserting jsxgraphs.

(Sorry..  I should have replied sooner but I was on a trip.)

Your observation that code can be inserted into every moodle page via

is extremely interesting.  I can see how it can be used to solve the portability problem.

I did try your example, but when I did, I got a slew of errors from yui_combo.php

U of Bayreuth is working on an updated filter.  We'll see how that works out.---Peter H.

 
Average of ratings: -