version 1.1, 2007/01/22 21:49:26
|
version 1.2, 2007/05/22 00:55:09
|
Line 11 The answerdisplay is what is displayed w
|
Line 11 The answerdisplay is what is displayed w
|
The following example illustrates this. |
The following example illustrates this. |
\begin{verbatim} |
\begin{verbatim} |
<problem> |
<problem> |
<script type="loncapa/perl"> |
<script type="loncapa/perl"> |
$a1 = random(-6,6,4); |
$a1 = random(-6,6,4); |
$a2 = random(-6,6,4); |
$a2 = random(-6,6,4); |
$n1 = random(3,11,2); |
$n1 = random(3,11,2); |
$n2 = random(2,10,2); |
$n2 = random(2,10,2); |
$function = "$a1*cos($n1*x)+$a2*sin($n2*x)"; |
$function = "$a1*cos($n1*x)+$a2*sin($n2*x)"; |
$example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>');</script> |
$example=&xmlparse('An example would be <m eval="on">$(sin($n1\cdot x)+cos($n2\cdot x))/\sqrt{2}$</m>'); |
|
</script> |
|
|
<startouttext /> |
<startouttext /> |
Give an example of a function |
Give an example of a function |
<ol> |
<ol> |
<li>which is orthogonal to <algebra>$function</algebra> with respect to the |
<li> |
scalar product |
which is orthogonal to <algebra>$function</algebra> with respect to the |
<m>\[<g \mid h> = |
scalar product |
\frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\]</m> |
<m> |
</li> |
\[<g \mid h> = |
<li>whose norm is 1.</li> |
\frac{1}{\pi} \int_{-\pi}^{\pi}dx g(x) \cdot h(x)\] |
</ol><endouttext /> |
</m> |
|
</li> |
|
<li> |
|
whose norm is 1. |
|
</li> |
|
</ol> |
|
<endouttext /> |
|
|
<mathresponse answerdisplay="$example" cas="maxima" args="$function"> |
<mathresponse answerdisplay="$example" cas="maxima" args="$function"> |
<answer>overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi; |
<answer> |
|
overlap:integrate((RESPONSE[1])*(LONCAPALIST[1]),x,-%pi,%pi)/%pi; |
norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; |
norm:integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; |
is(overlap=0 and norm=1);</answer> |
is(overlap=0 and norm=1); |
<textline readonly="no" size="50" /> |
</answer> |
<hintgroup showoncorrect="no"> |
<textline readonly="no" size="50" /> |
<mathhint name="ortho" args="$function" cas="maxima"> |
<hintgroup showoncorrect="no"> |
<answer>overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; |
<mathhint name="ortho" args="$function" cas="maxima"> |
is(not overlap = 0);</answer> |
<answer> |
</mathhint> |
overlap: integrate((LONCAPALIST[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; |
<mathhint name="norm" args="$function" cas="maxima"> |
is(not overlap = 0); |
<answer>norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; |
</answer> |
is(not norm = 1);</answer> |
</mathhint> |
</mathhint> <hintpart on="norm"> |
<mathhint name="norm" args="$function" cas="maxima"> |
<startouttext /> |
<answer> |
The function you have provided does not have a norm of one.<endouttext /> |
norm: integrate((RESPONSE[1])*(RESPONSE[1]),x,-%pi,%pi)/%pi; |
</hintpart> |
is(not norm = 1); |
<hintpart on="ortho"> |
</answer> |
<startouttext /> |
</mathhint> |
The function you have provided is not orthogonal.<endouttext /> |
<hintpart on="norm"> |
</hintpart> |
<startouttext /> |
</hintgroup> |
The function you have provided does not have a norm of one. |
|
<endouttext /> |
|
</hintpart> |
|
<hintpart on="ortho"> |
|
<startouttext /> |
|
The function you have provided is not orthogonal. |
|
<endouttext /> |
|
</hintpart> |
|
</hintgroup> |
</mathresponse> |
</mathresponse> |
<postanswerdate><startouttext /><p>Note that with respect to the above norm, <m>$\cos(nx)$</m> is perpendicular to <m>$\sin(nx)$</m> and perpendicular to <m>$\cos(mx)$</m> for <m>$n\ne m$</m>.</p><endouttext /> |
|
|
|
|
<postanswerdate> |
|
<startouttext /> |
|
<p> |
|
Note that with respect to the above norm, <m>$\cos(nx)$</m> is perpendicular |
|
to <m>$\sin(nx)$</m> and perpendicular to <m>$\cos(mx)$</m> for |
|
<m>$n\ne m$</m>. |
|
</p> |
|
<endouttext /> |
</postanswerdate> |
</postanswerdate> |
</problem> |
</problem> |
\end{verbatim} |
\end{verbatim} |