Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Translate the entire conversation x

Explicit not working with min, max functions

SB_10756135
2-Explorer

Explicit not working with min, max functions

Hello,


I have just started using Mathcad Prime 10.
Does Explicit work with min and max functions, or I am doing something wrong?

Please see below example screenshot. I'm sorry but I cannot attach the full example as it is too big and it is work related.

I get "The unit are not compatible" error.

 

GSKID is an Output expression from an excel component.

Bs is extracted from a matrix.

 

I have turned on Units/Constants in Symbols

 

SB_10756135_1-1742588605196.png

SB_10756135_2-1742588719413.png

 

 

ACCEPTED SOLUTION

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

Hard to say without seeing the sheet itself.

 

"explicit" sure has no problem with "min/max". It seems that the problem is the Excel component.

 

What happens if you add a region with "GSKID:=GSKID=  " below the Excel component. Note that the numeric evaluation (=) at the end of this expression is essential and you may change the unit "m" to "mm" in the result..

If this makes your expression work OK, we may call it a bug and you may consider reporting it to official PTC support.

 

EDIT: I can confirm that its a bug wich should be reported. When the symbolics evaluates the value from the Excel component, it gets the correct value with respect to the applied unit but is missing the unit itself.

Werner_E_0-1742591475809.png

Workaround is as explained above:

Werner_E_2-1742591724325.png

That way the symbolics does not trace back to the Excel component but instead uses the value from the end of the last assignment.
test2 shows that the symbolics which does not know anything about units is using the unit you use when defining the variable.

 

BTW, independent of units and symbolics its strange and disappointing that the Excel component does not allow inline evaluations (if this would work it may have helped making the workaround more compact and less obvious):

Werner_E_3-1742591836751.png

 

View solution in original post

4 REPLIES 4
Werner_E
25-Diamond I
(To:SB_10756135)

Hard to say without seeing the sheet itself.

 

"explicit" sure has no problem with "min/max". It seems that the problem is the Excel component.

 

What happens if you add a region with "GSKID:=GSKID=  " below the Excel component. Note that the numeric evaluation (=) at the end of this expression is essential and you may change the unit "m" to "mm" in the result..

If this makes your expression work OK, we may call it a bug and you may consider reporting it to official PTC support.

 

EDIT: I can confirm that its a bug wich should be reported. When the symbolics evaluates the value from the Excel component, it gets the correct value with respect to the applied unit but is missing the unit itself.

Werner_E_0-1742591475809.png

Workaround is as explained above:

Werner_E_2-1742591724325.png

That way the symbolics does not trace back to the Excel component but instead uses the value from the end of the last assignment.
test2 shows that the symbolics which does not know anything about units is using the unit you use when defining the variable.

 

BTW, independent of units and symbolics its strange and disappointing that the Excel component does not allow inline evaluations (if this would work it may have helped making the workaround more compact and less obvious):

Werner_E_3-1742591836751.png

 

Hi Werner_E,

Thank you very much for your prompt reply.

I got it to work (it was the excel comp). Here’s what I did:

1. When I first started using Explicit I did not have Units/Constants on Symbols turned on

2. I added the explicit for the max function and got the error

3. I did a bit of reading on the forum and found that I needed to turn on Units/Constants on Symbols

4. Turned on Units/Constants on Symbols and recalculated

5. The error was still there

6. I went in the excel component and replaced the filter formula for getting GasketInner Diam with the actual number 19.1

7. Recalculated and the explicit worked for the max function

8. Went back to the excel component and added back the filter formula

9. Recalculated and the explicit still worked for the max function

 

 

Thank you for your help Werner_E and pointing in the right direction.

 

 

upload_-aW1hZ2UwMDEucG5n-2731182901377608664..png

upload_-aW1hZ2UwMDIucG5n-3105986946538780485..png

 

Werner_E
25-Diamond I
(To:SB_10756135)

In the meantime I edited my answer above as I made some testing and found it to be the bug I suspected.

The workaround as explained and as seen in the last line in your picture is to redefine the variable and add an inline numeric evaluation. This stops the symbolics to trace back any further and so it is not trying to evaluate the Excel component.

The symbolics as explained above will use the very unit you use when defining the variable as it does not know anything about units and treats them as unknown. So for the symbolics "m" and "mm" and two different, unrelated variables.

The calc option "Units/Constants in symbolics" is misleading as all it does is to ensure that the labelling as "Units" remains intact in symbolic calculations. That way an expression derived by symbolic calculation can be evaluated numerically at the end without throwing the error as of the variable (the unit) not being defined. This error would occur in your example if you would deactivate this option.
IMHO there is no need for this option anyway as it should be active by default all the time. I see no reason and no benefit in being able to disable it.

Werner_E

 

Thank you for running testes yourself and confirming it is a bug.
I agree that Units/Constants in symbolics should be on by default and not be an on/off option.

I'm not sure how to report a bug.
I sent an request to Support Assistant and provide a link to this topic.

 

Than you,
Silviu

 

Announcements

Top Tags