'''
Created on 20-Jan-2022

@author: bthakur
'''

import inspect
import traceback
import random
import numpy as np
from sympy import (latex, Symbol, symbols,
                   Eq, Rational,
                   UnevaluatedExpr as ueval,
                   )

from xv.util import toIntOrFloat, listAttr
from xv.km.storeddata import BaseStoredQuestions
from xv.km import CustomLogarithm as Log
from xv.km.util import latex_log, latex_fraction, latex_exponent

# _grade12_stored_questions
# Grade12StoredQuestions

class Grade12StoredQuestions(BaseStoredQuestions):
    _QUESTION_KEYWORDS = None
    
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        pass
    
    
    def get_question_mean_stdev(self):
        keywords = [
            'grade12',
            'grade 12',
            'mean_stdev',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Ms. Davis is doing an activity with her statistics students where she gives them a 20 -question multiple choice test, and they know none of the answers. Students need to guess on every question, and each question has 5 possible choices, 1 of which is correct.

        What are the mean and standard deviation of the number of questions that each student gets correct? You may round your answers to the nearest tenth.
        """
        
        soln_s = rf"""
        For a binomial random variable $X$, we can use this formula for mean:
		$\mu_{{X}}=n p$
		
		We use this formula for the standard deviation:
		$\sigma_{{x}}=\sqrt{{n p(1-p)}}$
		Since there are 20 questions, we have $n=20$.
		Each question has 5 possible choices, 1 of which is correct, so we have $p=\frac{{1}}{{5}}=0.20$.
		
		$\begin{{aligned}} \mu_{{X}} &=n p \\ &=(20)(0.20) \\ &=4 \text {{ correct }} \end{{aligned}}$
		$\begin{{aligned}} \sigma_{{X}} &=\sqrt{{n p(1-p)}} \\ &=\sqrt{{(20)(0.20)(1-0.20)}} \\ &=\sqrt{{3.2}} \\ & \approx 1.79 \text {{ correct }} \end{{aligned}}$
		
		The answer:
		mean: 4 correct
		standard deviation: $1.8$ correct
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        The answer:
		mean: 4 correct
		standard deviation: $1.8$ correct
		
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_area_under_graph(self):
        keywords = [
            'grade12',
            'grade 12',
            'area_under_graph',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        TODO area_under_graphs

        Approximate the area between the $x$-axis and $h(x)=x^{{3}}+2$ from $x=-1$ to $x=5$ using a trapezoidal sum with 3 equal subdivisions.
		"""
        
        soln_s = rf"""
        The plan
		- Determine the width of the trapezoids.
		- Determine the input values.
		- Evaluate the area.
		
		Determining the width of the trapezoids
		We want 3 equal subdivisions from $x=-1$ to $x=5$.
		$\displaystyle \frac{{5-(-1)}}{{3}}=2$
		Each subdivision has a width of 2 units.
		
		Determining the input values
		We are using a trapezoidal sum. Let's use a graph to visualize where the left and right endpoint of each interval is.
		We will use the input values of -1, 1, 3, and 5 .
		
		Evaluating the area
		To find the area of each trapezoid, we multiply its width times the average of the heights at the left and right endpoints. We get the heights from the values of the function at our inputs.
		Area $\displaystyle =2 \cdot \frac{{h(-1)+h(1)}}{{2}}+2 \cdot \frac{{h(1)+h(3)}}{{2}}+2 \cdot \frac{{h(3)+h(5)}}{{2}}$
		$\begin{{aligned}} &=\frac{{2}}{{2}}[h(-1)+2 \cdot h(1)+2 \cdot h(3)+h(5)] \\ &=1\left[\left((-1)^{{3}}+2\right)+2 \cdot\left(1^{{3}}+2\right)+2 \cdot\left(3^{{3}}+2\right)+\left(5^{{3}}+2\right)\right] \\ &=192 \end{{aligned}}$
		
		Answer
		The approximate area is 192 .
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        The approximate area is 192 .

		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_area_under_graph_1(self):
        keywords = [
            'grade12',
            'grade 12',
            'area_under_graph_1',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Evaluate the area between the function $4 x^{{2}}$ and the $x$-axis on the interval $[-3, 0]$.
		"""
        
        soln_s = rf"""
        Using definite integral as area
		The region is all above the $x$-axis, so we can find this area by evaluating the definite integral:
		$\begin{{aligned}} &\int_{{-3}}^{{0}}\left(4 x^{{2}}\right) d x \\ &=\left.\frac{{4 x^{{3}}}}{{3}}\right|_{{-3}} ^{{0}} \end{{aligned}}$
		Applying the fundamental theorem of calculus
		$\begin{{aligned}} &=\left(\frac{{4 \cdot 0^{{3}}}}{{3}}\right)-\left(\frac{{4 \cdot(-3)^{{3}}}}{{3}}\right) \\ &=0-(-36) \\ &=36 \end{{aligned}}$
		Answer
		The area is 36 units $^{{2}}$.
		
        
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        The area is 36 units $^{{2}}$

		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_probability(self):
        keywords = [
            'grade12',
            'grade 12',
            'probability',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        A lot of bulbs is tested by randomly testing three bulbs drawn from the lot without replacement. If all three bulbs are non-defective, the lot is approved.
        A particular lot contains 14 bulbs, out of which 10 are non-defective and 4 are defective.
        Find the probability that this lot is approved.
        """
        
        soln_s = rf"""
        Here we can apply the [multiplication rule of probability.].
		Probability that all the three bulbs are non-defective, $\mathrm{{P}}(\mathrm{{NNN}})$ is given by
		$\mathrm{{P}}(\mathrm{{NNN}})=\mathrm{{P}}(\mathrm{{N}}) \times \mathrm{{P}}(\mathrm{{N}} \mid \mathrm{{N}}) \times \mathrm{{P}}(\mathrm{{N}} \mid \mathrm{{NN}})$
		where,
		$\mathrm{{P}}(\mathrm{{N}})$ : probability that the first bulb is non-defective.
		$\mathrm{{P}}(\mathrm{{N}} \mid \mathrm{{N}})$ : probability that the second bulb is non-defective given that the first bulb is nondefective.
		$\mathrm{{P}}(\mathrm{{N}} / \mathrm{{NN}})$ : probability that the third bulb is non-defective given that the first and second bulbs are non-defective.
		There are 4 defective and 10 non-defective bulbs. Therefore, $\displaystyle \mathrm{{P}}(\mathrm{{N}})=\frac{{10}}{{14}}=\frac{{5}}{{7}}$.
		After one non-defective bulb is drawn, we are left with 4 defective and 9 non-defective bulbs.
		Therefore, $\displaystyle \mathrm{{P}}(\mathrm{{N}} \mid \mathrm{{N}})=\frac{{9}}{{13}}$.
		After two non-defective bulbs are drawn, we are left with 4 defective and 8 non-defective bulbs. Therefore, $\mathrm{{P}}(\mathrm{{N}} / \mathrm{{NN}})=\frac{{8}}{{12}}=\frac{{2}}{{3}}$.
		
		Finally,
		$\begin{{aligned}} \mathrm{{P}}(\mathrm{{NNN}}) &=\mathrm{{P}}(\mathrm{{N}}) \times \mathrm{{P}}(\mathrm{{N}} \mid \mathrm{{N}}) \times \mathrm{{P}}(\mathrm{{N}} \mid \mathrm{{NN}}) \\ &=\frac{{5}}{{7}} \times \frac{{9}}{{13}} \times \frac{{2}}{{3}} \\ &=\frac{{30}}{{91}} \end{{aligned}}$
		The required probability is $\frac{{30}}{{91}}$.
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
         $\frac{{30}}{{91}}$.

		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_limits(self):
        keywords = [
            'grade12',
            'grade 12',
            'limits',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        TODO limits

        Functions h and g are graphed.
        
        Find $\lim _{{x \rightarrow-1}} h(g(x))$.
		Choose 1 answer:
		(A) $-1$
		(B) 0
		(C) 1
		(D) 3
		(E) The limit doesn't exist
		
		
        """

        
        soln_s = rf"""
        We are asked to find the limit of a composition of functions.
		Therefore, we will use the following property of limits of composite functions:
		If $u$ and $v$ are functions such that $\lim _{{x \rightarrow c}} v(x)=L$ and $\lim _{{x \rightarrow L}} u(x)=u(L)$ (which means both limits exist and $u$ is continuous at $x=L$ ), then
		$\lim _{{x \rightarrow c}} u(v(x))=u\left(\lim _{{x \rightarrow c}} v(x)\right)=u(L)$
		Let's see how this is applied in our problem.
		Let's start with the internal function, $g$.
		We need to make sure $\lim _{{x \rightarrow-1}} g(x)$ exists and find its value.
		According to the graph, $\lim _{{x \rightarrow-1}} g(x)$ doesn't exist.
		Since $\lim _{{x \rightarrow-1}} g(x)$ doesn't exist, we can't use the above property.
		In conclusion, $\lim _{{x \rightarrow-1}} h(g(x))$ doesn't exist.
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        The limit doesn't exist

		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_vector_projection(self):
        keywords = [
            'grade12',
            'grade 12',
            'vector_projection',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        TODO vector_projection

        Vector $\overrightarrow{{A B}}$ shown below has magnitude 3 .
		Find the scalar projection of $\overrightarrow{{A B}}$ on the directed line $l$.

		
        """

        
        soln_s = rf"""
        To find the projection of a vector on a line, we drop a perpendicular from the head of the vector onto the line.
		The length $A C$ gives us the scalar projection.
		Also the projection is positive if $A \rightarrow C$ points in the direction of the line $l$. The projection is negative if it points in the opposite direction.
		Let us find the scalar projection of $\overrightarrow{{A B}}$ on $l$ for the given question.
		
		The perpendicular from $B$ onto the line coincides with the point $A$ itself. So, no projection is formed. In other words, the length of the projection $A C$ described in the previous hint is 0 .
		Hence the required projection is 0 .

        {hint_s.strip()}
        """
        
        answer_s = rf"""
        Projection is 0.

		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_angle_between_lines(self):
        keywords = [
            'grade12',
            'grade 12',
            'angle_between_lines',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        The cartesian equations of two lines are 
		$\displaystyle \frac{{x}}{{2}}=\frac{{y}}{{5}}=\frac{{z}}{{1}}$ and $\displaystyle \frac{{x}}{{4}}=\frac{{y}}{{1}}=\frac{{z}}{{-1}}$
		Find the acute angle between the lines.
		$\theta = \cos ^{{-1}}(?)$
		
		
        """

        
        soln_s = rf"""
        Let us call the lines $l_{{1}}$ and $l_{{2}}$.
		$\displaystyle \begin{{aligned}} &l_{{1}}: \frac{{x}}{{2}}=\frac{{y}}{{5}}=\frac{{z}}{{1}} \\ &l_{{2}}: \frac{{x}}{{4}}=\frac{{y}}{{1}}=\frac{{z}}{{-1}} \end{{aligned}}$
		The direction of $l_{{1}}$ is specified by the vector $2 \hat{{i}}+5 \hat{{j}}+\hat{{k}}\left(=\overrightarrow{{b_{{1}}}} \text{{ say}}\right)$, and that of $l_{{2}}$ is specified by the vector $4 \hat{{i}}+\hat{{j}}-\hat{{k}}\left(=\overrightarrow{{b_{{2}}}}\text{{ say}}\right)$.
		
		Angle between $l_{{1}}$ and $l_{{2}}$ will be same as the angle between $\overrightarrow{{b_{{1}}}}$ and $\overrightarrow{{b_{{2}}}}$. The angle between two vectors can be found by utilising their dot product.
		If $\theta$ is the acute angle between the lines $l_{{1}}$ and $l_{{2}}$, then,
		$\displaystyle \cos \theta=\left|\frac{{\overrightarrow{{b_{{1}}}} \cdot \overrightarrow{{b_{{2}}}}}}{{\left|\overrightarrow{{b_{{1}}}}\right|\left|\overrightarrow{{b_{{2}}}}\right|}}\right|$
		Note: here we have taken the absolute value (||) to ensure that we get the acute angle between the lines
		
		$\displaystyle \begin{{aligned}} \cos \theta &=\left|\frac{{(2 \hat{{i}}+5 \hat{{j}}+\hat{{k}}) \cdot(4 \hat{{i}}+\hat{{j}}-\hat{{k}})}}{{\sqrt{{2^{{2}}+5^{{2}}+1^{{2}}}} \sqrt{{4^{{2}}+1^{{2}}+(-1)^{{2}}}}}}\right| \\ &=\left|\frac{{8+5-1}}{{\sqrt{{30}} \times \sqrt{{18}}}}\right| \\ &=\left|\frac{{12}}{{6 \sqrt{{15}}}}\right| \\ &=\frac{{2}}{{\sqrt{{15}}}} \\ \theta &=\cos ^{{-1}}\left(\frac{{2}}{{\sqrt{{15}}}}\right) \end{{aligned}}$
		The acute angle between the given lines is $\displaystyle \cos ^{{-1}}\left(\frac{{2}}{{\sqrt{{15}}}}\right)$.
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $\displaystyle \cos ^{{-1}}\left(\frac{{2}}{{\sqrt{{15}}}}\right)$.
		
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_function_value(self):
        keywords = [
            'grade12',
            'grade 12',
            'function_value',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        If $f^{{\prime}}(x)=1 / f(x)$ and $f(0)=2$, then $f(4)$ can be written in fully simplified form as $m \sqrt{{n}}$ for some integers $m$ and $n$.
		What are $m$ and $n$ ?
		
		
        """

        
        soln_s = rf"""
        If we let $y=f(x)$ and change the derivative notation, we can rewrite the differential equation so that it's separable.
		$\displaystyle \frac{{d y}}{{d x}}=\frac{{1}}{{y}}$
		What does it look like after we separate the variables?
		$\displaystyle y d y=d x$
		Let's integrate both sides of the equation.
		$\displaystyle \int y d y=\int d x$
		What do we get?
		$\displaystyle \frac{{y^{{2}}}}{{2}}=x+C$
		What value of $C$ satisfies the initial condition $y(0)=2$ ?
		Let's substitute $x=0$ and $y=2$ into the equation and solve for $C$.
		$\displaystyle \frac{{2^{{2}}}}{{2}}=0+C$
		$C=2$
		Now use this value of $C$ to express $y$ in terms of $x$.
		$\displaystyle \frac{{y^{{2}}}}{{2}}=x+2$
		$y^{{2}}=2 x+4$
		$y=\pm \sqrt{{2 x+4}}$
		Which sign satisfies the initial condition $y(0)=2$ ?
		We must choose the positive sign to satisfy the initial condition.
		$y=\sqrt{{2 x+4}}$
		If $y(4)=m \sqrt{{n}}$ in fully simplified form, what are the integers $m$ and $n$ ?
		$\begin{{aligned}} y(4) &=\sqrt{{2 \cdot 4+4}} \\ &=\sqrt{{3 \cdot 4}} \\ &=2 \sqrt{{3}} \\ &=m \sqrt{{n}}\end{{aligned}}$
		Thus, $m=2$ and $n=3$.
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $m=2$ and $n=3$.
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_local_linear_approximation(self):
        keywords = [
            'grade12',
            'grade 12',
            'local_linear_approximation',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        The local linear approximation to the function $g$ at $x=6$ is $y=-3 x+4$.
		What is the value of $g(6)+g^{{\prime}}(6)$ ?
		Choose 1 answer:
		(A) $-17$
		(B) $-18$
		(C) $-19$
		(D) $-20$
		
        """

        
        soln_s = rf"""
       The local linear approximation of $g$ at $x=6$ is achieved using the equation of the line tangent to $g$ at $x=6 .$
		
		In other words, $y=-3 x+4$ is the equation of the line tangent to the graph of $g$ at $x=6$. How can we use this to find $g(6)$ and $g^{{\prime}}(6)$ ?
		Since the line is tangent to the graph of $g$ at $x=6$, we know two key facts about it:
		- The line passes through the point $(6, g(6))$
		- The line's slope is $g^{{\prime}}(6)$
		The slope of $y=-3 x+4$ is $-3$.
		The $y$-value that corresponds to $x=6$ is $-3(6)+4=-14$.
		Now we can find our answer:
		$g(6)+g^{{\prime}}(6)=-14+(-3)=-17$
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        -17
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_second_derivative(self):
        keywords = [
            'grade12',
            'grade 12',
            'second_derivative',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Find $\displaystyle \frac{{d^{{2}}}}{{d x^{{2}}}}[\ln (2 x+4)]$
		
        """

        
        soln_s = rf"""
        $\displaystyle \frac{{d^{{2}}}}{{d x^{{2}}}}[\ln (2 x+4)]$ is the second derivative of $\ln (2 x+4)$. In other words, it's the derivative of $\displaystyle \frac{{d}}{{d x}}[\ln (2 x+4)]$, which is the derivative of $\ln (2 x+4)$.
		Therefore, in order to find $\displaystyle \frac{{d^{{2}}}}{{d x^{{2}}}}[\ln (2 x+4)]$, we need to differentiate $\ln (2 x+4)$ twice.
		
		Let's start by finding $\displaystyle \frac{{d}}{{d x}}[\ln (2 x+4)]$ :
		$\displaystyle \frac{{d}}{{d x}}[\ln (2 x+4)]=\frac{{1}}{{x+2}}$
		
		Now we can differentiate $\displaystyle \frac{{1}}{{x+2}}$ to find $\displaystyle \frac{{d^{{2}}}}{{d x^{{2}}}}[\ln (2 x+4)]$ :
		$\begin{{aligned}} & \frac{{d^{{2}}}}{{d x^{{2}}}}[\ln (2 x+4)] \\ =& \frac{{d}}{{d x}}\left[\frac{{1}}{{x+2}}\right] \\ =&-\left(\frac{{1}}{{x+2}}\right)^{{2}} \end{{aligned}}$
		In conclusion, $\displaystyle \frac{{d^{{2}}}}{{d x^{{2}}}}[\ln (2 x+4)]=-\left(\frac{{1}}{{x+2}}\right)^{{2}}$
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $\displaystyle \frac{{d^{{2}}}}{{d x^{{2}}}}[\ln (2 x+4)]=-\left(\frac{{1}}{{x+2}}\right)^{{2}}$
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_slope_of_graph_at_value(self):
        keywords = [
            'grade12',
            'grade 12',
            'slope_of_graph_at_value',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        What is the slope of the tangent line to the curve $\displaystyle f(x)=\frac{{x}}{{\cos x}}$ at the point where $x=0$ ?
		Choose 1 answer:
		(A) 0
		(B) 1
		(C) $-1$
		(D) $\displaystyle \frac{{\pi}}{{2}}$
		(E) Does not exist
		
        """

        
        soln_s = rf"""
        The slope of the tangent to the curve at $x=0$ is the value of the derivative at $x=0$.
		Using the quotient rule, we find the derivative of $\displaystyle f(x)=\frac{{x}}{{\cos x}}$.
		$\displaystyle f^{{\prime}}(x)=\frac{{(\cos x)(1)-(x)(-\sin x)}}{{(\cos x)^{{2}}}}$
		At the point where $x=0$, the value of the derivative is
		$\displaystyle \begin{{aligned}} &f^{{\prime}}(0)=\frac{{(\cos 0)(1)+0 \cdot \sin 0}}{{(\cos 0)^{{2}}}} \\ &f^{{\prime}}(0)=\frac{{1+0}}{{1}}=1 \end{{aligned}}$
		
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        1
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_relative_minimum(self):
        keywords = [
            'grade12',
            'grade 12',
            'relative_minimum',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        TODO relative_minimum
        
        
        Let $g$ be a polynomial function and let $g^{{\prime}}$, its derivative, be defined as $g^{{\prime}}(x)=-x^{{2}}(x+1)^{{2}}(x-1)^{{2}}$.
		At how many points does the graph of $g$ have a relative minimum ?
		Choose 1 answer:
		(A) None
		(B) One
		(C) Two
		(D) Three
		
		
        """

        
        soln_s = rf"""
        None
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        None
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_matrix_dimension(self):
        keywords = [
            'grade12',
            'grade 12',
            'matrix_dimension',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        $\displaystyle \left[\begin{{array}}{{ccc}} -3 & 1 & -4 \\ 0 & 0 & 1 \end{{array}}\right]$
		What are the dimensions of the matrix?
		
		
        """

        
        soln_s = rf"""
        The first dimension is the number of rows in the matrix.
        There are 2 rows.
        The second dimension is the number of columns in the matrix.
        There are 3 columns.
        In conclusion, the dimensions of the matrix are $2 \times 3$.
        {hint_s.strip()}
        """
        
        answer_s = rf"""
        $2 \times 3$
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_function_value_1(self):
        keywords = [
            'grade12',
            'grade 12',
            'function_value_1',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Function h is graphed. The graph has a vertical tangent at x=-4.
        Select all the x-values for which h is not differentiable.
        Choose all answers that apply:
        (A) -4
        (B) 0
        (C) $\displaystyle \frac{{3}}{{2}}$
        (D) 5

		
        """

        
        soln_s = rf"""
        There are three cases where a function is not differentiable:
		1. Wherever the function isn't continuous
		2. Wherever the graph of the function has a vertical tangent line
		3. Wherever the graph of the function has a sharp turn
		We are given that the graph has a vertical tangent line at $x=-4$, so the function isn't differentiable at that point.
		
		There is no problem with a function's differentiability at points where the tangent line is horizontal, so the function is differentiable at $x=0$.
		We can see from the graph that it is continuous for all $x$-values and that there are no sharp corners.
		In conclusion, these are the $x$-values where the function isn't differentiable:
		$x=-4$
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        $x=-4$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_vector_value(self):
        keywords = [
            'grade12',
            'grade 12',
            'vector_value',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Todo vector_value 
        A vector $\overrightarrow{{O P}}$ is shown below.
		Write down $\overrightarrow{{O P}}$ in component form.
		
		
        """

        
        soln_s = rf"""
        We can think of any vector as being made up of 3 components along the $x, y$ and $z$ directions. The sum of these components results in that vector.
		$\displaystyle \vec{{v}}=v_{{x}} \hat{{i}}+v_{{y}} \hat{{j}}+v_{{z}} \hat{{k}}$
		Remember that $\hat{{i}}, \hat{{j}}$ and $\hat{{k}}$ are the standard unit vectors along $x, y$ and $z$ directions respectively. In the given question, the red lines along the axes tell us the components of $\overrightarrow{{O P}}$.
		$\displaystyle O P_{{x}}=-4, O P_{{y}}=-5$ and $O P_{{z}}=3$
		Tying these to the standard unit vectors, we have
		$\displaystyle \overrightarrow{{O P}}=-4 \hat{{i}}-5 \hat{{j}}+3 \hat{{k}}$
		Therefore, the required vector is $-4 \hat{{i}}-5 \hat{{j}}+3 \hat{{k}}$
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        $-4 \hat{{i}}-5 \hat{{j}}+3 \hat{{k}}$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_set_relation(self):
        keywords = [
            'grade12',
            'grade 12',
            'set_relation',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        $A=\{{1,2,3,4\}}$. A relation $R$ in the set $A$ is given by $R=\{{(1,1),(2,3),(3,2),(4,3),(3,4)\}}$
		The relation $R$ is
		Choose all answers that apply:
		(A) Reflexive
		(B) Symmetric
		(C) Transitive
		(D) None of the above
		
		
        """

        
        soln_s = rf"""
        Check for reflexive:
		For all the elements $a_{{i}} \in A$, the pair $\left(a_{{i}}, a_{{i}}\right)$ must be present in $R$.
		Although $(1,1)$ is present in the relation, $(2,2),(3,3)$ and $(4,4)$ are not. Thus, the relation is not reflexive.
		
		Check for symmetric:
		For every pair $\left(a_{{1}}, a_{{2}}\right) \in R$, the symmetric pair $\left(a_{{2}}, a_{{1}}\right)$ must also be present in $R$.
		See that for every pair its symmetric counterpart is present in the relation. Thus, the relation is symmetric.
		Note that a pair like $(1,1)$ is trivially symmetric.
		
		Check for transitive:
		For every couple of pairs $\left(a_{{1}}, a_{{2}}\right) \in R$ and $\left(a_{{2}}, a_{{3}}\right) \in R$ (note the common element $a_{{2}}$ ), there must be a third pair $\left(a_{{1}}, a_{{3}}\right)$ present in $R$.
		$(2,3)$ and $(3,2)$ are present in the relation. But $(2,2)$ is not.
		There are other instances as well where transitivity fails. Hence, the relation is not transitive.
		
		The relation is symmetric, but neither reflexive nor transitive.
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        The relation is symmetric.
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_matrix_inverse(self):
        keywords = [
            'grade12',
            'grade 12',
            'matrix_inverse',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        $\displaystyle A=\left[\begin{{array}}{{rr}} 2 & -2 \\ 7 & 9 \end{{array}}\right] \text {{ and }} B=\left[\begin{{array}}{{cc}} \frac{{1}}{{4}} & -\frac{{5}}{{32}} \\ \frac{{7}}{{32}} & \frac{{1}}{{16}} \end{{array}}\right]$
		Are $A$ and $B$ inverses?
		Choose 1 answer:
		Yes, $A$ and $B$ are inverses.
		No, $A$ and $B$ are not inverses.
		
		
        """

        
        soln_s = rf"""
        The Strategy
		When two matricies are inverses, their product (in either order) equals the identity matrix, $I$.
		Therefore, we must check to see if $A B=I$.
		
		Finding $A B$
		$A B=\left[\begin{{array}}{{rr}}2 & -2 \\ 7 & 9\end{{array}}\right]\left[\begin{{array}}{{cc}}\frac{{1}}{{4}} & -\frac{{5}}{{32}} \\ \frac{{7}}{{32}} & \frac{{1}}{{16}}\end{{array}}\right]$
		$=\left[\begin{{array}}{{ll}} \left(2 \cdot \frac{{1}}{{4}}-2 \cdot \frac{{7}}{{32}}\right) & \left(2 \cdot-\frac{{5}}{{32}}-2 \cdot \frac{{1}}{{16}}\right) \\ \left(7 \cdot \frac{{1}}{{4}}+9 \cdot \frac{{7}}{{32}}\right) & \left(7 \cdot-\frac{{5}}{{32}}+9 \cdot \frac{{1}}{{16}}\right) \end{{array}}\right]$
		$=\left[\begin{{array}}{{rr}} \frac{{1}}{{16}} & -\frac{{7}}{{16}} \\ \frac{{119}}{{32}} & -\frac{{1}}{{32}} \end{{array}}\right]$
		$\neq I$
		
		Since the product $A B$ does not give us the identity matrix, $A$ and $B$ are not inverses.
		No, $A$ and $B$ are not inverses.


		{hint_s.strip()}
        """
        
        answer_s = rf"""
        No, $A$ and $B$ are not inverses.
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_minimum_value_interval(self):
        keywords = [
            'grade12',
            'grade 12',
            'minimum_value_interval',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Let $h(x)=2 x^{{3}}+3 x^{{2}}-12 x+5$
		The absolute minimum value of $h$ over the closed interval $-3 \leq x \leq 2$ occurs at what $x$-value?
		Choose 1 answer:
		(A) 1
		(B) $-3$
		(c) $-2$
		(D) 2
		
        """

        
        soln_s = rf"""
        $h$ is continuous for all real numbers. Therefore, according to the Extreme Value Theorem, it must have an absolute maximum (or minimum) over any closed interval.
		
		Let's first find the relative extremum points of $h$, and then compare them to the function's values on the edges of the interval. The lowest relative minimum will be the function's absolute minimum value.
		We start with finding the critical points of $h$.
		The derivative of $h$ is $h^{{\prime}}(x)=6(x+2)(x-1)$.
		- $h^{{\prime}}(x)=0$ for $x=-2,1$.
		- Since $h^{{\prime}}$ is a polynomial, it's defined for all real numbers.
		
		Therefore, our critical points are $x=-2$ and $x=1$. They are both within the closed interval $-3 \leq x \leq 2$
		Our critical points divide the closed interval into three intervals:
		
		Let's evaluate $h^{{\prime}}$ at each interval to see if it's positive or negative on that interval.
		
		Let's evaluate $h^{{\prime}}$ at each interval to see if it's positive or negative on that interval.
		Now let's look at all the critical points and the endpoints of the interval:
		
		We can see that the absolute minimum point of $h$ is $(1,-2)$, which means the absolute minimum value of $h$ occurs at $x=1$.
		In conclusion, the absolute minimum value of $h$ over $-3 \leq x \leq 2$ occurs at $x=1$.
		

		{hint_s.strip()}
        """
        
        answer_s = rf"""
        the absolute minimum value of $h$ over $-3 \leq x \leq 2$ occurs at $x=1$.
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_distance_point_vector(self):
        keywords = [
            'grade12',
            'grade 12',
            'distance_point_vector',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Find the distance of the point $(9,-2,9)$ from the plane $\vec{{r}} \cdot(2 \hat{{i}}+7 \hat{{j}}+\hat{{k}})=16$.
		
        """

        
        soln_s = rf"""
        The distance of a point with position vector $\vec{{a}}$ from the plane $\vec{{r}} \cdot \vec{{N}}=d$ is given by 
		$\displaystyle\frac{{|\vec{{a}} \cdot \vec{{N}}-d|}}{{|\vec{{N}}|}}$
		Given point is $(9,-2,9)$. So $\vec{{a}}=9 \hat{{i}}-2 \hat{{j}}+9 \hat{{k}}$.
		Also, $\vec{{N}}=\hat{{i}}+4 \hat{{j}}+8 \hat{{k}}$ and $d=16$.
		$\displaystyle \begin{{aligned}} &\frac{{|\vec{{a}} \cdot \vec{{N}}-d|}}{{|\vec{{N}}|}} \\ &=\frac{{|(9 \hat{{i}}-2 \hat{{j}}+9 \hat{{k}}) \cdot(2 \hat{{i}}+7 \hat{{j}}+\hat{{k}})-16|}}{{\sqrt{{2^{{2}}+7^{{2}}+1^{{2}}}}}} \\ &=\frac{{ 18-14+9-16|}}{{3 \sqrt{{6}}}} \\ &=\frac{{1}}{{\sqrt{{6}}}} \end{{aligned}}$
		The required distance is $\displaystyle \frac{{1}}{{\sqrt{{6}}}}$ units.
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
         $\displaystyle \frac{{1}}{{\sqrt{{6}}}}$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_first_derivative(self):
        keywords = [
            'grade12',
            'grade 12',
            'first_derivative',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Determine the derivative of the function
		$\displaystyle y=\frac{{e^{{2 x}}}}{{x^{{2}}+1}} .$
		Choose 1 answer:
		(A) $\displaystyle \frac{{d y}}{{d x}}=\frac{{e^{{2 x}}}}{{x}}$
		(B) $\displaystyle \frac{{d y}}{{d x}}=\frac{{2 e^{{2 x}}\left(x^{{2}}-x+1\right)}}{{\left(x^{{2}}+1\right)^{{2}}}}$
		(C) $\displaystyle \frac{{d y}}{{d x}}=\frac{{e^{{2 x}}\left(2 x^{{2}}-x+2\right)}}{{\left(x^{{2}}+1\right)^{{2}}}}$
		(D) $\displaystyle \frac{{d y}}{{d x}}=\frac{{2 e^{{2 x}}\left(x^{{2}}+x+1\right)}}{{\left(x^{{2}}+1\right)^{{2}}}}$
		
        """

        
        soln_s = rf"""
        The function $y$ is the quotient of the two functions
		$f(x)=e^{{2 x}} \quad$ and $\quad g(x)=x^{{2}}+1 .$
		Hence, we need to use the Quotient Rule:
		$\displaystyle \frac{{d y}}{{d x}}=\frac{{g(x) \cdot f^{{\prime}}(x)-f(x) \cdot g^{{\prime}}(x)}}{{(g(x))^{{2}}}}$
		Since $f^{{\prime}}(x)=2 e^{{2 x}}$ and $g^{{\prime}}(x)=2 x$
		that gives 
		$\displaystyle \frac{{d y}}{{d x}}=\frac{{\left(x^{{2}}+1\right) \cdot 2 e^{{2 x}}-e^{{2 x}} \cdot(2 x)}}{{\left(x^{{2}}+1\right)^{{2}}}}$
		$\displaystyle =\frac{{2 e^{{2 x}}\left(x^{{2}}-x+1\right)}}{{\left(x^{{2}}+1\right)^{{2}}}}$
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
        $\displaystyle \frac{{d y}}{{d x}}=\frac{{2 e^{{2 x}}\left(x^{{2}}-x+1\right)}}{{\left(x^{{2}}+1\right)^{{2}}}}$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_angle(self):
        keywords = [
            'grade12',
            'grade 12',
            'angle',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Find the principal value of $\displaystyle \cos ^{{-1}}\left(-\frac{{1}}{{\sqrt{{2}}}}\right)$.
		Note: Input in radians.
		
        """

        
        soln_s = rf"""
        
		What should be the output of an inverse trigonometric function? It should be an angle, right. 
		So, let us assume $\displaystyle \cos ^{{-1}}\left(-\frac{{1}}{{\sqrt{{2}}}}\right)$ is equal to some angle $\theta$ and then proceed.
		$\displaystyle \sin ^{{-1}}\left(-\frac{{1}}{{\sqrt{{2}}}}\right)=\theta$
		$\displaystyle \cos \theta=-\frac{{1}}{{\sqrt{{2}}}}$
		Now $\displaystyle \cos \theta=-\frac{{1}}{{\sqrt{{2}}}}$ for many values of $\theta$
		However the range of the principal value branch of the $\cos ^{{-1}}$ function is $[0, \pi]$. Hence, we need to search for $\theta$ in this interval only.
		
		On the unit circle, the $x$-coordinate gives the value of $\cos \theta$. Which angle corresponds to $\displaystyle x=-\frac{{1}}{{\sqrt{{2}}}}$ on the unit circle?
		We know $\displaystyle \cos \frac{{\pi}}{{4}}=\frac{{1}}{{\sqrt{{2}}}}$
		See that $\displaystyle \cos \left(\pi-\frac{{\pi}}{{4}}\right)=\cos \frac{{3 \pi}}{{4}}=-\frac{{1}}{{\sqrt{{2}}}}$. Also, $\displaystyle \frac{{3 \pi}}{{4}} \in[0, \pi]$. Hence, $\displaystyle \frac{{3 \pi}}{{4}}$ is the required principal value.
		The principal value of $\displaystyle \cos ^{{-1}}\left(-\frac{{1}}{{\sqrt{{2}}}}\right)$ is $\displaystyle \frac{{3 \pi}}{{4}}$.
		

		{hint_s.strip()}
        """
        
        answer_s = rf"""
		The principal value of $\displaystyle \cos ^{{-1}}\left(-\frac{{1}}{{\sqrt{{2}}}}\right)$ is $\displaystyle \frac{{3 \pi}}{{4}}$.

		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_first_derivative_1(self):
        keywords = [
            'grade12',
            'grade 12',
            'first_derivative_1',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Let $g(x)=-3 \log (x)$.
		Find $g^{{\prime}}(x)$.
		Choose 1 answer:
		(A) $\displaystyle-\frac{{3}}{{\ln (10) x}}$
		(B) $\displaystyle-\frac{{3}}{{x \log (x)}}$
		(C) $\displaystyle-\frac{{3}}{{\log (x)}}$
		(D) $\displaystyle-\frac{{3}}{{x \ln (x)}}$
		
        """

        
        soln_s = rf"""
        
		The expression for $g(x)$ includes a logarithmic term.
		Remember that the derivative of the general logarithmic term $\log _{{a}}(x)$ (where $a$ is any positive constant and $a \neq 1$) is $\displaystyle \frac{{1}}{{\ln (a) \cdot x}}$.
		Put another way, $\displaystyle \frac{{d}}{{d x}}\left[\log _{{a}}(x)\right]=\frac{{1}}{{\ln (a) \cdot x}}$.
		We can use this to find the derivative of the function as shown below.
		$\displaystyle \begin{{aligned}} g^{{\prime}}(x) &=\frac{{d}}{{d x}}[-3 \log (x)] \\ &=-3 \frac{{d}}{{d x}}[\log (x)] \\ &=-3 \frac{{d}}{{d x}}\left[\log _{{10}}(x)\right] \quad \text {{ Since }} \log (x)=\log _{{10}}(x) \\    &=-3 \cdot \frac{{1}}{{\ln (10) x}} \\ &=-\frac{{3}}{{\ln (10) x}} \end{{aligned}}$
		
		In conclusion, $\displaystyle g^{{\prime}}(x)=-\frac{{3}}{{\ln (10) x}}$
		

		{hint_s.strip()}
        """
        
        answer_s = rf"""
		$\displaystyle-\frac{{3}}{{\ln (10) x}}$
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_dice_probability(self):
        keywords = [
            'grade12',
            'grade 12',
            'dice_probability',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Suppose that Ayumi rolls a pair of fair six-sided dice. Let $A$ be the event that the first die lands on 2 and $B$ be the event that the second die lands on 2 .
        Using the sample space of possible outcomes below, answer each of the following questions.
        What is $P(A)$, the probability that the first die lands on 2 ?
        What is $P(B)$, the probability that the second die lands on 2 ?
        What is $P(A$ and $B)$, the probability that the first die lands on 2 and the second die lands on ?
        Are events $A$ and $B$ independent?
        Choose 1 answer:
        (A) Yes, events $A$ and $B$ are independent events.
        (B) No, events $A$ and $B$ are not independent events.

        """

        
        soln_s = rf"""
        We can find $P(A)$ by dividing the number of outcomes where the first roll is a 2 by the total number of outcomes. There are 6 outcomes where the first roll is 2 .
		Since there are 36 total possible outcomes, $\displaystyle P(A)=\frac{{6}}{{36}}=\frac{{1}}{{6}}$.
		We can find $P(B)$ by dividing the number of outcomes where the second die is 2 by the total number of outcomes. There are 6 outcomes where the second die is 2 .
		Since there are 36 total possible outcomes, $\displaystyle P(B)=\frac{{6}}{{36}}=\frac{{1}}{{6}}$.
		We can find $P(A$ and $B)$ by finding the total number of outcomes where the first roll is a 2 and the second roll is 2 . There is only one outcome, $(2,2)$, that satisfies both of these conditions.
		Since there are 36 total possible outcomes, $\displaystyle P(A \text{{ and }} B)=\frac{{1}}{{36}}$.
		We know that two events are independent when the probability of both events occurring is equal to the product of their individual probabilities, when $P(A$ and $B)=P(A) \cdot P(B)$. Since we know $P(A), P(B)$, and $P(A$ and $B)$, we can test for independence through substitution.
		
		Through substitution, we can say that $\displaystyle P(A) \cdot P(B)=\frac{{1}}{{6}} \cdot \frac{{1}}{{6}}=\frac{{1}}{{36}}$.
		Since $\displaystyle \frac{{1}}{{36}}=\frac{{1}}{{36}}, P(A$ and $B)=P(A) \cdot P(B)$ and it is true that $A$ and $B$ are independent events.
		The correct final responses are:
		- $\displaystyle P(A)=\frac{{1}}{{6}}$
		- $\displaystyle P(B)=\frac{{1}}{{6}}$
		- $\displaystyle P(A$ and $\displaystyle B)=\frac{{1}}{{36}}$
		- Events $A$ and $B$ are independent events.


		{hint_s.strip()}
        """
        
        answer_s = rf"""
		The correct final responses are:
		- $\displaystyle P(A)=\frac{{1}}{{6}}$
		- $\displaystyle P(B)=\frac{{1}}{{6}}$
		- $\displaystyle P(A$ and $\displaystyle B)=\frac{{1}}{{36}}$
		- Events $A$ and $B$ are independent events.
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_absolute_minimum(self):
        keywords = [
            'grade12',
            'grade 12',
            'absolute_minimum',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        Let $f(x)=-x^{{4}}+8 x^{{2}}-8$.
		What is the absolute minimum value of $f$ ?
		Choose 1 answer:
		(A) $-60$
		(B) $-12$
		(C) $-8$
		(D) $f$ has no minimum value
		
        """

        
        soln_s = rf"""
        FIX solution


        Let's first find the relative extremum points of $f$, and then consider them along with the function's end behavior in both directions.
		
		We start with finding the critical points of $f$. 
		The derivative of $f$ is $f^{{\prime}}(x)=-4 x(x+2)(x-2)$. 
		- $f^{{\prime}}(x)=0$ for $x=-2,0,2$.
		- $f^{{\prime}}$ is defined for all real numbers.
		Therefore, our critical points are $x=-2, x=0$, and $x=2$.
		
		Our critical points divide the function's domain (which is all real numbers) into four intervals:
		
		Let's evaluate $f^{{\prime}}$ at each interval to see if it's positive or negative on that interval.
		
		Now let's look at all the critical points:
		
		Let's imagine ourselves walking on the graph of $f$, starting all the way to the left (from $-\infty$ ) and going all the way to the right (until $+\infty)$.
		
		According to the table, we will start by going up until $(-2,8)$, then go down until $(0,-8)$, then up again until $(2,8)$, and then forever go down.
		
		This means that $\lim _{{x \rightarrow-\infty}} f(x)=\lim _{{x \rightarrow+\infty}} f(x)=-\infty$, which means $f$ has no minimum value. In conclusion, $f$ has no absolute minimum value.
		
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
		$f$ has no minimum value
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_limit_graph(self):
        keywords = [
            'grade12',
            'grade 12',
            'limit_graph',
            ]
        
        
        hint_s = rf"""
        <b>See the following managers for more detailed explanation:</b>
        
        
        """
        
        prob_s = rf"""
        TODO limit_graph

        The graph of g is shown below. With the graph as an aid, evaluate the limit expressions.
		$\displaystyle \begin{{array}}{{ll}} \lim _{{h \rightarrow 0}} \frac{{g(2+h)-g(2)}}{{h}} & = ? \\ \lim _{{h \rightarrow 0}} \frac{{g(-5.4+h)-g(-5.4)}}{{h}} & =? \end{{array}}$
		
        """

        
        soln_s = rf"""
    
        The piece-wise function $g$ is composed of two rays and one segment with a removable discontinuities at $x=3$. The ray to the left where $x<-2$ has a slope of $\displaystyle -\frac{{3}}{{2}}$, the horizontal segment in the middle where $-2 < x < 3$ has a slope of 0 , and the ray to the right where $x > 3$ has a slope of 1 .
		The first problem: This expression equals the slope at $x=2$, in the middle section, and equals $0 .$
		The second problem: This expression equals the slope at $x=-5.4$, to the left, and equals $\displaystyle \frac{{-3}}{{2}}$.
		
		{hint_s.strip()}
        """
        
        answer_s = rf"""
		The first problem: This expression equals the slope at $x=2$, in the middle section, and equals $0 .$
		The second problem: This expression equals the slope at $x=-5.4$, to the left, and equals $\displaystyle \frac{{-3}}{{2}}$.
		"""

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass

    def get_question_SAMPLE(self):
        keywords = [
            'grade12',
            'grade 12',
            ]
        
        hint_s = rf"""
        <b>:</b>
        
        """
        
        prob_s = rf"""

        """
        
        soln_s = rf"""

        
        {hint_s.strip()}

        """
        
        answer_s = rf"""
        
        
        """

        result = {
            'keywords': keywords,
            'prob_s': prob_s.strip(),
            'soln_s': soln_s.strip(),
            'answer_s': answer_s.strip(),
            }
        return result
        pass
    
    
    pass
#class Grade12StoredQuestions:
