Created
June 15, 2011 15:10
-
-
Save christianp/1027302 to your computer and use it in GitHub Desktop.
a demo exam for Numbas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
name: TestA | |
extensions: [jsxgraph] | |
questions: [ | |
{ | |
name: Question 1 | |
variables: { | |
a: random(1..11) | |
g: "switch(a=1, random(2..11),a=2,random(3..11#2),a=3,random(4,5,7,8,10,11),a=4,random(5,7,9,11),a=5, random(6,7,8,9,11),a=6,random(7,11),a=7,random(8,9,10,11),a=8,random(9,11),a=9,random(10,11),a=10,11,a=11,12)" | |
b: "switch(f=2,1,f=3,random(1,2),f=4,random(1,3),f=5, random(1..4),f=6,random(1,5),f=7,random(1..6),f=8,random(1,3,5,7),f=9,random(1,2,4,5,7,8),f=10,random(1,3,7,9),f=11,random(1..10))" | |
f: "switch(g=2,random(3..11#2),g=3,random(2,4,5,7,8,10,11),g=4,random(3,5,7,9,11),g=5, random(2,3,4,6,7,8,9,11),g=6,random(5,7,11),g=7,random(2,3,4,5,6,8,9,10,11),g=8,random(3,5,7,9,11),g=9,random(2,4,5,7,8,10,11),g=10,random(3,7,9),g=11,random(2..10),g=12,random(5,7,11))" | |
s1: "random(1,-1)" | |
dosomething: "if(s1<0,'Take away', 'Add')" | |
action: "if(s1<0,'Taking away', 'Adding')" | |
action1: "if(s1<0,'taking away', 'adding')" | |
} | |
statement: """ | |
{dosomething} the following fractions and reduce the resulting fraction to lowest form. | |
Input your answer as a fraction and not as a decimal. | |
""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: """ | |
\[\simplify{{a} / {g} + ({s1*b} / {f})}\] | |
Input your answer here: [[0]] | |
Your answer must be of the form %(monospace)p/q% for suitable integers $p$ and $q$. No decimal numbers allowed. | |
You can get help by clicking on *Show steps*. If you do so you will lose ½ mark. | |
""" | |
gaps: [ | |
{ | |
type: jme | |
answer:"{a*f+s1*b*g}/{g*f}" | |
checkingtype: absdiff | |
checkingaccuracy: 0.0001 | |
maxlength:{ | |
length:7 | |
message: "Your answer is too long. Make sure it is in the correct form." | |
} | |
musthave:{ | |
strings:[/], | |
message: "You must write your answer in the form %(monospace)p/q% for integers $p$ and $q$." | |
} | |
notallowed: { | |
strings:[+,.,(,),1-,2-,3-,4-,5-,6-,7-,8-,9-], | |
message: "You must write your answer in the form %(monospace)p/q% for integers $p$ and $q$." | |
} | |
marks: 1 | |
} | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """The rule for {action1} fractions is \[\simplify{a/b+ {s1}*(c/d)=(a*d+{s1}*b*c)/(b*d)}\]""" | |
} | |
] | |
stepspenalty: 0.5 | |
} | |
] | |
advice: """ | |
The rule for {action1} fractions is \[\simplify{a/b+ {s1}*(c/d)=(a*d+{s1}*b*c)/(b*d)}\] | |
In this case we have: | |
\[\simplify[0111110011111111]{{a} / {g} + ({s1*b} / {f}) = ({a} * {f} + {g} * {s1*b}) / ({g} * {f}) ={a*f+s1*g*b}/{g*f}}\] | |
Note that this fraction is in its lowest form as there are no common factors in the denominator and the numerator | |
""" | |
} | |
{ | |
name: Question 2 | |
variables: { | |
a: random(1..11) | |
g: "switch(a=1, random(2..11),a=2,random(3..11#2),a=3,random(4,5,7,8,10,11),a=4,random(5,7,9,11),a=5, random(6,7,8,9,11),a=6,random(7,11),a=7,random(8,9,10,11),a=8,random(9,11),a=9,random(10,11),a=10,11,a=11,12)" | |
b: "switch(f=2,1,f=3,random(1,2),f=4,random(1,3),f=5, random(1..4),f=6,random(1,5),f=7,random(1..6),f=8,random(1,3,5,7),f=9,random(1,2,4,5,7,8),f=10,random(1,3,7,9),f=11,random(1..10))" | |
f: "switch(g=2,random(3..11#2),g=3,random(2,4,5,7,8,10,11),g=4,random(3,5,7,9,11),g=5, random(2,3,4,6,7,8,9,11),g=6,random(5,7,11),g=7,random(2,3,4,5,6,8,9,10,11),g=8,random(3,5,7,9,11),g=9,random(2,4,5,7,8,10,11),g=10,random(3,7,9),g=11,random(2..10),g=12,random(5,7,11))" | |
s1: "if(a*f+s*b*g=1,-s,s)" | |
s: "random(1,-1)" | |
} | |
statement: """ | |
Write the following expression as a single fraction in its lowest form: | |
""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: """ | |
\[\simplify{{g} / ({a} + {s1} * ({b * g} / {f}))}\] | |
Input your answer here: [[0]] | |
Your answer must be of the form %(monospace)p/q% for suitable integers $p$ and $q$. No decimal numbers allowed. | |
Do not include brackets in your answer. | |
""" | |
gaps: [ | |
{ | |
type: jme | |
answer:"{g*f}/{a*f+s1*b*g}" | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
maxlength:{ | |
length:7 | |
message: "Your answer is too long. Make sure it is in the correct form." | |
} | |
musthave:{ | |
strings:[/], | |
message: "You must write your answer in the form %(monospace)p/q% for integers $p$ and $q$." | |
} | |
notallowed: { | |
strings:[+,.,(,),1-,2-,3-,4-,5-,6-,7-,8-,9-], | |
message: "You must write your answer in the form %(monospace)p/q% for integers $p$ and $q$." | |
} | |
marks: 1 | |
} | |
] | |
} | |
] | |
advice: """ | |
We have: | |
\[\simplify[unitFactor]{{g} / ({a} + {s1} * ({b * g} / {f})) = {g} / (({a} * {f} + {s1} * {b * g}) / {f}) ={g} / (({a * f + s1 * b * g}) / {f})= {g} * ({f} / ({a * f + s1 * b * g})) = ({g * f} / {(a * f + s1 * b * g)})}\] | |
Here we use the result that dividing by a fraction $\frac{a}{b}$ is the same as multiplying by $\frac{b}{a}$. | |
The resulting fraction is in lowest form i.e. the top and bottom do not have a common factor. | |
""" | |
} | |
{ | |
name: Question 3 | |
variables: { | |
a: "s1*random(2..12)" | |
b: "s2*random(1..12)" | |
c: "if(a=tc,tc+1,tc)" | |
tc: "s3*random(2..20)" | |
td: "random(1..20)" | |
d: "if(b=td,td+1,td)" | |
s1: "random(1,-1)" | |
s2: "random(1,-1)" | |
s3: "random(1,-1)" | |
} | |
statement: "Solve the following linear equation for $x$." | |
parts: [ | |
{ | |
type: GapFill | |
prompt: """ | |
\[\simplify[111111011111111]{{a} * x + {b} = {c} * x + {d}}\] | |
Input your answer as a fraction or an integer. Do NOT input the answer as a decimal. | |
$x\;=$[[0]]""" | |
gaps: [ | |
{type: jme, answer: "{d-b}/{a-c}", marks: 1} | |
] | |
} | |
] | |
advice: | |
""" | |
Given the equation \[\simplify[1111110111111111]{{a}x+{b}={c}x+{d}}\] we first collect together all the constant terms, and collect together all the terms in $x$. | |
The equation can then be written as: | |
\[\simplify[1111110111111111]{({a}-{c})x=({d}+{-b})}\] i.e. | |
\[\simplify{{a-c}x={d-b}}\] | |
which gives \[x =\simplify{{(d-b)/(a-c)}}\] as the solution. | |
""" | |
} | |
{ | |
name: Question 4 | |
variables: { | |
a: "sa*random(2..9)" | |
a2: abs(a) | |
b: "sb*random(1..9)" | |
c: "sc*random(1..9)" | |
sa: "random(1,-1)" | |
sb: "random(1,-1)" | |
sc: "random(1,-1)" | |
a1: "switch(a2=2,random(3,5,7,9),a2=3,random(2,4,5,7),a2=4,random(3,5,7,9),a2=5,random(3,4,6,7,9),a2=6,random(4,5,7,8,9),a2=7,random(3,4,5,6,8,9),a2=8,random(3,5,6,7,9),a2=9,random(2,4,5,7,8),9)" | |
b1: "if(a*b2=a1*b,b2+1,b2)" | |
c1: "sc1*random(1..9)" | |
s1:"random(1,-1)" | |
sc1:"random(1,-1)" | |
b2: "random(2..9)" | |
aort: "if(b*b1>0,'take away the equation','add the equation')" | |
fromorto: "if(b*b1>0,'from','to')" | |
s6: "if(b*b1>0,-1,1)" | |
this: "lcm(abs(b),abs(b1))/abs(b)" | |
that: "lcm(abs(b),abs(b1))/abs(b1)" | |
} | |
statement: "Solve the simultaneous equations for $x$ and $y$. Input your answers as fractions NOT as decimals." | |
parts: [ | |
{ | |
type: GapFill | |
prompt: """ | |
\[ \begin{eqnarray} | |
\simplify[1111110111111111]{{a}x+{b}y}&=&\var{c}\\ | |
\simplify[1111110111111111]{{a1}x+{b1}y}&=&\var{c1} | |
\end{eqnarray} \] | |
$x=\phantom{{}}$[[0]] | |
$y=\phantom{{}}$[[1]]""" | |
gaps: [ | |
{type: jme | |
answer: "{c*b1-b*c1}/{b1*a-a1*b}" | |
answersimplification: "1111111111111111" | |
notallowed:{strings:[.],message: input as a fraction or an integer not as a decimal} | |
marks: 1} | |
{type: jme | |
answer: "{c*a1-a*c1}/{b*a1-a*b1}" | |
answersimplification: "1111111111111111" | |
notallowed:{strings:[.],message: input as a fraction or an integer not as a decimal} | |
marks:1} | |
] | |
} | |
] | |
advice: | |
""" | |
\[ \begin{eqnarray} | |
\simplify[1111110111111111]{{a}x+{b}y}&=&\var{c}&\mbox{ ........(1)}\\ | |
\simplify[1111110111111111]{{a1}x+{b1}y}&=&\var{c1}&\mbox{ ........(2)} | |
\end{eqnarray} \] | |
To get a solution for $x$ multiply equation (1) by {this} and equation (2) by {that} | |
This gives: | |
\[ \begin{eqnarray} | |
\simplify[1111110111111111]{{a*this}x+{b*this}y}&=&\var{this*c}&\mbox{ ........(3)}\\ | |
\simplify[1111110111111111]{{a1*that}x+{b1*that}y}&=&\var{that*c1}&\mbox{ ........(4)} | |
\end{eqnarray} \] | |
Now {aort} (4) {fromorto} equation (3) to get | |
\[\simplify[1111110111111111]{({a*this}+{s6*a1*that})x={this*c}+{s6*that*c1}}\] | |
And so we get the solution for $x$: | |
\[x = \simplify{{c*b1-b*c1}/{b1*a-a1*b}}\] | |
Substituting this value into any of the equations (1) and (2) gives: | |
\[y = \simplify{{c*a1-a*c1}/{b*a1-a*b1}}\] | |
You can check that these solutions are correct by seeing if they satisfy both equations (1) and (2) by substituting these values into the equations. | |
""" | |
} | |
{ | |
name: Question 5 | |
statement: """ | |
notextile. | |
<jsxgraph language="javascript"> | |
board.create('axis',[[0.0,0.0],[1.0,0.0]]); | |
board.create('axis',[[0.0,0.0],[0.0,1.0]]); | |
var pA = board.create('point',[0,0],{name: '', face: 'x',size:7}); | |
var l1 = board.create('line',[[0,variables.c1],[-variables.c1/variables.m1,0]],{straightFirst:true,straightLast:true}); | |
board.create('text',[-2,-2*variables.m1+variables.c1,function(){return '\\[l_1\\]';}],{fontSize:'100%'}); | |
var l2 = board.create('line',[[0,variables.c2],[-variables.c2/variables.m2,0]],{straightFirst:true,straightLast:true}); | |
var sp11 = board.create('point',[0,0],{visible:false}); | |
var sp12 = board.create('point',[1,0],{visible:false}); | |
var sl1 = board.create('line',[sp11,sp12],{visible:false,strokeColor:'#0f0'}); | |
board.create('text',[-2,-2*variables.m2+variables.c2,function(){return '\\[l_2\\]';}],{fontSize:'100%'}); | |
var xInput = $('#p0g0 > input'); | |
var yInput = $('#p0g1 > input'); | |
$('#'+id).bind('mouseup',function(){ | |
if(parseFloat(xInput.val())!=pA.X()) | |
$('#p0g0 > input').val(pA.X()).trigger('input'); | |
if(parseFloat(yInput.val())!=pA.Y()) | |
$('#p0g1 > input').val(pA.Y()).trigger('input'); | |
}); | |
var changeX = function() { | |
var x = parseFloat(xInput.val()); | |
if(util.isFloat(x)) | |
pA.moveTo([x,pA.Y()],200); | |
}; | |
xInput.bind('change', changeX).bind('input',changeX); | |
var changeY = function() { | |
var y = parseFloat(yInput.val()); | |
if(util.isFloat(y)) | |
pA.moveTo([pA.X(),y],200); | |
}; | |
yInput.bind('change', changeY).bind('input',changeY); | |
var changeLine1 = function() { | |
var m = parseFloat($('#p1g0>input').val()); | |
var c = parseFloat($('#p1g1>input').val()); | |
if(util.isFloat(m) && util.isFloat(c)) | |
{ | |
sl1.showElement(); | |
sp11.moveTo([0,c],200); | |
if(m==0) | |
{ | |
sp12.moveTo([1,c],200); | |
} | |
else if(c==0) | |
{ | |
sp12.moveTo([m,m],200); | |
} | |
else | |
{ | |
sp12.moveTo([-c/m,0],200); | |
} | |
} | |
else | |
{ | |
sl1.hideElement(); | |
} | |
}; | |
$('#p1g0>input,#p1g1>input').bind('input',changeLine1).bind('change',changeLine1); | |
</jsxgraph> | |
""" | |
variables: { | |
ix: "random(-1..2#0.2)" | |
iy: "random(0.4..2#0.2)*random(-1,1)" | |
m1: "random(0.2..1#0.2)*random(-1,1)" | |
c1: "iy-m1*ix" | |
m2: "-sgn(m1)*random(0.2..1#0.2)" | |
c2: "iy-m2*ix" | |
} | |
parts: [ | |
{ | |
type: gapfill | |
prompt: """ | |
The above graph shows two lines $l_1$ and $l_2$ which intersect. | |
You are asked to find the point of intersection graphically and using values for the slope and intersection with the $y$-axis, to find the equation of line $l_1$. | |
Enter the co-ordinates of the point of intersection of $l_1$ and $l_2$, or position the red cross over the intersection. Your answer must be correct to one decimal place. | |
$\Big ($[[0]]$\, , \,$[[1]]$\Big )$ | |
""" | |
marks: 1 | |
gaps: [ | |
{type: numberentry, minvalue: ix-0.05, maxvalue: ix+0.05, marks: 1} | |
{type: numberentry, minvalue: iy-0.05, maxvalue: iy+0.05, marks: 1} | |
] | |
} | |
{ | |
type: gapfill | |
prompt: """ | |
Enter the slope, $m_1$, and the intercept, $c_1$, of the line $l_1$. The line corresponding to your answer will be shown in green on the graph. | |
$m_1 = \;$[[0]] $,\; c_1 = \;$[[1]] | |
""" | |
gaps: [ | |
{type: numberentry, minvalue: "m1-0.05", maxvalue: "m1+0.05", marks: 1} | |
{type: numberentry, minvalue: "c1-0.05", maxvalue: "c1+0.05", marks: 1} | |
] | |
} | |
{ | |
type: gapfill | |
prompt: """ | |
Write down the equation of the line $l_1$. | |
$y = \;$[[0]] | |
""" | |
gaps: [ | |
{type: jme, answer: "{m1}*x+{c1}", marks: 2, checkingaccuracy: 0.1} | |
] | |
} | |
] | |
} | |
{ | |
name: Question 6 | |
variables: { | |
a: random(2..5) | |
c1: "switch(f=1, random(1..6),f=2,random(1,3,5,7,9),f=3,random(1,2,5,7,8),f=4,random(1,3,5,7,9),f=6, random(1,5,7,8),f=9,random(1,2,4,7,8),f=8,random(1,3,5,7,9),f=12,random(1,5,7),random(1,3,5,7))" | |
c: "c1*s3" | |
d1:"switch(f=1, random(1..6),f=2,random(1,3,5,7,9),f=3,random(1,2,5,7,8),f=4,random(1,3,5,7,9),f=6, random(1,5,7,8),f=9,random(1,2,4,7,8),f=8,random(1,3,5,7,9),f=12,random(1,5,7),random(1,3,5,7))" | |
d: "if(d1=-b*c/a, max(d1+1,random(1..5))*s3,d1*s3)" | |
s3:"random(1,-1)" | |
b: "random(1..4)" | |
f: "a*b" | |
s1: "random(1,-1)" | |
s2:"random(1,-1)" | |
n1: "b*c+a*d" | |
n2: "b*c-a*d" | |
n3: "2*a*b" | |
n5: "a*b" | |
n4: "abs(n2)" | |
disc: "(b*c+a*d)^2-4*a*b*c*d" | |
rdis:"switch(disc=0,'The discriminant is '+ 0+' and so we get two repeated roots in this case.',disc<0, 'There are no real roots.','The roots exist and are distinct. ')" | |
rep: "switch(disc=0,'repeated', ' ')" | |
} | |
statement: """Factorise the following quadratic expression $q(x)$ into linear factors i.e. input $q(x)$ in the form | |
\[(ax+b)(cx+d)\] for suitable integers $a$, $b$, $c$ and $d$ .""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: | |
"""\[q(x)=\simplify[1111110111111111]{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d}}\] | |
$q(x)=\;$ [[0]] | |
You can get more information on factorising a quadratic by clicking on Steps. You will lose 1 mark if you do so. | |
Input all numbers as integers and not as decimals. | |
""" | |
gaps: [ | |
{type: jme | |
answer:"((({a} * x) + {( - c)}) * (({b} * x) + {( - d)}))" | |
answersimplification: "1111110111111111" | |
notallowed:{strings:[.],message: input numbers as integers not as a decimals} | |
notallowed: {strings: [^,x*x, x x, x(, x (,)x,) x],message:factorise the expression into two factors} | |
musthave: {strings: [(,)], message: factorise the expression into two factors} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 2} | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """Factorisation by finding the roots | |
If you cannot spot a direct factorisation of a quadratic $q(x)$ then finding the roots of the equation $q(x)=0$ can help you. | |
For if $x=r$ and $x=s$ and are the roots then $q(x)=a(x-r)(x-s)$ for some constant $a$. | |
Finding the roots of a quadratic using the standard formula | |
We can use the following formula for finding the roots of a general quadratic equation $ax^2+bx+c=0$ | |
The two roots are | |
\[ x = \frac{-b +\sqrt{b^2-4ac}}{2a}\mbox{ and } x = \frac{-b -\sqrt{b^2-4ac}}{2a}\] | |
there are three main types of solutions depending upon the value of the discriminant $\Delta=b^2-4ac$ | |
1. $\Delta >0$. The roots are real and distinct | |
2. $\Delta=0$. The roots are real and equal. Their value is $\frac{-b}{2a}$ | |
3. $\Delta <0$. There are no real roots. The root are complex and form a complex conjugate pair. | |
""" | |
} | |
] | |
stepspenalty: 1 | |
} | |
] | |
advice: | |
"""Direct Factorisation | |
If you can spot a direct factorisation then this is the quickest way to do this question. | |
For this example we have the factorisation | |
\[\simplify{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d} = ({a} * x + { -c}) * ({b} * x + { -d})}\] | |
Factorisation by finding the roots | |
For if $x=r$ and $x=s$ and are the roots then $q(x)=a(x-r)(x-s)$ where $a$ is the coefficient of $x^2$. | |
There are several methods of finding the roots - here are the main methods. | |
Method 1: Finding the roots of a quadratic using the standard formula | |
We can use the following formula for finding the roots of a general quadratic equation $ax^2+bx+c=0$ | |
The two roots are | |
\[ x = \frac{-b +\sqrt{b^2-4ac}}{2a}\mbox{ and } x = \frac{-b -\sqrt{b^2-4ac}}{2a}\] | |
there are three main types of solutions depending upon the value of the discriminant $\Delta=b^2-4ac$ | |
1. $\Delta >0$. The roots are real and distinct | |
2. $\Delta=0$. The roots are real and equal. Their common value is $-\frac{b}{2a}$ | |
3. $\Delta <0$. There are no real roots. The root are complex and form a complex conjugate pair. | |
For this question the discriminant of $\simplify{{a*b}x^2+{-b*c-a*d}x+{c*d}}$ is $\Delta = \simplify{{-(b*c+a*d)}^2-4*{a*b}*{c*d}={disc}}$ | |
{rdis}. | |
So the {rep} roots are: | |
\[\begin{eqnarray} | |
x = \frac{\var{n1} + \sqrt{\var{disc}}}{\var{n3}} &=& \frac{\var{n1} + \var{n4} }{\var{n3}} &=& \simplify{{n1 + n4}/ {n3}}\\ | |
x = \frac{\var{n1} - \sqrt{\var{disc}}}{\var{n3}} &=& \frac{(\var{n1} - \var{n4}) }{\var{n3}} &=& \simplify{{n1 - n4}/ {n3}} | |
\end{eqnarray}\] | |
So we see that: | |
\[q(x)=\simplify{{a*b}}\left(\simplify{x-{n1 + n4}/ {n3}}\right)\left(\simplify{x-{n1 - n4}/ {n3}}\right)=\simplify{({b} * x + { -d}) * ({a} * x + { -c})}\] | |
Next Method: Completing the square. | |
First we complete the square for the quadratic expression $\simplify{{a*b}x^2+{-n1}x+{c*d}}$ | |
\[\begin{eqnarray} | |
\simplify{{a*b}x^2+{-n1}x+{c*d}}&=&\var{n5}\left(\simplify{x^2+({-n1}/{a*b})x+ {c*d}/{a*b}}\right)\\ | |
&=&\var{n5}\left(\left(\simplify{x+({-n1}/{2*a*b})}\right)^2+ \simplify{{c*d}/{a*b}-({-n1}/({2*a*b}))^2}\right)\\ | |
&=&\var{n5}\left(\left(\simplify{x+({-n1}/{2*a*b})}\right)^2 -\simplify{ {n2^2}/{4*(a*b)^2}}\right) | |
\end{eqnarray} | |
\] | |
So to solve $\simplify{{a*b}x^2+{-n1}x+{c*d}}=0$ we have to solve: | |
\[\begin{eqnarray} | |
\left(\simplify{x+({-n1}/{2*a*b})}\right)^2&\phantom{{}}& -\simplify{ {n2^2}/{4*(a*b)^2}}=0\Rightarrow\\ | |
\left(\simplify{x+({-n1}/{2*a*b})}\right)^2&\phantom{{}}&=\simplify{ {n2^2}/{4*(a*b)^2}=({abs(n2)}/{2*a*b})^2} | |
\end{eqnarray}\] | |
So we get the two {rep} solutions: | |
\[\begin{eqnarray} | |
\simplify{x+({-n1}/{2*a*b})}&=&\simplify{{abs(n2)}/{2*a*b}} \Rightarrow &x& = \simplify{({abs(n2)+n1}/{2*a*b})}\\ | |
\simplify{x+({-n1}/{2*a*b})}&=&\simplify{-({abs(n2)}/{2*a*b})} \Rightarrow &x& = \simplify{({n1-abs(n2)}/{2*a*b})} | |
\end{eqnarray}\] | |
Finding these roots then gives the factorisation as before. | |
""" | |
} | |
{ | |
name: Question 7 | |
variables: {a: random(2..5) | |
c1: "switch(f=1, random(1..6),f=2,random(1,3,5,7,9),f=3,random(1,2,5,7,8),f=4,random(1,3,5,7,9),f=6, random(1,5,7,8),f=9,random(1,2,4,7,8),f=8,random(1,3,5,7,9),f=12,random(1,5,7),random(1,3,5,7))" | |
c: "c1*s3" | |
d1:"switch(f=1, random(1..6),f=2,random(1,3,5,7,9),f=3,random(1,2,5,7,8),f=4,random(1,3,5,7,9),f=6, random(1,5,7,8),f=9,random(1,2,4,7,8),f=8,random(1,3,5,7,9),f=12,random(1,5,7),random(1,3,5,7))" | |
d: "if((a*d1)^2=(b*c)^2, max(d1+1,random(1..5))*s3,d1*s3)" | |
s3:"random(1,-1)" | |
b:"random(1..4)" | |
f: "a*b" | |
s1: "random(1,-1)" | |
s2:"random(1,-1)" | |
n1: "b*c+a*d" | |
n2: "b*c-a*d" | |
n3: "2*a*b" | |
n5: "a*b" | |
n4: "abs(n2)" | |
disc: "(b*c+a*d)^2-4*a*b*c*d" | |
rdis:"switch(disc=0,'The discriminant is '+ 0+' and so we get two repeated roots in this case.',disc<0, 'There are no real roots.','The roots exist and are distinct. ')" | |
rep: "switch(disc=0,'repeated', ' ')" | |
} | |
statement: """Find the roots of the following quadratic equation.""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: | |
"""\[q(x)=\simplify[1111110111111111]{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d}}\] | |
The least root is $x=\;$ [[0]]. The greatest root is $x=\;$ [[1]] | |
You can get more information on solving a quadratic by clicking on Steps. You will lose 1 mark if you do so. | |
Enter the least root first. If the roots are equal, enter the root in both boxes. Enter the roots as fractions or integers, not as decimals. | |
""" | |
gaps: [ | |
{type: jme | |
answer:"{n1-n4}/{2*a*b}" | |
answersimplification: "1111111111111111" | |
notallowed:{strings:[.],message: input numbers as fractions or integers not as a decimals} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 1} | |
{type: jme | |
answer:"{n1+n4}/{2*a*b}" | |
answersimplification: "1111111111111111" | |
notallowed:{strings:[.],message: input numbers as fractions or integers not as a decimals} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 1} | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """Finding the roots by factorisation, | |
Finding a factorisation of a quadratic $q(x)=a(x-r)(x-s)$ where $a$ is the coefficient of $x^2$ gives the roots $x=r$, $x=s$ immendiately. | |
If you cannot find a factorisation then there are several other methods you can use. | |
You can find the roots by using the formula for finding the roots of a general quadratic equation $ax^2+bx+c=0$ | |
The two roots are | |
\[ x = \frac{-b +\sqrt{b^2-4ac}}{2a}\mbox{ and } x = \frac{-b -\sqrt{b^2-4ac}}{2a}\] | |
there are three main types of solutions depending upon the value of the discriminant $\Delta=b^2-4ac$ | |
1. $\Delta >0$. The roots are real and distinct | |
2. $\Delta=0$. The roots are real and equal. Their value is $\frac{-b}{2a}$ | |
3. $\Delta <0$. There are no real roots. The root are complex and form a complex conjugate pair. | |
""" | |
} | |
] | |
stepspenalty: 1 | |
} | |
] | |
advice: | |
"""Direct Factorisation | |
If you can spot a direct factorisation then this is the quickest way to do this question. | |
For this example we have the factorisation | |
\[\simplify{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d} = ({a} * x + { -c}) * ({b} * x + { -d})}\] | |
Hence we find the roots: | |
\[\begin{eqnarray} | |
x&=& \simplify{{n1-n4}/{2*a*b}}\\ | |
x&=& \simplify{{n1+n4}/{2*a*b}} | |
\end{eqnarray} \] | |
Other Methods. | |
There are several methods of finding the roots - here are the main methods. | |
Method 1: Finding the roots of a quadratic using the standard formula | |
We can use the following formula for finding the roots of a general quadratic equation $ax^2+bx+c=0$ | |
The two roots are | |
\[ x = \frac{-b +\sqrt{b^2-4ac}}{2a}\mbox{ and } x = \frac{-b -\sqrt{b^2-4ac}}{2a}\] | |
there are three main types of solutions depending upon the value of the discriminant $\Delta=b^2-4ac$ | |
1. $\Delta >0$. The roots are real and distinct | |
2. $\Delta=0$. The roots are real and equal. Their common value is $-\frac{b}{2a}$ | |
3. $\Delta <0$. There are no real roots. The root are complex and form a complex conjugate pair. | |
For this question the discriminant of $\simplify{{a*b}x^2+{-b*c-a*d}x+{c*d}}$ is $\Delta = \simplify[1111110111111111]{{-n1}^2-4*{a*b*c*d}}=\var{disc}$ | |
{rdis}. | |
So the {rep} roots are: | |
\[\begin{eqnarray} | |
x = \frac{\var{n1} - \sqrt{\var{disc}}}{\var{n3}} &=& \frac{\var{n1} - \var{n4} }{\var{n3}} &=& \simplify{{n1 - n4}/ {n3}}\\ | |
x = \frac{\var{n1} + \sqrt{\var{disc}}}{\var{n3}} &=& \frac{\var{n1} + \var{n4} }{\var{n3}} &=& \simplify{{n1 + n4}/ {n3}} | |
\end{eqnarray}\] | |
Next Method: Completing the square. | |
First we complete the square for the quadratic expression $\simplify{{a*b}x^2+{-n1}x+{c*d}}$ | |
\[\begin{eqnarray} | |
\simplify{{a*b}x^2+{-n1}x+{c*d}}&=&\var{n5}\left(\simplify{x^2+({-n1}/{a*b})x+ {c*d}/{a*b}}\right)\\ | |
&=&\var{n5}\left(\left(\simplify{x+({-n1}/{2*a*b})}\right)^2+ \simplify{{c*d}/{a*b}-({-n1}/({2*a*b}))^2}\right)\\ | |
&=&\var{n5}\left(\left(\simplify{x+({-n1}/{2*a*b})}\right)^2 -\simplify{ {n2^2}/{4*(a*b)^2}}\right) | |
\end{eqnarray} | |
\] | |
So to solve $\simplify{{a*b}x^2+{-n1}x+{c*d}}=0$ we have to solve: | |
\[\begin{eqnarray} | |
\left(\simplify{x+({-n1}/{2*a*b})}\right)^2&\phantom{{}}& -\simplify{ {n2^2}/{4*(a*b)^2}}=0\Rightarrow\\ | |
\left(\simplify{x+({-n1}/{2*a*b})}\right)^2&\phantom{{}}&=\simplify{ {n2^2}/{4*(a*b)^2}=({abs(n2)}/{2*a*b})^2} | |
\end{eqnarray}\] | |
So we get the two {rep} solutions: | |
\[\begin{eqnarray} | |
\simplify{x+({-n1}/{2*a*b})}&=&\simplify{-{abs(n2)}/{2*a*b}} \Rightarrow &x& = \simplify{({-abs(n2)+n1}/{2*a*b})}\\ | |
\simplify{x+({-n1}/{2*a*b})}&=&\simplify{({abs(n2)}/{2*a*b})} \Rightarrow &x& = \simplify{({n1+abs(n2)}/{2*a*b})} | |
\end{eqnarray}\] | |
""" | |
} | |
{ | |
name: Question 8 | |
variables: {a: "s1*random(1.0..9.5#0.5)" | |
b:"random(1..20)-a^2" | |
s1: "random(1,-1)" | |
} | |
statement: """Put the following quadratic in the form $(x+a)^2+b$ for suitable numbers $a$ and $b$ . | |
Note that you have to input these numbers exactly as decimals or fractions.""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: """$\simplify{x^2+{2*a}x+ {a^2+b}} = \phantom{{}}$ [[0]]. """ | |
gaps: [ | |
{type: jme | |
answer:"(x+{a})^2+{b}" | |
answersimplification: "1111111111111110" | |
notallowed:{strings:[x^2,x*x,x x,x),(x,( x,x(,x*(],message: """input in the form $(x+a)^2+b$"""} | |
musthave: {strings:[(,),^],message:"""input in the form $(x+a)^2+b$"""} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 2} | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """Given the quadratic $\simplify{x^2+{2*a}x+ {a^2+b}}$ we complete the square by: | |
1. Halving the coefficient of $x$ gives $\var{a}$ | |
2. Work out $\simplify[1111111111111110]{p(x)=(x+{a})^2=x^2+{2*a}x+{a^2}}$. | |
This gives the first two terms of $q(x)$. | |
3. But the constant term $\simplify[1111111111111110]{{a^2}}$ in $p(x)$ is not the same as in $q(x)$ - so we need to adjust by adding on a suitable constant to $p(x)$.""" | |
} | |
] | |
stepspenalty: 1 | |
} | |
] | |
advice: | |
"""Given the quadratic $\simplify{x^2+{2*a}x+ {a^2+b}}$ we complete the square by: | |
1. Halving the coefficient of $x$ gives $\var{a}$ | |
2. Work out $\simplify[1111111111111110]{p(x)=(x+{a})^2=x^2+{2*a}x+{a^2}}$. | |
This gives the first two terms of $q(x)$. | |
3. But the constant term $\simplify[1111111111111110]{{a^2}}$ in $p(x)$ is not the same as in $q(x)$, so we need to adjust by adding on $\simplify[1111110111111110]{{a^2+b}-{a^2}={b}}$ to $p(x)$. | |
Hence we get \[q(x) = \simplify[1111111111111110]{p(x)+{b} = (x+{a})^2+{b}}=\simplify[1111111111111110]{ (x+{a})^2+{b}}\] | |
""" | |
} | |
{ | |
name: Question 9 | |
variables: { | |
a: random(2..5) | |
c1: "switch(f=1, random(1..6),f=2,random(1,3,5,7,9),f=3,random(1,2,5,7,8),f=4,random(1,3,5,7,9),f=6, random(1,5,7,8),f=9,random(1,2,4,7,8),f=8,random(1,3,5,7,9),f=12,random(1,5,7),random(1,3,5,7))" | |
c: "c1*s3" | |
d1:"switch(f=1, random(1..6),f=2,random(1,3,5,7,9),f=3,random(1,2,5,7,8),f=4,random(1,3,5,7,9),f=6, random(1,5,7,8),f=9,random(1,2,4,7,8),f=8,random(1,3,5,7,9),f=12,random(1,5,7),random(1,3,5,7))" | |
d: "if(d1=-b*c/a, max(d1+1,random(1..5))*s3,d1*s3)" | |
s3:"random(1,-1)" | |
b: "random(1..4)" | |
f: "a*b" | |
s1: "random(1,-1)" | |
s2:"random(1,-1)" | |
n1: "b*c+a*d" | |
n2: "b*c-a*d" | |
n3: "2*a*b" | |
n5: "a*b" | |
n4: "abs(n2)" | |
disc: "(b*c+a*d)^2-4*a*b*c*d" | |
rdis:"switch(disc=0,'The discriminant is '+ 0+' and so we get two repeated roots in this case.',disc<0, 'There are no real roots.','The roots exist and are distinct. ')" | |
rep: "switch(disc=0,'repeated', ' ')" | |
} | |
statement: """Complete the square for the quadratic expression $q(x)$ by writing it in the form \[a(x+b)^2+c\] for numbers $a,\;b$ and $c$ | |
Using that find both roots of the equation $q(x)=0$""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: | |
"""\[q(x)=\simplify[1111110111111111]{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d}}\] | |
Now write $q(x) = a(x+b)^2+c\;\;$ for fractions or integers $a$, $b$, $c$. | |
$q(x)=\;$ [[0]] | |
You can get more information on completing the square by clicking on Steps. You will lose 1 mark if you do so. | |
Remember: Input all numbers as fractions or integers and not as decimals. | |
""" | |
gaps: [ | |
{type: jme | |
answer:"{n5}(x+({-n1}/{2*n5}))^2-{n2^2}/{4*n5}" | |
answersimplification: "1111110111111111" | |
notallowed: {strings: [.,x*x, x x, x(, x (,)x,) x],message:"""write in the form $a(x+b)^2+c$ without using decimals"""} | |
musthave: {strings: [(,),^], message: """write in the form $a(x+b)^2+c$"""} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 2} | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """Given the quadratic $\simplify{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d}}$ we complete the square by: | |
1. Writing the quadratic as \[\var{n5}\left(\simplify{x^2+({-n1}/{n5})x+ {c*d}/{n5}}\right)\] | |
2. Then complete the square for the quadratic \[\simplify{x^2+({-n1}/{n5})x+ {c*d}/{n5}}\] | |
3. Remember to multiply by {n5} the expression found from the second stage. | |
""" | |
} | |
] | |
stepspenalty: 1 | |
} | |
{type: GapFill | |
prompt: """Now find the roots of the quadratic equation $\simplify{{a*b}x^2+{-n1}x+{c*d}}=0$ | |
The least root is $x=\;$ [[0]]. The greatest root is $x=\;$ [[1]]""" | |
gaps: [ | |
{type: jme | |
answer:"{n1-n4}/{2*a*b}" | |
answersimplification: "1111111111111111" | |
notallowed:{strings:[.],message: input numbers as fractions or integers not as a decimals} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 1} | |
{type: jme | |
answer:"{n1+n4}/{2*a*b}" | |
answersimplification: "1111111111111111" | |
notallowed:{strings:[.],message: input numbers as fractions or integers not as a decimals} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 1} | |
] | |
} | |
] | |
advice: | |
"""Completing the square for the quadratic expression $\simplify{{a*b}x^2+{-n1}x+{c*d}}$ | |
\[\begin{eqnarray} | |
\simplify{{a*b}x^2+{-n1}x+{c*d}}&=&\var{n5}\left(\simplify{x^2+({-n1}/{a*b})x+ {c*d}/{a*b}}\right)\\ | |
&=&\var{n5}\left(\left(\simplify{x+({-n1}/{2*a*b})}\right)^2+ \simplify{{c*d}/{a*b}-({-n1}/({2*a*b}))^2}\right)\\ | |
&=&\var{n5}\left(\left(\simplify{x+({-n1}/{2*a*b})}\right)^2 -\simplify{ {n2^2}/{4*(a*b)^2}}\right)\\ | |
&=&\var{n5}\left(\simplify{x+({-n1}/{2*n5})}\right)^2 -\simplify{ {n2^2}/{4*(n5)}} | |
\end{eqnarray} | |
\] | |
So to solve $\simplify{{a*b}x^2+{-n1}x+{c*d}}=0$ we have to solve: | |
\[\begin{eqnarray} | |
\left(\simplify{x+({-n1}/{2*a*b})}\right)^2&\phantom{{}}& -\simplify{ {n2^2}/{4*(a*b)^2}}=0\Rightarrow\\ | |
\left(\simplify{x+({-n1}/{2*a*b})}\right)^2&\phantom{{}}&=\simplify{ {n2^2}/{4*(a*b)^2}=({abs(n2)}/{2*a*b})^2} | |
\end{eqnarray}\] | |
So we get the two {rep} solutions: | |
\[\begin{eqnarray} | |
\simplify{x+({-n1}/{2*a*b})}&=&\simplify{{abs(n2)}/{2*a*b}} \Rightarrow &x& = \simplify{({abs(n2)+n1}/{2*a*b})}\\ | |
\simplify{x+({-n1}/{2*a*b})}&=&\simplify{-({abs(n2)}/{2*a*b})} \Rightarrow &x& = \simplify{({n1-abs(n2)}/{2*a*b})} | |
\end{eqnarray}\] | |
""" | |
} | |
{ | |
name: Question 10 | |
variables: {a: "random(1..9)" | |
b:"s6*random(1..9)" | |
s6: "random(1,-1)" | |
c:"s1*random(1..9)" | |
s1: "random(1,-1)" | |
d: "if(b=d1,2*d1,d1)" | |
d1:"s2*random(1..6)" | |
s2: "random(1,-1)" | |
nb: "if(s1=-1,'taking away','adding')" | |
} | |
statement: """Add the following two fractions together and express as a single fraction over a common denominator. | |
All coefficients and constants should be input as integers and not as decimals. | |
Make sure that you simplify the numerator so that it is of the form $ax+b$ for suitable integers $a$ and $b$ . | |
""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: """Express \[\simplify{{a} / (x + {b}) + ({c} / (x + {d}))}\] as a single fraction here: [[0]]. """ | |
gaps: [ | |
{type: jme | |
answer:"({a + c} * x + {a * d + c * b}) / ((x + {b}) * (x + {d}))" | |
answersimplification: "1111111111111111" | |
notallowed:{strings:[)+,) +,) +,)-,) -,) -],message: """your answer should be one fraction. Try again"""} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 2} | |
] | |
steps: [ | |
{type: information | |
prompt:"""The formula for {nb} fractions is : | |
\[\simplify{a / b + {s1} * (c / d) = (ad + {s1} * bc) / bd}\] | |
and for this exercise we have $\simplify{b=x+{b}}$, $\simplify{d=x+{d}}$. | |
Note that in your answer you do not need to expand the denominator. """} | |
] | |
stepspenalty: 1 | |
} | |
] | |
advice: | |
"""The formula for {nb} fractions is : | |
\[\simplify{a / b + {s1} * (c / d) = (ad + {s1} * bc) / bd}\] | |
and for this exercise we have $\simplify{b=x+{b}}$, $\simplify{d=x+{d}}$. | |
Hence we have: | |
\[\simplify{{a} / (x + {b}) + ({c} / (x + {d})) = ({a} * (x + {d}) + {c} * (x + {b})) / ((x + {b}) * (x + {d})) = ({a + c} * x + {a * d + c * b}) / ((x + {b}) * (x + {d}))}\] | |
""" | |
} | |
{ | |
name: Question 11 | |
variables: { | |
t: "random(2..8)" | |
a: "random(2..9)" | |
c: "s2*random(1..9)" | |
d: "abs(c)+random(2..9)" | |
s2:"random(1,-1)" | |
s1: "random(-1,1)" | |
b1:"s1*random(1..10)" | |
b: "if(a=abs(b1),abs(b1)+2,b1)" | |
an1:"t-b*d+b*c" | |
an2: "a*(d-c)" | |
} | |
statement: """Solve the following equation for $x$. | |
Input your answer as a fraction or an integer as appropriate and NOT as a decimal.""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: | |
"""\[q(x)=\simplify{{t} / ({a} * x + {b}) + {c} = {d}}\] | |
$x=\;$ [[0]] | |
If you want help in solving the equation, click on Steps. If you do so then you will lose 1 mark and so the question will be marked out of 1 marks rather than 2 marks.. | |
Remember: Input all numbers as fractions or integers and not as decimals. | |
""" | |
gaps: [ | |
{type: jme | |
answer:"{an1}/{an2}" | |
answersimplification: "1111111111111111" | |
notallowed: {strings: [.],message:"""Input as a fraction or an integer, not as a decimal"""} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 2} | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """Rearrange the equation by adding {-c} to both sides to get: | |
\[\simplify[1111110111111111]{{t} / ({a} * x + {b}) = {d} + { -c} = {d -c}}\] | |
This gives \[\simplify{({a} * x + {b}) / {t} = 1 / {d -c}}\] (this is because if $\frac{a}{b}=c$ then $\frac{b}{a}=\frac{1}{c}$ on turning the fraction round the other way) | |
and so \[\simplify{({a} * x + {b}) = {t} / {d -c}}\] on multiplying both sides by {t}. | |
Solve this equation for $x$. | |
""" | |
} | |
] | |
stepspenalty: 1 | |
} | |
] | |
advice: | |
"""Rearrange the equation by adding {-c} to both sides to get: | |
\[\simplify{{t} / ({a} * x + {b}) = {d} + { -c} = {d -c}}\] | |
This gives \[\simplify{({a} * x + {b}) / {t} = 1 / {d -c}}\] (this is because if $\frac{a}{b}=c$ then $\frac{b}{a}=\frac{1}{c}$ on turning the fraction round the other way) | |
and so \[\simplify{({a} * x + {b}) = {t} / {d -c}}\] on multiplying both sides by {t}. | |
Hence \[\simplify{{a} * x = {t} / {d -c} -{b} = ({a * an1} / {an2})}\] | |
and so \[\simplify{x={an1}/{an2}}\] is the solution on dividing both sides by {a}. | |
""" | |
} | |
{ | |
name: Question 12 | |
variables: { | |
a: "random(2..5)" | |
c: "b-random(1..20)" | |
d: "random(1,2)" | |
b: "random(1..20)" | |
} | |
statement: """Solve the following equation for $x$. | |
Input your answer as a fraction or an integer as appropriate and NOT as a decimal.""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: | |
"""\[\log_{\var{a}}(x+\var{b})- \log_{\var{a}}(\simplify{(x+{c})})=\var{d}\] | |
$x=\;$ [[0]] | |
If you want help in solving the equation, click on Steps. If you do so then you will lose 1 marks and so the question will be marked out of 1 marks rather than 2 marks.. | |
Remember: Input all numbers as fractions or integers and not as decimals. | |
""" | |
gaps: [ | |
{type: jme | |
answer:"{b-c*a^d}/{a^d-1}" | |
answersimplification: "1111111111111111" | |
notallowed: {strings: [.],message:"""Input as a fraction or an integer, not as a decimal"""} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 2} | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """ | |
Two rules for logs should be used: | |
1. $\log_a(b)-\log_a(c)=\log_a(b/c)$ | |
2. $\log_a(p)=r \Rightarrow p=a^r$ | |
So use 1. followed by 2. to get an equation for $x$. | |
""" | |
} | |
] | |
stepspenalty: 1 | |
} | |
] | |
advice: | |
""" | |
We use the following two rules for logs : | |
1. $\log_a(b)-\log_a(c)=\log_a(b/c)$ | |
2. $\log_a(p)=r \Rightarrow p=a^r$ | |
Using 1. we get | |
\[\log_{\var{a}}(x+\var{b})- \log_{\var{a}}(\simplify{(x+{c})})=\log_{\var{a}}\left(\simplify{(x+{b})/(x+{c})}\right)\] | |
So the equation to solve becomes: | |
\[\log_{\var{a}}\left(\simplify{(x+{b})/(x+{c})}\right)=\var{d}\] | |
and using 2 this gives: | |
\[ \begin{eqnarray} | |
\simplify{(x+{b})/(x+{c})}&=&{\var{a}}^{\var{d}}\Rightarrow\\ | |
x+\var{b}&=&{\var{a}}^{\var{d}}(x+\var{c})=\simplify{{a^d}}(x+\var{c})\Rightarrow\\ | |
\simplify{{a^d-1}x}&=&\simplify[1111110111111111]{{b}-{c}*{a^d}={b-c*a^d}}\Rightarrow\\ | |
x&=&\simplify{{b-c*a^d}/{a^d-1}} | |
\end{eqnarray} | |
\] | |
We should check that this solution gives positive values for $x+\var{b}$ and $\simplify{x+{c}}$ as otherwise the logs are not defined. | |
Substituting this value for $x$ into $\log_{\var{a}}(x+\var{b})$ we get $\log_{\var{a}}(\simplify{({b-c | |
}{a^d})/{a^d-1}})$ so OK. | |
For $\log_{\var{a}}(\simplify{x+{c}})$ we get on substituting for $x$, $\log_{\var{a}}(\simplify{({b-c | |
})/{a^d-1}})$ so OK. | |
Hence the value we found for $x$ is a solution to the original equation. | |
""" | |
} | |
{ | |
name: Question 13 | |
variables: { | |
a: "random(2,3)" | |
c: "b+2*a^(d)" | |
d: "random(1,2)" | |
b: "s*random(1..20)" | |
s: "random(1,-1)" | |
sol1: "c-2*b" | |
sol2: "-c+a^d" | |
} | |
statement: """Solve the following equation for $x$. | |
Input your answer as a fraction or an integer as appropriate and NOT as a decimal.""" | |
parts: [ | |
{ | |
type: GapFill | |
prompt: | |
"""\[2\log_{\var{a}}(\simplify{x+{b}})- \log_{\var{a}}(\simplify{(x+{c})})=\var{d}\] | |
$x=\;$ [[0]] | |
If you want help in solving the equation, click on Steps. If you do so then you will lose 1 mark. | |
Remember: Input all numbers as fractions or integers and not as decimals. | |
""" | |
gaps: [ | |
{type: jme | |
answer:"{sol1}" | |
answersimplification: "1111111111111111" | |
notallowed: {strings: [.],message:"""Input as an integer, not as a decimal"""} | |
checkingtype: absdiff | |
checkingaccuracy:0.0001 | |
marks: 2} | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """ | |
Three rules for logs should be used: | |
1. $n\log_a(m)=\log_a(m^n)$ | |
2. $\log_a(b)-\log_a(c)=\log_a(b/c)$ | |
3. $\log_a(p)=r \Rightarrow p=a^r$ | |
So use 1. followed by 2. and 3. to get an equation for $x$. | |
""" | |
} | |
] | |
stepspenalty: 1 | |
} | |
] | |
advice: | |
""" | |
We use the following three rules for logs : | |
1. $n\log_a(m)=\log_a(m^n)$ | |
2. $\log_a(b)-\log_a(c)=\log_a(b/c)$ | |
3. $\log_a(p)=r \Rightarrow p=a^r$ | |
Using 1. we get | |
\[2\log_{\var{a}}(\simplify{x+{b}})- \log_{\var{a}}(\simplify{(x+{c})})=\log_{\var{a}}((\simplify{x+{b}})^2)- \log_{\var{a}}(\simplify{(x+{c})})\] | |
Using 2. gives | |
\[\log_{\var{a}}(\simplify{(x+{b})^2})- \log_{\var{a}}(\simplify{(x+{c})})=\log_{\var{a}}\left(\simplify{(x+{b})^2/(x+{c})}\right)\] | |
So the equation to solve becomes: | |
\[\log_{\var{a}}\left(\simplify{(x+{b})^2/(x+{c})}\right)=\var{d}\] | |
and using 3 this gives: | |
\[ \begin{eqnarray} | |
\simplify{(x+{b})^2/(x+{c})}&=&{\var{a}}^{\var{d}}\Rightarrow\\ | |
\simplify{(x+{b})^2}&=&{\var{a}}^{\var{d}}(\simplify{x+{c}})=\simplify{{a^d}(x+{c})}\Rightarrow\\ | |
\simplify{x^2+{2*b-a^(d)}x+{b^2-a^(d)*c}}&=&0 | |
\end{eqnarray} | |
\] | |
Solving this quadratic we get two solutions: | |
$x=\var{sol1}$ and $x=\var{sol2}$ | |
We should check that these solutions gives positive values for $\simplify{x+{b}}$ and $\simplify{x+{c}}$ as otherwise the logs are not defined. | |
The value $x=\var{sol1}$ gives | |
Substituting this value for $x$ into $\log_{\var{a}}(\simplify{x+{b}})$ we get $\log_{\var{a}}(\simplify{{2*a^d}})$ so OK. | |
Substituting this value for $x$ into $\log_{\var{a}}(\simplify{x+{c}})$ we get $\log_{\var{a}}(\simplify{{4*a^d}})$ so OK. | |
Hence $x=\var{sol1}$ is a solution to our original equation. | |
The value $x=\var{sol2}$ gives | |
Substituting this value for $x$ into $\log_{\var{a}}(\simplify{x+{b}})$ we get $\log_{\var{a}}(\simplify{{-a^d}})$ so NOT OK. | |
Substituting this value for $x$ into $\log_{\var{a}}(\simplify{x+{c}})$ we get $\log_{\var{a}}(\simplify{{a^d}})$ so OK. | |
Hence $x=\var{sol2}$ is NOT a solution to our original equation as $\log_{\var{a}}(\simplify{x+{b}})$ is not defined for this value of $x$. | |
So there is only one solution $x=\var{sol1}$. | |
""" | |
} | |
{ | |
name: Question 14 | |
statement: """ | |
Find the equation of the straight line which has gradient $\simplify{{b-d}/{a-c}}$ and also passes through the point $(\var{a},\var{b})$. | |
Input your answer in the form $mx+c$ for suitable values of $m$ and $c$. | |
Input $m$ and $c$ as fractions or integers as appropriate and not as decimals. | |
You use the help given by Steps - you will not lose any marks. | |
""" | |
variables: { | |
a: "random(1,-1)*random(1..4)" | |
b1: "random(-9..9)" | |
b: "if(b1=d,b1+random(1..3),b1)" | |
c: "a+Random(1..4)*s1" | |
d: "random(-9..9)" | |
s1: "random(-1,1)" | |
f:"(b-d)/(a-c)" | |
g:"(b*c-a*d)/(c-a)" | |
} | |
parts: [ | |
{ | |
type: gapfill | |
prompt: """ | |
$y=\;\phantom{{}}$[[0]] | |
""" | |
gaps: [ | |
{ type: jme, answer: "({b-d}/{a-c})x+{b*c-a*d}/{c-a}", marks: 2,answersimplification: "1111110111111111" } | |
] | |
steps: [ | |
{ | |
type: information | |
prompt: """ | |
The equation of the line is of the form $y=mx+c$. | |
You are given the gradient $m$ in and you can calculate the constant term by noting that $y=\var{b}$ when $x=\var{a}$. | |
""" | |
} | |
] | |
} | |
] | |
advice: """ | |
The equation of the line is of the form $y=mx+c$. | |
You are given the gradient $m= \simplify{{b-d}/{a-c}}$ and we can calculate the constant term $c$ by noting that $y=\var{b}$ when $x=\var{a}$. | |
Using this we get: | |
\[ | |
\begin{eqnarray} | |
\var{b}&=&\simplify[1111110111111111]{({f}){a}+c} \Rightarrow\\ | |
c&=&\simplify[1111110111111111]{{b}-{f}{a}={g}} | |
\end{eqnarray} | |
\] | |
Hence the equation of the line is | |
\[y = \simplify[1111110111111111]{{f}x+{g}}\] | |
""" | |
} | |
] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment