Skip to main content
14-Alexandrite
June 8, 2018
Question

Minimize error and Find error

  • June 8, 2018
  • 2 replies
  • 6827 views

Hi, In the attached sheet Minimize is not working correctly. The Minimize value given changes to the Guess value all the time giving an incorrect result. Further in the sheet I am using Find to solve a matrix equation and then using this result in a subsequent calculation (Transfer Matrix method). The first Find calculation seems to work but the second identical calc throws an undefined variable error, cannot see why. Any assistance would be appreciated. thanks Ross

2 replies

19-Tanzanite
June 9, 2018

Your first solve block has a function of omega. Your second solve block has no function, so Mathcad has no variable that it can change. The error message is misleading. Since version 12, this is the only error message a solve block spits out, regardless of what the problem actually is. This serious bug has been around for at least a decade, but neither Mathsoft nor PTC could be (or in the case of PTC, can be) bothered to fix it. A solve block has to have a function of a variable, or variables, that the solve block can change to find a solution.

remslie14-AlexandriteAuthor
14-Alexandrite
June 10, 2018

Richard, Thanks for taking the time to assist. Minimize seems to do some strange things! Please take a look at the attached sheet which is an earlier version of the one posted. Two things are happening I do not understand. 1) In this sheet Minimize works correctly for both mimima one at 536 rad/sec and the other at 929 rad/sec with the higher value being evaluated with the constraint w>700 - all good. For the 929 value a simple division by 2.pi reverts back to the earlier 536 solution above. Why is this so. I thought things reset after the second 'Given" statement with new guess values and constraints.

2) Why doesn't the graph of det(BB(w)) not show in the in the plot below the first "Given" statement? It shows fine in the copy to the RHS but as soon as you drag this graph down half a centimeter the graph disappears?

So Minimize seems to evaluate the minima within the assigned constraints correctly in the sheet attached to this post but does not in the earlier sheet.

In your response below to the first sheet I attached in the original post you say there is no function in the second solve block, but I am using the same function in the second "Given" as was used in the first but merely seeking to find a second minima of the same function. This is the same solve detail as in the sheet attached to this post but Minimize does not work for either solves in the fist sheet it simply gives the Guess value.

 

Cheers

Ross

25-Diamond I
June 10, 2018

ad 1)

Minimize can be used in a solve bock or standalone.

The only reason for using a solve block in your sheet is the constraint omega>700 (you could define CC before the "Given".

When you call minimize the second time you call it standalone and so the constraint omega>700 is not considered. Thats the reason you get the value 536 again.

 

ad 2)

Mathcad reads the sheet from top down and from left to right. Every region has its own reference point witrh that respect (you can see it when you chose View-Regions).

The plot on the right is above the definition omega:=330 and so omega is still the range you have assigned above and this range is used for plotting.

If you drag the plot region down a bit so that its below the redefinition of omega, omega is a single constant value, not a range anymore. So only one tiny red dot would be shown at omega=330 (you will have to set the left value on the abscissa to something like 300 and change the Line Weight of the plot to a higher value to see that dot).

Workaround would be to use a different name for the variable in the plot. A tricky name would be "omega.". Thats the dot you would use for a literal index without anything after it. You will see the dot while the focus is on the plot region, but when you go out it will look like a normal omega.

21-Topaz II
June 9, 2018

Hi,

I fear that something is wrong with the size of the matrices.

Ross.jpg

19-Tanzanite
June 9, 2018

@-MFra- wrote: something is wrong with the size of the matrices.

Ross.jpg


Yeah. I should have noticed that. It was getting late though Smiley LOL


Ross.jpg


 

remslie14-AlexandriteAuthor
14-Alexandrite
June 10, 2018

MF, Richard, That's a touch embarrassing. In fact whilst I was noodling over the problem just before your responses I discovered the fact that the matrices are of different size. I have corrected that but I am still having problems. I will spend a little more time trying to rectify before summoning further assistance.

Cheers

ross