11 Replies Latest reply: Jan 7, 2014 10:43 AM by WE RSS

    Possible to create iterative solve blocks?

    dsochor Silver

      In the attached MathCAD 14 worksheet I am attempting to solve for the embedment length for multiple sets of variables ( concrete dimensions a,b,ma,mb) using the Given command/block. Is it possible to pass multiple groups of variables in these three equations and solve for the single variable E using the Given block?

      For each set of variables only one equation is solvable for E while the other two will not be solveable. The solvable equation changes as the dimensions changes. If the equation is not solvable, is it possible to for MathCAD to return a zero or unsolveable response instead of turning red?

        • Re: Possible to create iterative solve blocks?
          WE Platinum

          Not sure what kind of iteration you are talking about in the subject.


          But if you get riod of the range variable and the elementwise (subscribted/indexed) notation using it, make E a 3x1 vector and, again, use vectorize, you get a solution.


          Not sure about what you mean with only one equ would give a solution?


          Concerning error catching you could turn the solve block into a parameterized function (whatever the input parameters would be) and create a new function using the "on error" statement to return NaN if the solve block function fails. See attached

          But in your case it failed always because of kind bad syntax.

          • Re: Possible to create iterative solve blocks?
            AndyWesterman Gold

            If you make the solve blocks as parameterized functions you can calculate the 3 results.

            if some of them don't converge to a solution there was a function "ReDefine" posted on this forum which takes a text string parameter.

            if there is a variable of that name it returns the value, if not it returns "Undefined" & this can be used in subsequent calculations.


            Hope this is what you want