FOR and IF cycles in iterative solving of two equations by values substituting
- December 14, 2025
- 1 reply
- 492 views
Dear PTC Mathcad Community,
I am working in Mathcad Prime on a nonlinear moment–curvature analysis of a reinforced concrete section according to Ukrainian concrete Code ДСТУ Б В.2.6-156:2010 (Appendix A, second equilibrium form).
I implemented a step-by-step algorithm with nested FOR loops, conditional checks, and accumulation of results into a matrix Moment_curvature.
Problem description
I expect to obtain a matrix with multiple rows (i.e., 10 rows), where each row corresponds to the final iteration of strains (εc1, εc2), which have to iterate until the condition of equation (4.3) N<0 is true, and contains:
- iteration index
- concrete strains εc1, εc2
- curvature א
- steel stresses
- bending moment M
However, Mathcad returns an empty table only, even though:
- the outer loop is defined as for i ∈ 1..n with n = 20
- the loop body is executed
- no errors are reported
I understand that my script is one of the few possible ways to solve the issue; thus, with this regard, my questions arose:
- How can I use a WHILE loop for my iteration until the condition of equation (4.3), N<0, is true, in the correct way to substitute the found value of εc2, which led to the condition of equation (4.3), N<0, in Mathcad Prime (if it is a more straightforward way to mess with)?
- What are my mistakes that lead to Mathcad returning only the empty expression of a 20x9 matrix instead of the full loop result?
I would greatly appreciate any guidance, examples, or references on best practices for iterative algorithms and matrix construction in Mathcad Prime that could help me resolve the issue.
Thank you very much for your time and support.
P.S.
For clarity, I attach my zipped file, which describes the algorithm I wish to realise in Prime 10.0.0 version.
Also, the explanation of what I expect to get from the code, the picture of the curvature, and the Table of data (performed in an online software) have been added to the attached Mathcad file.

