I was inspired by Dijkstra’s algorithm for the September 2025 Mathcad Community Challenge. Dijkstra’s algorithm finds the shortest path from a single source to all the other nodes in a network, based on weighting. I came up with a much simpler, manageable scenario that people could apply Mathcad’s programming functionality to solve. This challenge involved points in a 2D plot, and the weighting was the distance between the points.
The Challenge
Challenge 1: Known Points
For the provided points, write a program to calculate the shortest path from the first node (5,5) to all other nodes, always choosing the shortest path from the current node.
Challenge 2: Graphing
Create a Chart Component or XY Plot that graphs this path.
Challenge 3: Advanced Inputs
Incorporate advanced input controls to allow the user to change quantities such as the number of points or generate new points / path.
Challenge 4: 3D
Can you write a program that performs the same calculation, but for points in 3D instead of 2D?
The Submissions
We had six main contributions from two of our loyal repeat contributors, Werner E and Alan Stevens.
Werner E submitted two worksheets. The first has a very clean look, incorporating a slider advanced input control for the user to change the number of points, a list box to control the index of the start node, and a button to change the number of nodes. The path length and XY plot update with the user inputs. It’s fun to play with.
The math is contained in two collapsed area and the draft view. They contain six programs with the algorithms for both 2D and 3D. The programs themselves are relatively short and elegant. While this solution was submitted relatively quickly on the day that the challenge was issued, a couple of the programs could benefit from additional documentation, especially if someone were to access the worksheet for the first time. (I find it is generally a best practice to make worksheets that “stand on their own.”) The first four programs have great explanations for what they do.
The second worksheet appears to incorporate guardrails to prevent too many solution iterations, which can lock up a worksheet. That’s a nice touch. It also contains clearer XY Plots for the closed loop and the open loop solutions. There is a nice 3D plot for the solution in 3D, but for some reason it is hidden away in the draft view.
Alan Stevens submitted four worksheets, which is even more impressive when you consider that he participates every month using Mathcad Prime Express.
The Express version does not have programming functionality. Therefore, Alan took more of a brute force approach using function definitions to calculate distances and construct a new matrix of the ordered points. The new matrix is used to plot the path on an XY Plot.
Alan’s second worksheet took on the fourth challenge, tackling the problem in 3D. He adapted the functions from his first worksheet to incorporate the Z-direction. Given that the Express version does not support 3D plots, he created 3 XY Plots in which the points and the paths are projected onto the x-y, x-z, and y-z planes.
His third worksheet tackled the 3D plotting limitation even more. He created a new variable gamma for the rotation of the plot. Then using a couple of custom functions in a collapsed area, he calculates the y-axis for the rotated simulation of the 3D plot, the projection of the points, and the vector connecting the paths. This kind of logic reminded me of video game graphics from the 1980s or the M2 Bradley Fighting Vehicle simulator I used to use at Fort Knox in the early 1990s.
Alan’s final worksheet is really impressive, as it replicates the 3D plot from the regular Mathcad Prime version. It’s pretty cool looking. I recommend you check it out. That’s quite a bit of ingenuity to replicate 3D plotting in 2D.
There was an additional submission from a community member with the username Uni. He used AI to solve the problem. We haven’t made any rules regarding AI in the challenge. However, we know that engineers and scientists use AI all the time in their programming and problem solving. I’m sure that one day we will see AI in Mathcad, Creo, and Windchill. I was eager to see what AI came up with in its approach.
However, the end result was disappointing. It appears that AI created a custom external function. I don’t understand externally coded functions, but as a Mathcad user, I shouldn’t have to. While there is a Mathcad Prime worksheet, it lacks one of the core strengths of Mathcad as an engineering tool: documentation to communicate the problem, method, and solution to others, specifically other humans. This AI generated approach may or may not have achieved the right answer. But as I have discussed the past three years, getting the right answer is often not the most important part. Who knows, AI may be able to create worksheets that can both solve and communicate effectively (to humans) one day.
What Can We Learn?
Programs are a core part of Mathcad Prime’s functionality. They help you develop complex algorithms for advanced problems. Programming is a useful and powerful tool that all users should have in their back pocket. Being able to code path-finding algorithms like Traveling Salesman, Dijkstra, or other heuristic approaches have lots of applications in networks, search, electrical engineering, and other areas.
As Alan showed, complex algorithms can be tackled without programs using the other tools in Mathcad Prime. In real-world product engineering, we often see that additional constraints force us to find more creative solutions.
Next Month
Join us in November for another programming challenge based on a popular kids’ game!
Stay up-to-date with the Mathcad Minute!
Subscribe to the Mathcad Minute newsletter to learn when new Community Challenges go live, and more!
Subscribe Here