How to Plot Intersection of Two Cylinders in Maple

A tricky but reasonable affair!

I’d like to show you basic usage of two plotting commands in Maple by solving a relatively difficult problem to reason about and visualize (at least for some of us!). The commands are implicitplot and plot3d.

Each of these Maple commands (ie functions) has multiple possible calling sequences. By “calling sequence” I mean a specific order and number of arguments that you can pass to one of these functions.

In other words, you can call these functions in different ways. The walkthrough below will use only some of such calling sequences, and I refer you to the docs if you are interested in all the other ways these commands can be used.

Here is a github repo with a Maple file containing all the calculations and plots below (plus a version in spherical coordinates). The relevant file is called 14.8-Ex 15-Two Cylinders.mw.

Problem Description

Consider the cylinders

and

The first is a cylinder with the z axis running down through the middle, and the second has the y axis running down through the middle.

Our ultimate goal is to plot the intersection of the two cylinders (can you guess what it looks like?), but we will lead up to that goal by creating other interesting plots.

Plotting the Cylinders Themselves

Using implicitplot

First we plot the cylinders themselves.

Note that we are plotting two implicit functions at once, and we do this by providing the implicit functions in a list (done using brackets with elements separated by comma), and then necessarily specifying the range of each variable in the implicit function expressions.

I’ve chosen the range -2 to 2 for each variable because the diameter of each cylinder is 2.

Since the equations for the cylinders are already defined implicitly, using implicitplot is the straightforward way to plot these equations.

with(plots);
implicitplot3d([x² + y² = 4, x² + z² = 4], x = -2 .. 2, y = -2 .. 2, z = -2 .. 2);