Skip to main content
10-Marble
March 12, 2026
Question

Solve Block Query

  • March 12, 2026
  • 3 replies
  • 382 views

Attempting to use a range to help determine a solve block but am struggling to get this function to work. Any ideas on how to debug this issue? See attached image. 

 

 

 

3 replies

21-Topaz II
March 12, 2026

Hi

It is better to include the worksheet not an image.

Necessary to put the worksheet in a zip archive file to upload it.

Which version of Prime are you using?

 

First

c1 is a range not a vector variable

Capture.JPG

25-Diamond I
March 12, 2026

Why did you define c.1 as a range and use it later in the solve block?

Why did you try to use a range as a guess value for the variable c.12 the solve block is supposed to provide a solution for?

Definitions (using  :=   ) should be placed outside and in front of the solve block.

Assign c.12 a constant (guess) value like c.12 := 20 mm and see if Prime can find a solution. 

As it looks you are just looking for the (a) zero of function g.

You may also use the "root" function for this, but you would not be able to apply additional constraints when you do so.

Guess that for further help you would have to post the worksheet (and say, which version of Prime you are using).

21-Topaz II
March 13, 2026

Here is how to declare vectors and use them in a parametrized solve block repeatedly.

Capture.JPG

10-Marble
March 16, 2026

Thanks both, 

 

Do apologise for not attaching the Mathcad sheet in the first place, see attached. 

The issue I am trying to resolve is on page 34 of the attached. 

 

I am working with Mathcad Prime 10. 

 

Kind regards, 

25-Diamond I
March 16, 2026

Variable and function definitions are better done outside and in front of the solve block.

The solve block on page 34 fails because with a guess of 38,1 mm the solution for which Mr(c11)>0 cannot be found by the algorithm used in Prime.

If we deactivate this constraint we get a solution.

grafik.png

 

If we use a larger guess value, we get the second solution for which M.r>0

grafik.png

 

Here you see the plot of function g along with its two zeros at 38.8 mm and 325.0 mm

grafik.png

It can be clearly seen that Mr is positive at the second zero.

Zooming in shows that Mr is negative at the first zero:

grafik.png

Prime 10 sheet attached.

BTW, when posting a worksheet for a question to be answered, its preferable to limit it to the necessary regions only so its easier to edit and clearer to see where the problem may be. I did not tamper the 34 pages in front, but at least I deleted the 100(!) pages after the relevant position.

10-Marble
March 19, 2026

Thank you very much both, I am also struggling to root the function on page 25 of the attached. Are you able to assist? 

10-Marble
March 19, 2026

Please ignore this request, I have got it working

25-Diamond I
March 19, 2026

You should test drive functions when you defined them!

Functions C.s and T.s never will evaluate and throw an error when you try to use them:

grafik.png

Reason is the vector index "k". Variable "k" is defined as a range (0;1) but must be a scalar integer.

The same problem also occurs in other function definitions you make!

 

If you expect a 2x1 vector as the result of these functions, you may either use a programmed for-loop

grafik.png

 

or you make the vectors used additional arguments of the function, treat them like scalar arguments and call the function vectorized with the vectors as arguments:

grafik.png

 

Another option, which you may like more, is to use vectorization already when defining the function:

grafik.png

But this does not work in all cases:

grafik.png

Reason in this case is the "min" function which is written to deal with vectors as well and so can't be vectorized.

A workaround could be to use a local auxiliary function which can be called vectroized:

grafik.png

If you make the other functions involved to work OK by whatever method, the root function will work as intended:

grafik.png

25-Diamond I
March 19, 2026

@IA_12699372 wrote:

Please ignore this request, I have got it working


Too late 🙂

But I see that you arrive at the same result as I did in my previous answer.

The 4-page-sheet you posted is just the kind of sheet you should post when asking a question. Showing only the vital calculations and not a 130+ page sheet which is nearly impossible to deal with.

Instead of

grafik.png

I would prefer

grafik.png

so that the resulting vector is just returned once at the end of the program AFTER the for-loop finishes.