Forum archive 2000-2006

Barbra Bannon - Cannot evaluate equation

Barbra Bannon - Cannot evaluate equation

by Arnold Pizer -
Number of replies: 0
inactiveTopicCannot evaluate equation topic started 6/26/2001; 1:40:47 PM
last post 6/26/2001; 3:33:52 PM
userBarbra Bannon - Cannot evaluate equation  blueArrow
6/26/2001; 1:40:47 PM (reads: 881, responses: 1)
When I go to input my answer of 2*h*(r^2 - h^2)^(1/2) WebWork barks and says that it cannot evaluate the expression, check for negative roots and division by zero. I know why it's saying it... because it doesn't know if h^2 is going to be greater than r^2, causing a negative square root. However, when I change the answer to 2*h*(r^2 + h^2)^(1/2) it no longer has this problem. This shouldn't be happening because I am not trying to evaluate the function with values, just variables. I have done this in other places, I don't know why it doesn't like it here. I have included the code below.

Thank you very much for your time!

TEXT(EV2(<<EOT)); $BBOLD Solution: $EBOLD $BR (A =) {ans_rule(20)} $BR EOT $var = ["h", "r"];

$ans = "2*h*(r**2 - h**2)**(1/2)";

&ANS(multivar_function_cmp($ans, $var));

<| Post or View Comments |>


userMichael Gage - Re: Cannot evaluate equation  blueArrow
6/26/2001; 3:33:52 PM (reads: 1080, responses: 0)
Hi,

In WeBWorK all evaluation (so far at least) is done numerically. Two functions are "equal" if they give the same value on 5 or 6 randomly selected points. (It's somewhat surprising how well this works.) You can adjust the domain on which the randomly selected points are chosen.

The best reference is http://webhost.math.rochester.edu/webworkdocs/docs/pglanguage/manpages/fun_cmp

fun_cmp is a replacement for multivar_function_cmp (and a bunch of similar functions) The options are described on the space above.

fun_cmp($ans, var=>['r','h'], limits=>[[1,2],[0,.9]] )

would probably work since r^2-h^2 is positive on that domain.

the default limits are [[0,1], [0,1]] which will cause trouble in this case.

-- Mike

<| Post or View Comments |>