# Desmos help - making a finite length line with origin on a sine wave move along it and vary angle orthogonal to sine wave line

I'm trying to model something that seems fairly simple, but it's trickier than I thought on https://www.desmos.com.

On desmos I created a function:

$$f(x)=y$$

$$y=(0 \leq x \leq 2)\sin( \pi x+b )$$   to make a simple oscillating sine wave

I want to make a line of fixed length that has its origin on the sine wave, and moves along it when I play variable "b". (and maybe another variable that I don't realise that I need).

I've tried a couple of things like:

$$y = (\sin(x) \leq x \leq ( \pi /4))y = mx + c$$

$$m = 2/ \pi$$

and

points:

$$(\cos(b), \sin(b))$$

and

$$(\pi/2, \sin(b))$$

but I haven't quite got there yet

Once I have this sliding line, I want to do two things with it:

1. make it's angle change, orthogonal to the line of the sine wave
2. make a series of them moving along the sine wave.

I'm sure this is possible, and it's just that I'm not familiar enough in general to conjure it up.

any help would be warmly received.

thank you.

Disclaimer - I don't know enough to know whether this question has been answered already; and I don't know enough about how you want questions formatted on here or how to do it, sorry.

• Your description is too vague, I'm willing to help you but I don't understand precisely what you're really after. Draw an illustration and attach the photo. – Km356 May 2 '20 at 10:00
• Ok... I'll try... If you know what a quiver plot is? Like this: stackoverflow.com/questions/45824733/… – Reginald Lloyd May 2 '20 at 11:14
• What makes you think you can do that using desmos? It may be possible but it probably won't be simple, nor practical. Look for something more sophisticated than desmos, tools on which you may plot the vector fields related to ODEs. – Km356 May 2 '20 at 20:55
• Actually it is possible... I've seen some very clever simulations done on it, so that's why I think it's possible. I've actually nearly done it, with some help from a very smart kid. It's amazing what you can do with such a simple thing. Those maths tools and software are sometimes overkill for some problems, you shouldn't need to have to almost learn to code to simulate something you can model or describe mathematically. – Reginald Lloyd May 3 '20 at 12:40
• If so, you'll have to add details, like; what the fixed length is, the slopes of these lines, by how many degrees you want their angles to change and in what direction (I don't understand what your "orthogonal to the sine line" means) and how many lines per an interval of a certain fixed length (at what points $x$ should the lines intersect the curve)..etc. You'll have to describe that using familiar terms that we can understand. – Km356 May 3 '20 at 14:24

Ok... I'll try... If you know what a quiver plot is? Like this: https://www.stackoverflow.com/questions/45824733/plotting-wind-vectors-or-wind-barbs-in-a-1d-chart-using-matplotlib. If you can imagine the second image by user Guto was a series of lines moving along a sine of points (b, sin(2b) ) along sine wave sin(pi * x + b), it might be close. On that quiver plot the arrows change with angle that looks in some ways the same but also opposite to what I want, like some kind of rotational symmetry.

So maybe think of this as a kind of double pendulum simulation.

There are two pendulums in series of different lengths, a long one will have a longer period and smaller angle than the second shorter pendulum.

So as the big pendulum swings to the left, the little pendulum has to swing opposite to it to try and cancel out the swing.

It can do this if the angle of the big pendulum is smaller than the little pendulum, and and the period of the big pendulum is consequently longer.

So as the big pendulum swings to one side, the little pendulum has to swing to the other side

On desmos, I want to represent the big pendulum as a sine wave. The little pendulum then has to be a short line that has its origin on the sine wave and the little pendulum has to swing in a way that is equal and opposite to the angle of the sine, and that's represented by being perpendicular to it, at all points along the sine.