This Demonstration lets you visualize the ray diagrams for converging and diverging lenses. By manipulating the object and lens locations, you can create real or virtual images. The rays parallel to the principal axis and the ray through the center of the lens are drawn.
Locators allow you to drag both the object and the lens. You can change the focal length using a slider. The degree of magnification and nature (real or virtual) of the image are displayed.