Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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.
Solved! Go to Solution.
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
Here I changed a.1 from 1.5 to 2.5 m/s^2 and the symbolics seem to provide a valid solution:
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!
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
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
Here I changed a.1 from 1.5 to 2.5 m/s^2 and the symbolics seem to provide a valid solution:
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!
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
Hi Werner
Thanks a lot for your comments!
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
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!!???
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
even though it works pretty fine, but rather use something like
just to be on the safe side.
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.
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