Hi all,
I created an activity that helped students investigate various models for the spread of disease. I had everything working well, all the computations did exactly what I wanted, and then Desmos changed their format for their logistic regression.
And now I need to change the computation layer so that I can display the correct number.
The form of the logistic model I want to use is

But coming from the regression equation in the graph it has this format:

Mathematically, it is easy to switch between the two: the B in my format is simply exp(-c).
What I need help on is how to get the computational layer to calculate that so that I can display it in the next slide in my format. Here’s what I have so far, but it’s not calculating at all (let alone what I need).
Any help would be greatly appreciated!
Calling a number from a graph requires that it is a defined variable in the graph. The part in quotes should be the name of your variable. I’d recommend doing those calculations in the graph and then calling those. (It would be helpful to have a link to your activity, so I could see what those errors are.)
For example, in the graph have a variable
a_1 = round(a,3)
… and call that in the CL:
a1 = Graph5.number(`a_1`)
Thanks for the help and idea. Here’s the full activity: Logistic Model
I do something similar to what I’m looking for in an earlier slide - I take the natural log of a value from the regression equation and it works perfectly:
This is from slide 9.
The computation I’m looking to fix is on slide 15. I want it to do exactly the same type of thing, but instead of taking the natural log of the value, raise e to that number (well, the negative of that number).
I haven’t looked deeply at the issue on slide 15, but you don’t have to use the built in regression equations on desmos. When you use the tilde (~) rather than an “=”, the desmos calculator will make a regression however you wish.
See here.
Thanks! That will definitely get me the numbers I need but if I can figure out how to get the calculation done I’ll probably go that way (especially since on the next slide I want the kids to identify A, B, and k from the equation).
I looked in more detail and found a couple of issues. You can keep things as is with your regression equation if you want, but see my edits for slide 15 on my copy of your activity.
Summary of them:
Need e^{ }, not \exp{ }
The script for “table5” had a couple of mistakes: check1 and check2 were flipped, and the c2 number wasn’t calculating the correct number that you were asking for in the table.
Copy of activity
Thank you so much! This is exactly what I was looking for. I know I tried the e^{ but I think I had the multiplication by -1 in the wrong place.
And thanks for the catch on Table 5. I had forgotten that I needed to switch the checks since the values coming from the graph had changed.
Thanks!
If part of your intent is to teach students to use the tools in Desmos calculator, ignore this, but if you’re having students select the regression on Screen 15 so they can compare their estimates to the actual regression, you may want to make use of @Steve_Rinard ‘s suggestions along with using a hidden folder in the graph, so you can pre-define any values you want to pull, like below:
The reason you have those green error icons is that referencing values from a full screen graph is unreliable. If students don’t use the variables you want or they create a second instance of the same variable name, the CL can’t pull them. (I’m using a numberList instead of separate variables to just pull the list once, values = this.numberList(`V_{alues}`), and index after, a = values[1], b = values[2], etc.
If you’re looking to give students the correct values, you can name them in a way students are unlikely to create, so that your CL will more reliably pull the values you intend. You’ll still have the green errors, but they’re less likely to be relevant.
I didn’t thoroughly look at your activity, so this may not be helpful. You may at least know the reason for the errors though.