cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Solve block: bad solve body

Rik1982
3-Newcomer

Solve block: bad solve body

My students and I use Mathcad to solve problems of dynamics. My students this year (prime 10.0.0.0) come sometimes across an unknown error when using a solve block. The error mentions "bad solve block"; refer also to the screenshot. I have never come across it before and I have no clue what the reason could be for this error.

 

After retyping the equtions and the "find" command, the solve block executes correctly. But I don't see a difference between the original solve block and the one after retyping it. So it stays a mistery why one time it executes and the other time it doesn't.

 

Schermafbeelding 2024-10-14 223314.png

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Rik1982)

Are you sure that the equations are correct?

I notice that you defined t.0 and a.2 but they are never used.

 

Solving the system symbolically shows that you run into troubles (division by zero) if a.0 = a.1

Werner_E_0-1728942756603.png

Here I changed a.1 from 1.5 to 2.5 m/s^2 and the symbolics seem to provide a valid solution:

Werner_E_1-1728943130794.png

Unfortunately the numeric solve block still fails 😞

 

EDIT:

Ahhh! Seems you found a bug in Prime 10, Feel free to report it to official PTC support.

The problem is the inline evaluation in the definition of the guess value for v.1.

Delete it (and evaluate in a separate region if necessary) and the solve block works OK - at least if a.0 and a.1 are different!

Werner_E_2-1728943603424.png

As we have seen from the symbolic solution, there are two sets of solutions stemming from the underlying quadratic equations. In the solve block above we got the (presumably undesired) solution which includes negative values.

To get the other set of solutions you may either provide better guess values (even t.1:=9s will do the job with the values given) or you add additional constraints, for example t.1>0

Werner_E_3-1728943744258.png

 

View solution in original post

5 REPLIES 5
Werner_E
25-Diamond I
(To:Rik1982)

Are you sure that the equations are correct?

I notice that you defined t.0 and a.2 but they are never used.

 

Solving the system symbolically shows that you run into troubles (division by zero) if a.0 = a.1

Werner_E_0-1728942756603.png

Here I changed a.1 from 1.5 to 2.5 m/s^2 and the symbolics seem to provide a valid solution:

Werner_E_1-1728943130794.png

Unfortunately the numeric solve block still fails 😞

 

EDIT:

Ahhh! Seems you found a bug in Prime 10, Feel free to report it to official PTC support.

The problem is the inline evaluation in the definition of the guess value for v.1.

Delete it (and evaluate in a separate region if necessary) and the solve block works OK - at least if a.0 and a.1 are different!

Werner_E_2-1728943603424.png

As we have seen from the symbolic solution, there are two sets of solutions stemming from the underlying quadratic equations. In the solve block above we got the (presumably undesired) solution which includes negative values.

To get the other set of solutions you may either provide better guess values (even t.1:=9s will do the job with the values given) or you add additional constraints, for example t.1>0

Werner_E_3-1728943744258.png

 

Rik1982
3-Newcomer
(To:Werner_E)

Hi Werner

 

Thanks a lot for your comments!

  • you are right, the value for a.1 should be -2 m/s² (mistake in the file of student); but that still doesn't solve the bad solve body
  • indeed deleting the inline evaluation of v.1 makes the difference and the solve block executes
  • interesting is that after executing the solve block and then adding the inline evaluation of v.1 is no longer a problem for Mathcad. I understand that Mathcad has some "rules" of how to enter values and commands, but this is then something I wouldn't expect. Moreover, teaching/encouraging students to use Mathcad (oh yes, they are reluctant!) is more easy if you can "explain everything"... 🙂

 

But many thanks! I can tell my students not to do the inline evaluation in a Solve block.

 

For your information/interest, I include my copy of the complete dynamics problem.

 

Best regards

Rik

Werner_E
25-Diamond I
(To:Rik1982)

I tried to track down the error using a simpler example, but I failed in reproducing the error. Inline evaluation of a guess variable worked fine with and without units and also by defining the variable in a non-default unit first.
Not sure what exactly triggered that error in your sheet.

When I again loaded your sheet now to correct the value of a.1 I deleted the inline eval of v.1 and the solve block worked OK. Just out of curiosity I readded the very same inline evaluation and expected the solve block to fail again .... but it didn't!!???

Werner_E_2-1728992298820.png

So the reason for this bug remains a mystery and cannot be explained (at least not by me). But it sure should be fixed by PTC.

 

Inline evaluations were the cause of some unexpected problems already back in the times of real Mathcad (Mathcad up to version 15), Most of the time calculating a value and in the same region also displaying the resukt would work perfectly fine but sometimes it failed with a strange unexplainable error. So I got used to avoid inline evaluations altogether (although I never was 100% consequent in doing so).

That said, I would not use

Werner_E_0-1728991799091.png

even though it works pretty fine, but rather use something like

Werner_E_1-1728991850881.png

just to be on the safe side.

 

StuartBruff
23-Emerald III
(To:Werner_E)

I looked at the XML code and couldn't spot any obvious differences between the bug block and the better block. Also, when I copied expressions from the affected block to a new block (without the evaluation), it threw the same error, which didn't show up when I copied them a second time.   

 

Stuart

 

I also spent some time this afternoon hunting an elusive bug that disappeared when I recalculated the worksheet out of sheer desperation.  The problem appeared to be related to moving an ORIGIN definition from one part of the worksheet to another.

LucMeekes
23-Emerald III
(To:Rik1982)

Better tell your students not to do the inline evaluation at all.

Reason: It often works, but too often it results in problems.

 

Here's an (other) example: https://community.ptc.com/t5/Mathcad/The-variable-is-undefined-Check-that-the-label-is-set-correctly/m-p/977765#M214345

 

Success!
Luc

Announcements

Top Tags