Hi David,

define 'ln(x):=log(x)'. (See my example below.)

The maxima function 'radcan' simplifies expressions in maxima, which can contain logs, exponentials, and radicals, so it may helpful. (It is not needed in your specific example but can help to compare more subtle examples.

- Peter

<problem>

<script type="loncapa/perl">
  our $result = "4*ln(1/2)";
</script>

<part id="p0">
<customresponse id="p0r0">
  <textline />
  <answer type="loncapa/perl">
      my $given      = implicit_multiplication($submission);
      my $maxima_in  = "ln(x):=log(x);is(rat(radcan($result-($given)))=0)";
      my $evaluation = cas( 'maxima', $maxima_in );
      return 'EXACT_ANS' if $evaluation eq 'true';
      return 'INCORRECT' if $evaluation eq 'false';
      return 'BAD_FORMULA';
  </answer>
</customresponse>
</part>

</problem>





Am 06/17/2015 um 05:45 PM schrieb Huckleberry, David W:
4*(ln(1) - ln(2))


--
Dr. Peter Dencker
    wissenschaftl. Mitarbeiter

UNIVERSITÄT ZU LÜBECK
    INSTITUT FÜR MATHEMATIK

    Ratzeburger Allee 160
    23562 Lübeck

    Tel +49 451 500 4254
    Fax +49 451 500 3373
    denc...@math.uni-luebeck.de

    www.math.uni-luebeck.de
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

Reply via email to