Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Did you know you can set a signature that will be added to all your posts? Set it here!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Oct 14, 2021
02:28 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 14, 2021
02:28 PM

Solve Block Error

Hey Community!! I am using Mathcad in my work place and one of the problem requires extremely complicated solve blocks. The Solve block that I am working has near to 20 equations and 20 unknowns, it used to shoot errors that the units are not compatible, which I diagnosed after some work, but now the solve block works but the never end up getting solution. When I calculate the problem for a single point in an other Mathcad sheet it works very fast and nice. But when it is combined with equations in a solve block, it never finds a solution instead shoots error ("Solution not found, change guess value or tolerances"). I did try changing the guess values, nothing works and tolerance is set to 10^-1, the maximum that it could be set for. What should I do in such case? I used the guess values from my single point solution.

I cannot upload the entire mathcad file because of company's privacy matters but I can attach screen shots.

Thanks in Advance.

Solved! Go to Solution.

Labels:

ACCEPTED SOLUTION

Accepted Solutions

Oct 18, 2021
06:43 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 18, 2021
06:43 PM

Hi,

Cannot help with the lack of convergence without seeing the parametrized solve block!

I have no interest in commercializing or passing on your solve block, but I would like to help. Hover the mouse over a name in the top right corner of a reply and you can send a private message with the full file.

It is possible to clean up the programming.

a) With a column vector it is only necessary to use one index into the rows not a dual index. Instead of "i,0" use just "i". Instead of "j,0" use just "j"

b) The final output needs to be outside the two loops not within them

So for example

Cheers

Terry

11 REPLIES 11

Oct 14, 2021
06:02 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 14, 2021
06:02 PM

Without seeing the worksheet, it is going to be hard to diagnose your problem. Here are some remarks that may, or may not, help:

Two of the parameters in the list that you are trying to solve appear (from their font usage) to be units: ** R.einlet** and

There's an empty placeholder on the last line of your definition for Psac(). You may want to remove it.

Is this Psac nested loop part of the solve block? Depending on the sizes of the two arrays called in there, it may be an explanation for long calculation...

Instead of: For i ElementOf 0 .. length(<array>)

it's generally better to use: For i ElementOf ORIGIN .. last(<array>).

That will work for any setting of your array index origin

Success!

Luc

Oct 15, 2021
06:06 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 15, 2021
06:06 PM

Hello @LucMeekes . thanks for the quick and elaborate reply. Those are unit less variables. I don't know why mathcad is considering it as the units. I took the empty space holder and still does not work. Also I did not understand what did you mean by origin.

Oct 16, 2021
10:33 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 16, 2021
10:33 AM

Hi,

*"Also I did not understand what did you mean by origin."*

By default the indices into a matrix or vector start with zero. You can change this with the ORIGIN worksheet variable. By default it is set to zero.

If you want the indices to start at one you need to change the ORIGIN value.

You use the variable ORIGIN at the start of iteration to make the sheet work no matter what ORIGIN is set too.

Cheers

Terry

Oct 15, 2021
04:22 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 15, 2021
04:22 AM

Is it possible that you will be able to insert only the problematic part of the program into a new Prime worksheet?

Oct 15, 2021
06:03 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 15, 2021
06:03 PM

Hi @VladimirN thanks for the reply, it wont be possible to transfer the problem part alone. The problem part is dependent on upstream solve block, I cannot disclose solve block as its the backbone of the model and is property of the company.

Oct 16, 2021
12:56 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 16, 2021
12:56 PM

Hi,

It will be hard to examine the problem without seeing the solve block.

When faced with a solve block that is not converging I adopt the following strategy.

1) Put the tolerance back to default.

2) Use a set of guess values that are causing the problem.

3) Use a set of guess values that you know work. And temporarily set the answers to values above the equations in 4 so you get results.

4) Outside the solve block examine the LHS and RHS separately of the eighteen equations of the solve block with the values from 2) and 3)

This is easily achieved by simply cutting and pasting from inside the solve block to outside

By doing this you will find which equation is giving problems. If this fails try 5)

5) It may also help to graph the eighteen LHS and RHS to see what the equations are doing over the range of possible values.

Perhaps you can get one of the helpers here to sign a non-disclosure document and then you can share the solve block.

Cheers

Terry

Oct 18, 2021
02:26 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 18, 2021
02:26 PM

Hi @terryhendicott , thanks for the reply. I did try your strategy of working out equations of solve block. The function works with the single value perfectly but does not work for the matrices. Please look into the screenshots that I am attaching, one with the matrix and other same function with the single value.

The matrix function takes hours of solving and then shoots the error that you see. But works fine if I load values in function. Is there anything that you would suggest to do in case of matrix?

Oct 17, 2021
04:44 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 17, 2021
04:44 AM

"Try changing guess value, TOL or CTOL" is only a suggestion that sometimes help, an idea what you can check if you see this message. This message does not imply that changing TOL, CTOL or guess value will help in any case when you see this message.

It is possible that solution does not exist at all, or cannot be found using algorithms that solve block is trying based on the given input.

LucMeekes raised an interesting point and I would suggest to check labels. Keep in mind that if you have same name decorated with different labels - they are treated as different identifiers.

You can also try to use minerr instead of find, but be sure to substitute the solution to original equation(s) and see how close you got to true equality.

If it does not help you can try to use symbolic evaluation to find solution. To solve more than one equation group the equations in a vector.

Oct 18, 2021
02:54 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 18, 2021
02:54 PM

Hi @MSheykman , thanks for the reply and adding the same comment as in previous comment. The function works with the single value perfectly but does not work for the matrices. Please look into the screenshots that I am attaching, one with the matrix and other same function with the single value.

The matrix function takes hours of solving and then shoots the error that you see. But works fine if I load values in function. Is there anything that you would suggest to do in case of matrix?

Oct 18, 2021
04:17 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 18, 2021
04:17 PM

Your screenshot it hardly readable and you don't show the definition of the function you are calling. So there is not much which can be said.

Just a shot in the dark: You may try to vectorize that function call and see if it helps.

Oct 18, 2021
06:43 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Oct 18, 2021
06:43 PM

Hi,

Cannot help with the lack of convergence without seeing the parametrized solve block!

I have no interest in commercializing or passing on your solve block, but I would like to help. Hover the mouse over a name in the top right corner of a reply and you can send a private message with the full file.

It is possible to clean up the programming.

a) With a column vector it is only necessary to use one index into the rows not a dual index. Instead of "i,0" use just "i". Instead of "j,0" use just "j"

b) The final output needs to be outside the two loops not within them

So for example

Cheers

Terry