// Numbas version: finer_feedback_settings {"name": "Ricardo's copy of IS2.2", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["a", "ux", "xl", "i1", "lo", "j1", "up", "exans", "p", "u", "t", "tol", "ans", "cval", "lx", "xu"], "name": "Ricardo's copy of IS2.2", "tags": ["CFD", "continuous random variables", "cr1", "cumulative distribution functions", "density functions", "distribution function", "distribution functions", "integration", "PDF", "pdf", "probabilities", "probability density function", "random variables", "statistics", "tested1"], "advice": "

a)

\n

Note that in order for $f_X(x)$ to be a pdf it must satisfy two important conditions:

\n

1. $f_X(x) \\ge 0$ in the range $\\var{xl} \\le x \\le \\var{xu}$

\n

2. The area under the curve given by $f_X(x)$ is $1$ and this implies that:
\\[\\int_{\\var{xl}}^{\\var{xu}}f_X(x)\\;dx = 1\\] as the value of the function is $0$ outside this range.

\n

We first check condition 2. and then check that condition 1. is satisfied.

\n

Hence \\[\\begin{eqnarray*} \\int_{-\\infty}^{\\infty}f_X(x)\\;dx=\\int_{\\var{xl}}^{\\var{xu}}f_X(x)\\;dx&=&\\int_{\\var{xl}}^{\\simplify[std]{{xu+xl}/2}}cx\\;dx+\\int_{\\simplify[std]{{xu+xl}/2}}^{\\var{xu}}c(\\var{xu}-x)\\;dx\\\\ &=&\\simplify[std]{{(xu-xl)^2}/8}c+\\simplify[std]{{(xu-xl)^2}/8}c=\\simplify[std]{{(xu-xl)^2}/{4}}c \\end{eqnarray*} \\]
But this has to equal $1$ and so \\[c=\\simplify[std]{4/{p^2}}\\]

\n

Hence with this value of $c$ we see that condition 2. is satisfied i.e.

\n

\\[\\int_{-\\infty}^{\\infty}f_X(x)\\;dx=1\\]

\n

Condition 1. is clearly satisfied as $c \\gt 0$.

\n

b)

\n

We must have $F_X(x)=0,\\;\\;\\;x \\le \\var{xl},\\;\\;\\;\\textrm{and}\\;\\;\\;F_X(x)=1,\\;\\;\\;x \\ge \\var{xu}$

\n

Apart from that we find an expression for $F_X(x)$ in each of the ranges $[\\var{xl},\\simplify[std]{{xl+xu}/2}],\\;\\;\\;[\\simplify[std]{{xl+xu}/2},\\var{xu}]$

\n

1. $x \\in [\\var{xl},\\simplify[std]{{xl+xu}/2}]$

\n

We have:\\[\\begin{eqnarray*} f_X(x) &=& \\simplify[std]{{4}/{p^2}} x \\\\ \\Rightarrow F_X(x)&=& \\int_{-\\infty}^xf_X(x)\\;dx \\\\ &=& \\simplify[std]{{4}/{p^2}}\\int_{\\var{xl}}^x x\\;dx\\\\ &=&\\simplify[std]{{2}/{p^2}}x^2 \\end{eqnarray*} \\]

\n

2. $x \\in [\\simplify[std]{{xl+xu}/2},\\var{xu}]$

\n

We have:\\[\\begin{eqnarray*} f_X(x) &=& \\simplify[std]{{4}/{p^2}}(\\var{xu}-x) \\\\ \\Rightarrow  F_X(x)&=& \\int_{-\\infty}^xf_X(x)\\;dx = \\int_{\\var{xl}}^{\\simplify[std]{{xl+xu}/2}}f_X(x)\\;dx+\\int_{\\simplify[std]{{xl+xu}/2}}^x f_X(x)\\;dx\\\\ &=& \\simplify[std]{{4}/{p^2}}\\int_{\\var{xl}}^{\\simplify[std]{{xl+xu}/2}} x\\;dx + \\simplify[std]{{4}/{p^2}}\\int_{\\simplify[std]{{xl+xu}/2}}^x(\\var{xu}-x)\\;dx\\\\ &=&1-\\simplify[std]{{2}/{p^2}}(\\var{xu}-x)^2 \\end{eqnarray*} \\]

\n

c)

\n

Using the distribution function we have just found we have that:

\n

$P(\\var{lx} \\lt X \\lt \\var{ux}) = F_X(\\var{ux})-F_X(\\var{lx})$

\n

But $\\var{ux}$ is in the range between $\\var{(xl+xu)/2}$ and $\\var{xu}$ and the distribution function is given by:

\n

\\[F_X(x)=1-\\simplify[std]{{2}/{p^2}}(\\var{xu}-x)^2\\]

\n

Hence $F_X(\\var{ux})=1-\\simplify[std]{{2}/{p^2}}(\\var{xu}-\\var{ux})^2 = \\var{up}$ to 5 decimal places.

\n

Similarly, $\\var{lx}$ is in the range between $\\var{xl}$ and $\\var{(xl+xu)/2}$ and the distribution function is given by:

\n

\\[F_X(x)=\\simplify[std]{{2}/{p^2}}x^2\\]

\n

Hence $F_X(\\var{lx})=\\simplify[std]{{2}/{p^2}}(\\var{lx})^2 = \\var{lo}$ to 5 decimal places.

\n

