A list of multiple intersections, question and bugs(?)
Given a function f(x), if I type
multiple points are created at each of the zeros of f, i.e., points were f(x)=0. If I then change f to change the number of zeros, then more points are automatically created if needed, or some points go undefined. All well and good, but I do not understand how this works in order to use this to generate lines at the zeros. If there was a way to generate a list of all the intersection points, then I could manipulate the list to create other objects from it.
For the attached construction, the zeros of f represent equilibria of a differential equation. The function f is plotted in the Graphics window and a plot of the solution versus time is in the Graphics 2 window. I want to plot horizontal lines in Graphics 2 at the level of the equilibria. I have developed a way that works that I'm happy enough with, but another (seemingly better) way that I thought should work have failed. I'm not sure why.
My first attempt to get a list of zeros was to create a sequence
to find the first 10 intersections. I assumed that might result in undefined points, but I could just use RemoveUndefined to get rid of them. However, entering this command results in it getting changed to
Sequence[Intersect[f, xAxis, 1], i, 1, 10]
i.e., it now is a sequence of just the first intersection repeated over and over. It seems like a bug to me. But, maybe there some reason for this behavior?
The solution that I did get to work was
Sequence[Intersect[f, xAxis, (xx, 0)], xx, xmin, xmax, (xmax - xmin) / 50]
where xmin and xmax are set to be the limits of the x-axis. I don't have a problem with this solution (other than the below bug), as I don't expect students to enter functions where this will miss equilibria. But, since it seems like a bit of a kludge, I was wondering if there was a better way to do it.
I've also run into one other bug that shows up with this method. If I start with the equilibria (i.e., these intersections) hidden, checking the button in an embedded applet to reveal the equilibria does not reveal them. The equilibria don't show up until one makes changes to the function f. I created a workaround by putting
as the On Update script for the Boolean showing/hiding the equilibria. But that's pretty stilly to have to put that in there.