# Checking a Caculated Value

I developled an activity which uses the CL to provide feedback to students on a calculated value.

Current, the CL calculates the value correctly but won’t mark it as correct for students sometimes.

Anyone know what the problem is?

Are you comparing depth to the calculated value in the last cell? “e” in the desmos calculator is Euler’s constant, not 10^, but there’s also some small error with increasingly large (or small) values (i.e. the 10^{-50}).

Thanks Daniel. It has something to do with the small numbers. It works if I ask students to enter the value in nanometers.

My best guess here (without being able to see what was done) is that you’re both correct and that Daniel is 100% on the right track here.

Are you by chance interpolating the values of large or small numbers into a string and then running it through the numericValue function? If so, its helpful to know that desmos will print the numeric value using e, but then calculate it as Euler’s constant, meaning that something like 0.0000000125 will go through these steps:

If a student enters 0.0000000125 into cell (1,1)
“\${cellNumericValue(1,1)}” = 1.25e-8 (because we’re interpolating the value into a string)
numericValue("\${cellNumericValue(1,1)}") = numericValue(“1.25e-8”)

and because the value of e here is Euler’s constant

numericValue(“1.25e-8”) ≈ −4.60214771443

That issue gets compounded if you add in other computations
numericValue("\${cellNumericValue(1,1)}+5") = numericValue(“1.25e-8+5”) ≈ 0.397852285574

Try playing with some values here if you need more clarification.

In order to avoid this issue, try using simpleFunction instead. e.g. simpleFunction(“x+5”).evaluateAt(cellNumericValue(1,1)) will perform these calculations using the true numeric value of the input, not the perceived value after converting to a string.

If you’re reusing variables and calculations, the (new!) evaluationFrame feature could also be useful.

What’s the evaluationFrame feature? Sounds interesting!

1 Like

Hot off the press! Computation Layer Documentation

Cool. Do you have an example use of this application?

There are some really cool applications for function transformations, etc. but a simpler and possibly more widely useful application would be to write the functions yourself, load in the functions and variables, and evaluate different combinations for different operations behind the scenes.

Honestly, I don’t see the improvement from general variable creation, or function evaluation. Can you clarify the difference?

Great point! Honestly, it comes down to what method makes the most sense to you, but there are a few ways I can see them saving you some time:

1. If you want to combine and mix & match variables and functions, making a frame and then doing so in evaluation might be faster. For example, setting up a function `x^2` and variables `a` and `b` then using `evaluate("f(a+b")` might be less work than `simpleFunction("x^2").evaluateAt(simpleFunction("x+y","x","y").evaluateAt(a,b)`
2. It also works great for nested functions like you might see in certain function machines (to parse out each step).

I threw together a few examples here. These reduced cases might still make a case for using simpleFunction and evaluateAt, but for me the time saving comes in when the screen starts to become more complex.

But again, its totally up to you and I’m not endorsing one method over the other.

1 Like