Hence $P(\\var{lx} \\lt X \\lt \\var{ux}) = F_X(\\var{ux})-F_X(\\var{lx})=\\var{up}-\\var{lo}=\\var{up-lo}=\\var{ans}$ to 2 decimal places.

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
$f_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\\\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\end{array} \\right .$$0$ $ x \\leq \\var{xl},$
$cx$ $\\var{xl} \\lt x \\leq \\simplify[std]{{xu+xl}/2},$
$c(\\var{xu}-x)$ $\\simplify[std]{{xu+xl}/2} \\lt x \\leq \\var{xu},$
$0$$x \\gt \\var{xu}.$
\n \n \n \n

What value of $c$ makes $f_X(x)$ into the pdf of a distribution?

\n \n \n \n

Input your answer here as a fraction and not as a decimal.

\n \n \n \n

$c=\\;\\;$[[0]]

\n \n \n \n ", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"notallowed": {"message": "

input as a fraction and not a decimal

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "vsetrangepoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "{4}/{p^2}", "marks": 2, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "\n \n \n

Given the value of $c$ found in the first part, determine and input the distribution function $F_X(x)$

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
$F_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\\\ \\phantom{{.}}\\\\ \\phantom{{.}} \\end{array} \\right .$ [[0]] $x \\leq \\var{xl},$
[[1]] $\\var{xl} \\lt x \\leq \\simplify[std]{{xu+xl}/2},$
[[2]] $\\simplify[std]{{xu+xl}/2} \\lt x \\leq \\var{xu},$
[[3]] $ x \\gt \\var{xu}.$
\n \n \n \n

Input all numbers as fractions or integers in the above formulae.

\n \n \n \n ", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "0", "marks": 0.5, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}, {"notallowed": {"message": "

input numbers as fractions or integers and not as decimals

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "vsetrangepoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "(({2} / {(p ^ 2)}) * ((x + ( - {xl})) ^ 2))", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}, {"notallowed": {"message": "

input numbers as fractions or integers and not as decimals

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "vsetrangepoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "(1 + ( - (({2} / {(p ^ 2)}) * ((x + ( - {xu})) ^ 2))))", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "1", "marks": 0.5, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "\n \n \n

Also, using the distribution function above find:

\n \n \n \n

$P(\\var{lx} \\lt X \\lt \\var{ux})=\\;\\;$[[0]]

\n \n \n \n

(input your answer to $2$ decimal places).

\n \n \n \n ", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "ans+tol", "minValue": "ans-tol", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "statement": "

A random variable $X$ has a probability density function (PDF) given by:

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"a": {"definition": "0", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "ux": {"definition": "j1/2", "templateType": "anything", "group": "Ungrouped variables", "name": "ux", "description": ""}, "xl": {"definition": "0", "templateType": "anything", "group": "Ungrouped variables", "name": "xl", "description": ""}, "i1": {"definition": "round((t+(100-t)*(xu-1))/100)", "templateType": "anything", "group": "Ungrouped variables", "name": "i1", "description": ""}, "lo": {"definition": "precround((2/p^2)*(lx-xl)^2,5)", "templateType": "anything", "group": "Ungrouped variables", "name": "lo", "description": ""}, "j1": {"definition": "round((u*(xu+1)+(100-u)*(2*xu-1))/100)", "templateType": "anything", "group": "Ungrouped variables", "name": "j1", "description": ""}, "up": {"definition": "precround(1-(2/p^2)*(ux-xu)^2,5)", "templateType": "anything", "group": "Ungrouped variables", "name": "up", "description": ""}, "exans": {"definition": "up-lo", "templateType": "anything", "group": "Ungrouped variables", "name": "exans", "description": ""}, "p": {"definition": "(xu-xl)", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "u": {"definition": "random(0..100)", "templateType": "anything", "group": "Ungrouped variables", "name": "u", "description": ""}, "t": {"definition": "random(0..100)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "tol": {"definition": "0.01", "templateType": "anything", "group": "Ungrouped variables", "name": "tol", "description": ""}, "ans": {"definition": "precround(exans,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "ans", "description": ""}, "cval": {"definition": "precround(4/p^2,4)", "templateType": "anything", "group": "Ungrouped variables", "name": "cval", "description": ""}, "lx": {"definition": "i1/2", "templateType": "anything", "group": "Ungrouped variables", "name": "lx", "description": ""}, "xu": {"definition": "xl+random(4,6,8,12,14)", "templateType": "anything", "group": "Ungrouped variables", "name": "xu", "description": ""}}, "metadata": {"notes": "\n \t\t

8/07/2012:

\n \t\t

Added tags.

\n \t\t

Checked calculations, OK.

\n \t\t

Set tolerance via new variable tol=0.01 for last question.

\n \t\t

23/07/2012:

\n \t\t

Added description.

\n \t\t

1/08/2012:

\n \t\t

Added tags.

\n \t\t

In the Advice section, moved \\Rightarrow to the beginning of the line instead of the end of the previous line.

\n \t\t

Question appears to be working correctly.

\n \t\t

21/12/2012:

\n \t\t

Checked calculations, OK. Added tag tested1.

\n \t\t

Checked rounding, OK. Added tag cr1.

\n \t\t", "description": "

The random variable $X$ has a PDF which involves a parameter $c$. Find the value of $c$. Find the distribution function $F_X(x)$ and $P(a \\lt X \\lt b)$.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Ricardo Monge", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/471/"}]}]}], "contributors": [{"name": "Ricardo Monge", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/471/"}]}