The July 2025 Mathcad Community Challenge pertained to projecting squares onto cylinders and spheres.
The Challenge
Challenge 1: Perimeter
Calculate the perimeter of a square with a side length of 50 onto the following:
- A sphere of diameter 100.
- A cylinder of diameter 100 and length 100.
Note that the square is projected from a plane that is parallel to a plane tangent to the sphere or cylinder. It is projected in a normal direction from the tangent plane as in the accompanying images. For the sphere, the square is centered on the point of tangency for the plane to the sphere. For the cylinder, the square is centered on the middle of the cylinder and the tangent point.
Challenge 2: Area
Calculate the area of the above projected squares.
Challenge 3: Function or Program
Write a function or program that computes the perimeter or area of the projected square where the inputs are the length of a side of the square and the diameter of the sphere / cylinder.
Can you incorporate error checking in situations where the projected square goes beyond the boundaries of the square or cylinder?
Bonus Challenges
As usual, there were bonus challenges to incorporate plots and advanced input controls into the worksheets.
The Submissions
We had five submissions to the main challenge, three from Werner E and two from Alan Stevens.
The first thing you will notice about Werner’s worksheets is that they are clean, clear, elegant, and beautifully formatted. I routinely emphasize esthetics. Getting the right answer is great, but how you communicate and share your results with others is an essential component of the worksheet’s effectiveness.
Werner’s first worksheet starts with slider controls that enable the user to vary the sphere diameter and the length of a side of the square, with error checking to prevent the square from being too big for the sphere. A 3D Plot shows the sphere, the original square, and its projection. He calculates the radius of the projected circular arc, the central angle, and the perimeter. These calculations are put together into a single function for the perimeter. The area of the projected square is calculated using a surface (double) integral. Two XY Plots show how the perimeter and area vary as a function of the length of a side of the initial square. The process is repeated for the projection of the square onto a cylinder. Werner’s second worksheet explores a different solution: a Gnomonic, or rectilinear, projection of a square onto a sphere. This involves an additional variable for the height of the square over the sphere. The area calculation involves additional calculations for a quantity known as the spherical excess. Once again, XY Plots depict how the perimeter and area vary as a function of the length of the square.
Werner’s third worksheet then adds Stereographic projection, a method that preserves angles. This required symbolic evaluation to derive the functions.
Using Mathcad Express Prime, Alan derived an integral for the function of the perimeter that takes advantage of the symmetry in the projection. I always like the use of the comparison (thick) equals sign to capture the derivation process for functions. Then to calculate the area, he uses a Monte Carlo simulation! In this method, he specifies a number of trials (100 million) to generate random angles, which then generate points. This is compared to the half-length of a square side to generate a fraction. The surface area of the sphere and this fraction are multiplied to generate an approximation of the projected area. An unconventional approach for sure, but this is a great tool for users to keep in mind when tackling other problems.
Alan’s second worksheet builds on the first by writing the perimeter as a function. I hadn’t considered this when writing the challenge, but Alan wisely incorporates an “if” function in his custom function for error checking against cases where the squares projects beyond the boundary of the sphere. It also solves the projection onto the cylinder, with functions for both the area and perimeter, along with XY Plots for how those vary based on square side length.
The Wrinkle
Midway through the month, I made a post about “what could have been.” While devising the challenge, I briefly considered adding a rotation angle to the projection. After varying the angle in Creo Parametric, I decided that the projected shape was too complicated to include as a challenge. Our community, specifically Tokoro and Werner E, decided they were up to it.
Professor Tokoro’s worksheet appears based off Werner’s Gnomonic projection method for the projection of the square onto the sphere. There are sliders for the inputs and 3D Plots. The inclined projection sheet has several list boxes for changing variables. There was quite a lot of math hidden in areas and the Draft View, but unfortunately it lacked documentation to understand the flow.
Werner submitted a worksheet that directly addressed the image for the non-challenge. He defined a function for the surface element with five input variables involving the cross product of two partial derivatives. Then he calculated the double integral of this surface element to generate the same result as in Creo Parametric (up to the first decimal). Werner’s final worksheet incorporated two tilt angles – one about the horizontal and one about the vertical. (I didn’t even try incorporating the second tilt angle in Creo Parametric.) Werner’s equations are contained in collapsed areas on the worksheet. I didn’t even try to understand them, as I knew they were beyond me. But they involve trigonometric functions, summations, matrices, symbolic evaluation, and programs. Quite amazing.
Takeaways
I generally shy away from declaring a “winner” in these challenges. But this month, Werner E has delivered multiple beautiful worksheets with a variety of different mathematical approaches for solving the problems. They are interactive with input controls. They are well documented with text, XY Plots, and 3D Plots. Werner’s worksheets this month are great examples of how you can use Mathcad for solving engineering and math problems. Join us in September for a programming related challenge, and check the Community Challenge archives for the write-ups of previous challenges!
Up Next
Subscribe to the Mathcad Minute
Make sure you hear about new Mathcad challenges as they happen by subscribing to our monthly newsletter.
Subscribe Now