Skip to content

Instantly share code, notes, and snippets.

View BillFoster's full-sized avatar

Bill Foster BillFoster

  • Newcastle University
View GitHub Profile
@BillFoster
BillFoster / gist:2379655
Created April 13, 2012 19:55
Randomisation and Try another question like this one
The following generates crudely a coprime pair of numbers. However on choosing Try another question like this on you get the same output pair very time
{
notes: ""
name: MAS3214 20122013 CBA3_1
percentPass: 50
shuffleQuestions: false
rulesets: {
@BillFoster
BillFoster / gist:2063849
Created March 17, 2012 18:27
checking algorithm and odd roots of negative numbers
{ notes: ""
name: example
percentPass: 50
shuffleQuestions: false
rulesets:{
std:[all,fractionNumbers, !collectNumbers,!noLeadingMinus]
}
navigation: {
allowregen: true
@BillFoster
BillFoster / gist:1903943
Created February 24, 2012 21:41
Example of bad display with Multiple Response Part which has Steps
{
notes: ""
name: MAS3214 20122013 CBA2_5
percentPass: 50
shuffleQuestions: false
extensions:[stats]
rulesets:{
std:[all,fractionNumbers, !collectNumbers,!noLeadingMinus]
}
@BillFoster
BillFoster / gist:1892601
Created February 23, 2012 12:14
problems with subarrays
variables: {
j:"random(0..6)"
t6: "[6,1,[[3,2]],[[7,14],[9,18],[0]]]"
t10: "[10,1,[0],[[11,22],[0],[0]]]"
t12:"[12,1,[0],[[13,26],[0],t6]]"
t18:"[18,1,[[3,3]],[[19,38],[27,54],[0]]]"
t20:"[20,0,[[5,2]],[[0],[25,50],t10]]"
t22:"[22,1,[0],[[23,46],[0],[0]]]"
t28:"[28,1,[0],[[29,58],[0],[0]]]"
t:"[t6,t10,t12,t18,t20,t22,t28]"
@BillFoster
BillFoster / gist:1853611
Created February 17, 2012 14:05
replace cdfNormal function in stats extension
//Cumulative Distribution Function of the Normal(0,1) distribution.
//based on "A Note on Approximating the Normal Distribution Function", K. M. Aludaat and M. T. Alodat, Applied Mathematical Sciences 2008
//Better is Abramowitz and Stegun;" Handbook of Mathematical Functions." 1964,(formula: 26.2.17) as implemented below
//var cdfconst = Math.sqrt(Math.PI/8);
math.normalCDF = function(z)
{
var p = 0.2316419;
var a1=0.319381530;
var a2=-0.356563782;
@BillFoster
BillFoster / gist:1825152
Created February 14, 2012 09:21
Display of lists - su below not displayed in latex mode.
{ notes: " Lists to vectors as below. Vectors to lists would be more efficient as could then sum up over subranges i.e. rows and columns"
name: MAS1342 20122013 CBA1a_1
extensions:[stats]
percentPass: 50
shuffleQuestions: false
rulesets:{
std:[all,fractionNumbers, !collectNumbers,!noLeadingMinus]
}
navigation: {
@BillFoster
BillFoster / gist:1819215
Created February 13, 2012 19:13
cast to vector problems - works for L to V and not for a1 to b below
{ notes: " Lists to vectors as below. Vectors to lists would be more efficient as could then sum up over subranges i.e. rows and columns"
name: MAS1342 20122013 CBA1a_1
extensions:[stats]
percentPass: 50
shuffleQuestions: false
rulesets:{
std:[all,fractionNumbers, !collectNumbers,!noLeadingMinus]
}
navigation: {
@BillFoster
BillFoster / gist:1783493
Created February 9, 2012 21:44
Why vectors to lists cast would be useful
{ notes: " Lists to vectors as below. Vectors to lists would be more efficient as could then sum up over subranges i.e. rows and columns"
name: MAS1342 20122013 CBA1a_1
extensions:[stats]
percentPass: 50
shuffleQuestions: false
rulesets:{
std:[all,fractionNumbers, !collectNumbers,!noLeadingMinus]
}
navigation: {
@BillFoster
BillFoster / gist:1754754
Created February 6, 2012 20:49
nested repeats
{ notes: " Best if arrays are vectors etc and not lists so can do dot products etc"
name: MAS1342 20122013 CBA1a_1
percentPass: 50
shuffleQuestions: false
rulesets:{
std:[all,fractionNumbers, !collectNumbers,!noLeadingMinus]
}
navigation: {
allowregen: true
@BillFoster
BillFoster / gist:1722966
Created February 2, 2012 11:17
tables again
{ notes: " "
name: MAS1341 20122013 CBA2a_1
percentPass: 50
shuffleQuestions: false
rulesets:{
std:[all,fractionNumbers, !collectNumbers,!noLeadingMinus]
}
navigation: {
allowregen: true