Animate Hypotenuse based on Math Input

I was messing around with ways to add interpretive feedback into a pythagorean theorem activity for my 8th graders. I built a triangle from IM (unit 8, activity 7.3) and couldn’t resist the opportunity to add the Price is Right mountain climber to the story! See what I’ve come up with here: Mountain Climber in Desmos Calculator

I have the mountain climber traveling along a certain path based on a variable but here’s what I’m hoping you’ll be able to help me figure out next:

  1. I want a message to appear when the mountain climber has not gone far enough, made it to the top, or gone too far
  2. when I add the graph to a classroom activity I want a student’s solution for the hypotenuse of the triangle (entered through a math input) to control how far the mountain climber travels.

Thank you (from me and my students) to anyone who can help me make this happen!

Hey Kathryn,

This is cool! If you add the mountain climber falling if they go to far, I can see students having a blast with that for a bit before getting down to work :slight_smile:

Can you clarify?

If a student enters 7 units, you want the mountain climber to travel 7 units in the direction of the hypotenuse, correct?

How familiar are you with the CL? Are you wondering how to mathematically make happen, programmatically, both, something else?


I’m definitely pushing my thinking in terms of how to use equations to create an animation! I’m also in pretty early stages of learning CL when it comes to getting components to interact with each other but have some fairly basic understandings.

Yes, when a student enters 7 units, I want the mountain climber to travel 7 units in the direction of the hypotenuse (instead of the leg).

In my graph, under the folder titled “mountain climber” the distance traveled is controlled by “a” and when “a” is greater than a certain value the mountain climber will fall but “a” is based on the horizontal leg, not the hypotenuse. It feels like there should be a way to have it be controlled by the value you enter for the hypotenuse, I’m just not seeing it… yet. I think once I have this I can get CL components to talk to each other… (maybe!) :slight_smile:

I made an interactive Pythagorean exploration a bit ago, using unit vectors, but to be honest, my memory of that math is still poor. I just discovered Desmos can do parametric equations, and I feel like that might be helpful here. Perhaps you know that math better than I do, or someone else does.

Here’s my exploration: Pythagorean Exploration with squares DRAFT

Look in the “Hypotenuse Square squares” folder. There are a few variables, but it’s based on finding the unit vector. I think you could use your unit vector along with the student’s entered magnitude to decide how far the climber should go.

As for animating, I think that’s actually simpler. Here’s a link to the math input documentation. You want to use
in some way…

You exploration is great! The unit squares makes the area of the leg & hypotenuse squares look more concrete, less abstract. Would it be okay to use your exploration with my students?

I think you’re right that parametric equations might be helpful and timeSinceSubmit seems to work too!

I got the mountain climber to move based on student’s input being the hypotenuse (yahoo!). For that I had to make “a” dependent on “c” and make "c’ the slider.

I got it to animate too but now it’s going too far based on the input… I just need to find the disconnect but I think I’m almost there! - Mountain Climber in Classroom Activities

Thank you for your help!

Absolutely use the exploration!

The climber falls! That’s fun. :slight_smile:

@Kathryn here’s what I did for animating a graph before based on student input. This slide takes their input and injects it into the graph, then animates it based on timeSinceSubmit() similar to how you mentioned earlier @Aethir.

p and z are waiting for definition in the graph, but p governs the domain restriction on displaying the function z. The linear function based on p is just to scale the timing to a pleasing amount.

Exact CL code in graph component is

#correct values of g, calculated in graph, g(-8) & g(10)

#test eq from std input
eq= simpleFunction(math5.latex, "x")

#graph stdt input -- z(x)=1000 before submission
function(`z`): when math5.submitted eq otherwise simpleFunction("1000")

#time variable -- only runs when submitted
number(`p`): when math5.submitted math5.timeSinceSubmit() otherwise 1000

test =
  when eq.evaluateAt(-8)=ans1 and eq.evaluateAt(10)=ans2 true
  otherwise false

correct: test

activity here

Nice, Sandi!

This is a trick I picked up here - when you are setting your “test” for correctness, remember that it’s a boolean. So, instead of

test = when eq.evaluateAt(-8)=ans1 and eq.evaluateAt(10)=ans2 true
       otherwise false

you can accomplish the same thing with

test = eq.evaluateAt(-8)=ans1 and eq.evaluateAt(10)=ans2

That’s neat Sandi! I’ll have to give that a try.

After watching a few youtube videos I finally found a streamline way that made sense and made it happen using a median function!

Check it out screen 2 through 4 here: Lesson 7 Practice • Activity Builder by Desmos
2 introduces the context then they can take it for a spin on 3 and 4.

Next steps for me are to figure out how to make the mountain climber appear before they enter their input but this will do for now!

Thank you both for all your suggestions.

1 Like

Awesome! The mountain climber doesn’t appear because c and t_0 don’t exist before the students input something, right?

Try something like this:

number(`c`): when isDefined(input4.numericValue) input4.numericValue 
             otherwise 2

Yes, that worked! Awesome! Thank you, thank you.

1 Like