<div dir="ltr">This was in reply to your R example. I have just read your most recent message. I am not sure how to provide more detailed feedback on the answer input without using customresponse. My approach is usually to just provide clear instructions to students on what is expected.<div><br></div><div>Best,</div><div>Justin<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="border:0px;margin:0px;padding:0px"><div style="border:0px;margin:0px;padding:0px"><h3 style="border:0px;margin:1.5rem 0px;padding:0px"><div style="color:rgb(0,0,0);font-family:"Source Serif Pro",sans-serif;font-size:16px;border:0px;margin:0px;padding:0px"><div style="border:0px;margin:0px;padding:0px"><p style="border:0px;margin:1rem 0px 1.5rem;padding:0px;font-stretch:normal;font-size:12px;line-height:18px;font-family:Arial,Helvetica,sans-serif"><span style="font-weight:normal">--</span></p><p style="font-weight:100;border:0px;margin:1rem 0px 1.5rem;padding:0px;font-stretch:normal;font-size:12px;line-height:18px;font-family:Arial,Helvetica,sans-serif"><b>Justin Gray</b><br>Senior Lecturer | Department of Mathematics<br>Simon Fraser University | SCK 10531<br>8888 University Dr., Burnaby, B.C. V5A 1S6<br>Canada<br></p></div></div><span style="font-weight:normal"><font size="1">Simon Fraser University is located on the Unceded Coast Salish Territories of the xʷməθkʷəy̓əm (Musqueam), Səl̓ílwətaʔ/Selilwitulh (Tsleil-Waututh), Kwikwitlem, and Skwxwú7mesh Úxwumixw (Squamish) Peoples<br></font></span></h3></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 27, 2020 at 11:49 AM Justin Gray <<a href="mailto:jgray@math.sfu.ca">jgray@math.sfu.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div>
<div dir="ltr">Perhaps you could do something with this:
<div><br>
</div>
<div><problem><br>
<script type="loncapa/perl">$ax=&random(1.0,10,0.1);<br>
$ay=&random(1.0,10,0.1);<br>
@args = ($ax, $ay);<br>
$answer = "Many answers are possible";</div>
<div></script></div>
<div><startouttext /><br>
<p>Consider a vector <m eval="on">\( \vec{a} = $ax\hat{x} + $ay\hat{y} \)</m>'.<br>
  Provide a vector <m>\( \vec{b} \)</m>, orthogonal to <m>\( \vec{a} \)</m>.<br>
</p></div>
<div>Enter the coordinates of <m>\( \vec{b} \)</m> separated by a comma. That is, answer in the form <font color="red"> <m>\( b_x, b_y \)</m></font>:<br>
<endouttext /><br>
<mathresponse cas="maxima" answerdisplay="$answer" args="@args"><br>
    <answer>is(abs([LONCAPALIST[1],LONCAPALIST[2]].[RESPONSE[1],RESPONSE[2]]) < 0.001);</answer><br>
    <textline readonly="no" spellcheck="none" />   <br>
