To learn as much as you can from that I suggest taking it apart and seeing what each piece does.

For example, take the Reduce[...] out of that and run that all by itself, no Manipulate, just the Reduce. See what it produces. Then realize the y value was originally set by the Manipulate, so instead just choose some constant to replace y and again see what the Reduce does. Perhaps then make some changes and experiment until you think you see how you could use Reduce in the future.

Next try the slightly bigger ToRules[Reduce[...]] and see what that is doing to the result from Reduce. Try to guess why that was done.

Next there is { and } around ToRules, what is that doing?

Then there is /. and the whole world of substitution in Mathematica. You might look at some simple examples in the documentation and try some simple exercises until you think you've got it.

And all this is then substituted into the Line[...]. Look at what that creates for some values of y and try to see why that was done the way it was.

The Plot[...] is fairly simple and the help system should show you pretty much everything about that except for the Epilog part.

Drawing horizontal and diagonal lines in a plot is easy, drawing Sin is easy. Vertical lines are more challenging, you can't just ask it to plot y=Infinity*x+3 to get a line with infinite slope==vertical line. So for that you need what is probably best just called "a trick."

You can find that trick explained using Google if you have learned how to discover Mathematica examples using Google. Try using your best intuition about using Google and see if you can find that Mathematica trick documented. Think what key words to use to most likely stumble onto that. Improving that skill will help you many times over.

Then you assemble all those pieces together and put them inside a Manipulate to get your result.

You might find it helpful, each time you find a way to solve a problem that might appear in a slightly different form in the future, to add some explanation and tuck it away in a notebook of solutions that you keep. Mine is called MmaBits.nb and is filled with one and two and six line examples of doing something that I may need to refer back to someday. Now and then I see that I need to further clean up or enhance some method that I used, but often it is just a library of things that I can quickly look through and avoid the need to rediscover something from scratch.

I hope it works out for you

URL: ,

Subject (listing for 'Finding deg or Radian values between -1 and 1 f...')