Evaluate Exponents within CL

Hi,
I’m trying to work on compound interest and I can’t get it to check something to the 36th power without typing it 36 times.

This is what doesn’t work, but if I substitute ^36 with repetitions, it does work. I just don’t want to do that for every question moving forward because I’d have to replace the “higherAPR” 36 times per question.

correct: highercalc.numericValue= numericValue("
((1+({higherAPR}/{1200}))^{36}) * {creditdebt}
")

Here’s my full activity. I’m stuck on the top portion of slide 6. (Once I get that, I’ll be able to do the bottom & subsequent slides.) Thank you in advance!!!

1 Like

It looks to be calculating fine. To find errors, I put the questionable calculation into a note to see what’s happening. Your calculation is to 6 decimal places, so you may need to use the round function. \round(expression, 2)

A few tips as well.

  1. You only need to use ${ } to call variables (or other code) in your code, so it’s unnecessary around the 1200 and 36.
  2. Since you defined the variable correct= you can use that for the sink correct: instead of using the same definition.
correct= highercalc.numericValue... etc.
correct: correct 

I like to use check for variables to avoid confusion:

check= highercalc.numericValue... etc.
correct: check

Hi,
Thank you so much! The correct: check and ${} will save me a ton of time. The note trick has also been really helpful in helping me narrow down the issue, but I’m still able to solve it.

In using the note I learned that if it’s squared, it works! But the 36th power does not work still and that’s what I need.

If I type ^36 it does ^3 and then multiplies that answer times 6, giving $295 which is incorrect.
I tried ^(36) and that gave me “undefined”. But it’s not a super big number; it’s $65. Can the CL just not handle the calculation even though the calculator can or is it a coding mistake?

If this is impossible, how else can Desmos check the students’ answers while allowing them to choose their budget and credit score. (I know how to do it if there’s one right answer for every student, but that’s not my goal).

Thank you again!!!

1 Like

Try curly braces instead of parentheses ^{36}. You can also try typing something similar into a math input and copy paste it. It should format it how it should be in the CL.

1 Like

That worked perfectly! Thank you so much!!!

1 Like