</mathresponse><br>
</problem></div>
<div><br>
</div>
<div>Best,</div>
<div>Justin<br clear="all">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div style="border:0px;margin:0px;padding:0px">
<div style="border:0px;margin:0px;padding:0px">
<h3 style="border:0px;margin:1.5rem 0px;padding:0px">
<div style="color:rgb(0,0,0);font-family:"Source Serif Pro",sans-serif;font-size:16px;border:0px;margin:0px;padding:0px">
<div style="border:0px;margin:0px;padding:0px">
<p style="border:0px;margin:1rem 0px 1.5rem;padding:0px;font-stretch:normal;font-size:12px;line-height:18px;font-family:Arial,Helvetica,sans-serif">
<span style="font-weight:normal">--</span></p>
<p style="font-weight:100;border:0px;margin:1rem 0px 1.5rem;padding:0px;font-stretch:normal;font-size:12px;line-height:18px;font-family:Arial,Helvetica,sans-serif">
<b>Justin Gray</b><br>
Senior Lecturer | Department of Mathematics<br>
Simon Fraser University | SCK 10531<br>
8888 University Dr., Burnaby, B.C. V5A 1S6<br>
Canada<br>
</p>
</div>
</div>
<span style="font-weight:normal"><font size="1">Simon Fraser University is located on the Unceded Coast Salish Territories of the xʷməθkʷəy̓əm (Musqueam), Səl̓ílwətaʔ/Selilwitulh (Tsleil-Waututh), Kwikwitlem, and Skwxwú7mesh Úxwumixw (Squamish) Peoples<br>
</font></span></h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Sat, Oct 24, 2020 at 4:15 AM Itay <<a href="mailto:itayf@nospammail.net" target="_blank">itayf@nospammail.net</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<u></u>
<div>
<div style="font-family:Arial">Hi<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">(Sorry for miswriting Justin's name in my previous message.)<br>
</div>
<div style="font-family:Arial">I finally was able to get a working minimal example (see below).<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">This modest success bring up a few follow-up questions that I hope that list members could answer.<br>
</div>
<div style="font-family:Arial">1. How to test responder's input, e.g., for non-numeric submission?<br>
</div>
<div style="font-family:Arial">    Should I use the $submission variable with the initial <script> block?<br>
</div>
<div style="font-family:Arial">2. If the test should be done inside R : how to deliver the test results to LC?<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">I ask this because when I tested the ME below with various inputs that do not follow the expected format (non-numeric values, missing input, etc.) I got only one kind of warning 'Unable to understand formula'.<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">I would like to be able to give a more granular feedback to the students, in the spirit of the original ME.<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">Thanks<br>
</div>
<div style="font-family:Arial">Itay<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><problem><br>
</div>
<div style="font-family:Arial">  <script type="loncapa/perl"><br>
</div>
<div style="font-family:Arial">    $ax = &random(1.0, 10, 0.1); # Coordinates of \vec{a}<br>
</div>
<div style="font-family:Arial">    $ay = &random(1.0, 10, 0.1);<br>
</div>
<div style="font-family:Arial">    @avec = ($ax, $ay);<br>
</div>
<div style="font-family:Arial">    $answer="Chose b such that the scalar product with a is zero.";<br>
</div>
<div style="font-family:Arial">  </script><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">  <startouttext /><br>
</div>
<div style="font-family:Arial">  Consider a vector <m eval="on">\( \vec{a} = $ax\hat{x} + $ay\hat{y} \)</m>'.<br>
</div>
<div style="font-family:Arial">  Provide a vector <m>\( \vec{b} \)</m>, orthogonal to <m>\( \vec{a} \)</m>.<br>
</div>
<div style="font-family:Arial">  <br /><br>
</div>
<div style="font-family:Arial">  <endouttext /><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><mathresponse answerdisplay="$answer" cas="R" args="@avec"><br>
</div>
<div style="font-family:Arial">    <answer><br>
</div>
<div style="font-family:Arial">        a <- c(LONCAPALIST[1],LONCAPALIST[2]);<br>
</div>
<div style="font-family:Arial">        b <- c(RESPONSE[1],RESPONSE[2]) ;<br>
</div>
<div style="font-family:Arial">         abs(sum(a*b))<0.001<br>
</div>
<div style="font-family:Arial">    </answer><br>
</div>
<div style="font-family:Arial">    <textline readonly="no" size="20" /><br>
</div>
<div style="font-family:Arial"></mathresponse><br>
</div>
<div style="font-family:Arial"></problem><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div>On Sat, 24 Oct 2020, at 13:35, Itay wrote:<br>
</div>
<blockquote type="cite" id="gmail-m_-6649912271625615768gmail-m_-4753024819639989559qt">
<div style="font-family:Arial">Just,<br>
</div>
<div style="font-family:Arial">Thank you for your reply.<br>
</div>
<div style="font-family:Arial">Following your suggestion I tried to create a minimal example based on the template<br>
</div>
<div style="font-family:Arial;text-align:center">Math Response using Computer Algebra System R<br>
</div>
<div style="font-family:Arial">Here, too, I am having difficulties.<br>
</div>
<div style="font-family:Arial">The minimal example is enclosed below.<br>
</div>
<div style="font-family:Arial">Typing the correct answer for vector b (ay, -ax)<br>
</div>
<div style="font-family:Arial">provokes the response<br>
</div>
<div style="font-family:Arial;text-align:center">Unable to understand formula.<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">Note : the command delegated to R was tested directly with R.<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">Thank you<br>
</div>
<div style="font-family:Arial">Itay<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><problem><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">  <script type="loncapa/perl"><br>
</div>
<div style="font-family:Arial">    $ax = &random(1.0, 10, 0.1); # Coordinates of \vec{a}<br>
</div>
<div style="font-family:Arial">    $ay = &random(1.0, 10, 0.1);<br>
</div>
<div style="font-family:Arial">    @avec = ($ax, $ay);<br>
</div>
<div style="font-family:Arial">    $answer="Chose b such that the scalar product with a is zero.";<br>
</div>
<div style="font-family:Arial">  </script><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">  <startouttext /><br>
</div>
<div style="font-family:Arial">  Consider a vector <m eval="on">\( \vec{a} = $ax\hat{x} + $ay\hat{y} \)</m>'.<br>
</div>
<div style="font-family:Arial">  Provide a vector <m>\( \vec{b} \)</m>, orthogonal to <m>\( \vec{a} \)</m>.<br>
</div>
<div style="font-family:Arial">  <br /><br>
</div>
<div style="font-family:Arial">  <endouttext /><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><mathresponse answerdisplay="$answer" cas="R" args="@avec"><br>
</div>
<div style="font-family:Arial">    <answer><br>
</div>
<div style="font-family:Arial">    abs(sum(LONCAPALIST * RESPONSE))<0.001<br>
</div>
<div style="font-family:Arial">    </answer><br>
</div>
<div style="font-family:Arial">    <textline readonly="no" size="20" /><br>
</div>
<div style="font-family:Arial"></mathresponse><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"></problem><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div>On Fri, 23 Oct 2020, at 23:36, Justin Gray wrote:<br>
</div>
<blockquote type="cite" id="gmail-m_-6649912271625615768gmail-m_-4753024819639989559qt-qt">
<div dir="ltr">
<div>I'm afraid I do not have an answer to your question, but have you considered coding this problem as a mathresponse problem?<br>
</div>
<div><br>
</div>
<div>Best regards,<br>
</div>
<div>
<div>Justin<br>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div style="border-color:currentcolor;border-style:none;border-width:0px;margin:0px;padding:0px">
<div style="border-color:currentcolor;border-style:none;border-width:0px;margin:0px;padding:0px">
<h3 style="border-color:currentcolor;border-style:none;border-width:0px;margin:1.5rem 0px;padding:0px">
<div style="color:rgb(0,0,0);font-family:"Source Serif Pro",sans-serif;font-size:16px;border-color:currentcolor;border-style:none;border-width:0px;margin:0px;padding:0px">
<div style="border-color:currentcolor;border-style:none;border-width:0px;margin:0px;padding:0px">
<p style="border-color:currentcolor;border-style:none;border-width:0px;margin:1rem 0px 1.5rem;padding:0px;font-stretch:normal;font-size:12px;line-height:18px;font-family:Arial,Helvetica,sans-serif">
<span style="font-weight:normal">--</span><br>
</p>
<p style="font-weight:100;border-color:currentcolor;border-style:none;border-width:0px;margin:1rem 0px 1.5rem;padding:0px;font-stretch:normal;font-size:12px;line-height:18px;font-family:Arial,Helvetica,sans-serif">
<br>
</p>
<div><b>Justin Gray</b><br>
</div>
<div>Senior Lecturer | Department of Mathematics<br>
</div>
<div>Simon Fraser University | SCK 10531<br>
</div>
<div>8888 University Dr., Burnaby, B.C. V5A 1S6<br>
</div>
<div>Canada<br>
</div>
<p><br>
</p>
</div>
</div>
<div><span style="font-weight:normal"><span><span style="font-size:10px">Simon Fraser University is located on the Unceded Coast Salish Territories of the xʷməθkʷəy̓əm (Musqueam), Səl̓ílwətaʔ/Selilwitulh (Tsleil-Waututh), Kwikwitlem, and Skwxwú7mesh Úxwumixw
 (Squamish) Peoples</span></span></span><br>
