I am following the Fixed Function Plotter example in chapter three of Modeling Science: From Free Fall to Chaos.
My graphs appear correctly, however, the trace function connects the end points of the graph (straight line) for both sin(x)/x and sin(x). What parameter do I change to eliminate this effect?
Many thanks for EJS. What a fun environment to re-learn physics.
When you set arrays as inputs to a Trail, each time the view is updated, a whole new set of points (x[i],y[i]) is added to the trail, connecting them to whatever previous points the trail had.
Because at start time the view is updated a couple of times (to make sure it has the very last state after start-up), you have not 500, but at least 1000 points displayed. The point 500 (the end of the first complete plot) is connected to the point 501 (beginning of the second copy of the plot) and this causes the ugly line you complain about.
You want to set the "Clear at input" property of the trail to "true". This clears any existing data before adding the (x[i],y[i]) pairs to the trail. This way, you will have exactly 500 points displayed each time.