Simplest Radical Form Point Label

If I have two points on a graph, a line segment drawn between them. I create a midpoint and the label of the midpoint is the distance between the two points. All points are integer values. However, if the points are not horizontal or vertical, then the distance between the points are shown in decimals. How can I get the distance to show the exact value in radical form? And when it is an integer, just the integer without a root symbol. This would be a graph embedded within an activity.
Kindly please help.

Found this on reddit. Didn’t mess with it, but maybe you can adjust it to your needs.

It looks like it displays sqrt(1) for integer values, but you could set a conditional in the CL when the root value =1 then it only displays the integer otherwise the reduced radical.


Okay, I altered it to fix the issue of integer display. For your purposes, you’ll just need to change the (0,-0.5) points the be your midpoint calculation.

(Edit: Fixed exterior =1 issue as pointed out below)

> Thank you for this. But if I were to set the conditional in CL, how would I get the latex for the root to show up?
> ext = Graph1.number("e_{xterior}")
> int = Graph1.number("i_{nterior}")
> pointLabel("m_1m"): 
>   when ext = 1 "\sqrt\{${int}\}"
>   when int = 1 "${ext}"
>   otherwise "${ext} \sqrt\{${int}\}"

The root symbol shows up as sqrt

I fixed it in the graph, so you don’t need to mess with the CL. FYI though, you need to use double backslashes in CL.

Ok. I see your fix. I will try to fit it into my activity. One minor thing on it however shows exterior values of 1.

Ok. I think I got it. Added another variable and condition check for the coefficient like what you did for the radical.

1 Like

Oh a new problem. If (0,5) is midpoint(a,b) how do I add in the domain/conditions for radical = 1 / 0 when I am using the midpoint function ?

Or am I relegated to not using the midpoint function and just input the midpoint formula in my coordinate?

Conditions for points need to be placed inside the parentheses. So if your midpoint was

M=(a,b) where a and b are calculated elsewhere you’d just put the condition next to either the a or b. (Although you could simply have the calculation done here, instead of referencing a and b.

M=(a,b {r_adical=1})

Essentially if the condition isn’t met, then the coordinate is not a number and thus no point gets displayed. I did three separate points, one for each variation of a reduced radical.

Thank you for all the help. This has helped me complete my activity:

Nice activity I was wondering about the dot grid, and came up with this to alleviate having to do the (a,1), (a,2), etc.

Square Dot Grid any size
(Edit: Link removed use Jay’s below!)

Maybe use makeBounds if you wanted the points to appear closer together.

You can also make a grid using mod and floor. It’ll also be less taxing on the graph (useful if you have lots of moving bits) Graphing Calculator


Soooo much simpler. Thanks!

Amazing. Thanks. I think I shall try and incorporate it.