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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Help with a step function

DJF
16-Pearl
16-Pearl

Help with a step function

I'm stacking different plates and need to know a property (modulus) at any given height depending on which plate that height falls into.  I toyed with lookups, matches and ifs but the only thing I got to work is shown here.  It does work, but it doesn't seem very efficient for what I thought was a simple problem.  I'm betting there is a very elegant solution.  I'd appreciate any improvements. Thanks.

(Prime 3.1)

pic3.jpg

1 ACCEPTED SOLUTION

Accepted Solutions

AlvaroDíaz wrote:

In Prime can you use TOL as local inside Yng function?

Unfortunately this would have not the desired effect.

The way equality is implemented in the match and lookup functions is very bad and often confusing. In many cases its better to write ones own routine doing the job in a better .

As we have the modifier "near" (also available in Mathcad 15 if we use Lookup with capital L) I see no need to limit the equality to a range with tolerance TOL. Those functions should use full numeric precision when comparing numbers. Probably one could add a tolerance as function argument (maybe only in conjunction with "near") .

Fortunately match and lookup are rather easy to implement in a better way, with better error handling, etc. But it sure should not be necessary that we do that ourself.

Regards Werner

P.S.: Here is an alterative to my former "Yng" which does not depend on the value of TOL and I guess that now the result at the borders of the range are correct, corresponding to the routine provided by dferry. Also there is no need for the separate calculation of the vector height.

View solution in original post

3 REPLIES 3
Werner_E
24-Ruby V
(To:DJF)

Maybe something like the following

Hi Werner.

In Prime can you use TOL as local inside Yng function?

Best regards.

Alvaro.

AlvaroDíaz wrote:

In Prime can you use TOL as local inside Yng function?

Unfortunately this would have not the desired effect.

The way equality is implemented in the match and lookup functions is very bad and often confusing. In many cases its better to write ones own routine doing the job in a better .

As we have the modifier "near" (also available in Mathcad 15 if we use Lookup with capital L) I see no need to limit the equality to a range with tolerance TOL. Those functions should use full numeric precision when comparing numbers. Probably one could add a tolerance as function argument (maybe only in conjunction with "near") .

Fortunately match and lookup are rather easy to implement in a better way, with better error handling, etc. But it sure should not be necessary that we do that ourself.

Regards Werner

P.S.: Here is an alterative to my former "Yng" which does not depend on the value of TOL and I guess that now the result at the borders of the range are correct, corresponding to the routine provided by dferry. Also there is no need for the separate calculation of the vector height.

Top Tags