</div>
</h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div><br>
</div>
</div>
</div>
<div><br>
</div>
<div>
<div dir="ltr">On Fri, Oct 23, 2020 at 1:18 PM Itay <<a href="mailto:itayf@nospammail.net" target="_blank">itayf@nospammail.net</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><u></u><br>
</div>
<div>
<div style="font-family:Arial">Hi<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">I am trying to develop a custom response problem in which the student submission is a vector.<br>
</div>
<div style="font-family:Arial">A minimal example is provided below.<br>
</div>
<div style="font-family:Arial">Regardless of what I typed in the either of the two input fields I get the response:<br>
</div>
<div style="font-family:Arial">'This question expects a numeric answer.'<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">Please advise what am I doing wrong?<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">Thanks in advance.<br>
</div>
<div style="font-family:Arial">Itay<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><problem>  <!-- begin minimal --><br>
</div>
<div style="font-family:Arial">  <script type="loncapa/perl"><br>
</div>
<div style="font-family:Arial">    $ax = &random(1.0, 10, 0.1); # Coordinates of \vec{a}<br>
</div>
<div style="font-family:Arial">    $ay = &random(1.0, 10, 0.1);<br>
</div>
<div style="font-family:Arial">  </script><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">  <startouttext /><br>
</div>
<div style="font-family:Arial">  Consider a vector <m eval="on">\( \vec{a} = $ax\hat{x} + $ay\hat{y} \)</m>'.<br>
</div>
<div style="font-family:Arial">  Provide a vector <m>\( \vec{b} \)</m>, orthogonal to <m>\( \vec{a} \)</m>.<br>
</div>
<div style="font-family:Arial">  <br /><br>
</div>
<div style="font-family:Arial">  <endouttext /><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">  <customresponse id="dotProd"><br>
</div>
<div style="font-family:Arial">    <answer type="loncapa/perl"><br>
</div>
<div style="font-family:Arial">      for ($i=0; $i<2; $i++) {                # Test input sanity.<br>
</div>
<div style="font-family:Arial">        if ($submission[i] =~ /^\d+\s+\w+$/) { return 'UNIT_NOTNEEDED'; }<br>
</div>
<div style="font-family:Arial">        if ($submission[i] !~ /^[\d\.]+$/)   { return 'WANTED_NUMERIC'; }<br>
</div>
<div style="font-family:Arial">      }<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">      # Is submission correct?<br>
</div>
<div style="font-family:Arial">      $dotProd = $ax * $submission[0] + $ay * $submission[1];<br>
</div>
<div style="font-family:Arial">      if (abs($dotProd) < 1.0e-3) { return 'APPROX_ANS'; }  # Can't expect EXACT_ANS.<br>
</div>
<div style="font-family:Arial">      return 'INCORRECT';<br>
</div>
<div style="font-family:Arial">    </answer><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">    <startouttext /><m>\( b_x = \)</m><endouttext /><br>
</div>
<div style="font-family:Arial">    <textline size="10" readonly="no" spellcheck="none" /><br>
</div>
<div style="font-family:Arial">    <startouttext /><br /><endouttext /><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">    <startouttext /><m>\( b_y = \)</m><endouttext /><br>
</div>
<div style="font-family:Arial">    <textline size="10" readonly="no" spellcheck="none" /><br>
</div>
<div style="font-family:Arial">    <startouttext /><br /><endouttext /><br>
</div>
<div style="font-family:Arial">  </customresponse><br>
</div>
<div style="font-family:Arial"></problem>  <!-- end minimal --><br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial"><br>
</div>
</div>
</blockquote>
</div>
<div>_______________________________________________<br>
</div>
<div>LON-CAPA-users mailing list<br>
</div>
<div><a href="mailto:LON-CAPA-users@mail.lon-capa.org" target="_blank">LON-CAPA-users@mail.lon-capa.org</a><br>
</div>
<div><a href="http://mail.lon-capa.org/mailman/listinfo/lon-capa-users" target="_blank">http://mail.lon-capa.org/mailman/listinfo/lon-capa-users</a><br>
</div>
<div><br>
</div>
</blockquote>
<div style="font-family:Arial"><br>
</div>
<div>_______________________________________________<br>
</div>
<div>LON-CAPA-users mailing list<br>
</div>
<div><a href="mailto:LON-CAPA-users@mail.lon-capa.org" target="_blank">LON-CAPA-users@mail.lon-capa.org</a><br>
</div>
<div><a href="http://mail.lon-capa.org/mailman/listinfo/lon-capa-users" target="_blank">http://mail.lon-capa.org/mailman/listinfo/lon-capa-users</a><br>
</div>
<div><br>
</div>
</blockquote>
<div style="font-family:Arial"><br>
</div>
</div>
</blockquote>
</div>
</div>

</blockquote></div>