# Error with sums in simpleFunction

Something’s not working the way it seems like it should.

When I … created this:
StatementScore = simpleFunction(“a+b+c+d+f+g+h+j+h+k”,“a”,“b”,“c”,“d”,“f”,“g”,“h”,“j”,“h”,“k”).evaluateAt(Score1,Score2,Score3,Score4,Score5,Score6,Score7,0,0,0)

Score1 =
when this.indexOfItem(1) = Reasons.indexOfItem(1) 0.5
otherwise 0

Score2 =
when this.indexOfItem(2) > this.indexOfItem(1) 0.5
otherwise 0

Score3 =
when this.indexOfItem(3) > this.indexOfItem(2) 0.5
otherwise 0

Score4 =
when this.indexOfItem(4) = Reasons.indexOfItem(4) 0.5
otherwise 0

Score5 =
when this.indexOfItem(5) > this.indexOfItem(4) 0.5
otherwise 0

Score6 =
when this.indexOfItem(6) > this.indexOfItem(5) and this.indexOfItem(6)> this.indexOfItem(3) 0.5
otherwise 0

Score7 =
when this.indexOfItem(7) > this.indexOfItem(6) 0.5
otherwise 0

I saw that total sum of the scores could be 4!

But I expected that they would be 3.5 because there are only 7 variables and the maximum for each is 0.5!

Here’s the link to the page, dashboard, or activity:Unit 1B Proofs 2.0 • Activity Builder by Desmos

And here are some screenshots or a video:

We should probably throw a warning there when this happens but you have 2 “h” variables in your function. Its taking the first instance of “h” (Score7) and using it twice in the function, once for each “h”

`a+b+c+d+f+g+h+j+h+k`

I’ll raise this with engineering and maybe we can alert you of the mistake a little better in the future.

Thanks for the find!

Thanks,
I seriously think I proofread my formula at least 10 times looking for my mistake and couldn’t find it.
A sum function would be cool too.

For each score you could alternatively define numbers in a graph, put those in a list and use total( ) in the graph.