# [LON-CAPA-users] Extracting the numerical value fromasolve()Maxima command

Seema Ali sali at vsb.bc.ca
Thu Feb 9 09:04:19 EST 2012

Part of my problem was to round to the nearest hundredth and sometimes incorrect answers were marked correct because of the tolerance. I placed an example below of this happening.  I couldn't find a solution to this online and came up with the following, which seems to be working.

$answer = &roundto($answer,2);
Format:3F
Tolerance: 0.001

Example of question accepting incorrect responses"
Format: 2F
Tolerance 0.01

Sample question:
Solve for $x$ to the nearest hundredth where $8^{3 x} = 7^{-4 x - 10}$.

The answer ends up like this:
-1.39; [-1.39775850485268; -1.37775850485268]

I calculated the answer to be $x = \frac{-10 \log 7}{3 \log 8 + 4 \log 7} = -1.38775850485268... \approx -1.39$.

Thanks.

-----Original Message-----
From: lon-capa-users-bounces at mail.lon-capa.org on behalf of Seema Ali
Sent: Wed 2/8/2012 8:22 PM
To: Discussion list for LON-CAPA users
Subject: Re: [LON-CAPA-users] Extracting the numerical value fromasolve()Maxima command

Thanks.  I'm learning something new every day about Lon Capa.

-----Original Message-----
From: lon-capa-users-bounces at mail.lon-capa.org on behalf of Gerd Kortemeyer
Sent: Wed 2/8/2012 6:41 PM
To: Discussion list for LON-CAPA users
Subject: Re: [LON-CAPA-users] Extracting the numerical value from asolve()Maxima command

Hi,

On Feb 8, 2012, at 9:29 PM, Seema Ali wrote:

>
> I can't tell what is causing the error.  It works with other negative solutions.
>
>
> ERROR: Computer's answer is incorrect ("-1.24"). It is likely that the tolerance range [-1.24200376392202, -1.24000376392203] needs to be adjusted.
> This error occurred while processing response 1_7 in part 0

<responseparam name="tol" type="tolerance" description="Numerical Tolerance" default="0.001" />

* You have "2F" as the answer format, which means two digits right of the decimal, as in -1.24.
* Your tolerance is set to "0.001", which is three digits right of the decimal.

MAXIMA apparently calculated -1.24100376392202 as the answer. Your tolerance of 0.001 gives you  [-1.24200376392202, -1.24000376392203] as the accepted interval. The "2F"-rounded solution is -1.24, which is outside your own tolerance.

I would suggest to either use "3F" for the format or "0.01" for the tolerance, so that the computer's calculated answer is actually graded as correct.

- Gerd.

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20120209/41608bcb/attachment-0001.html>