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

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

2 conditions

ldante
11-Garnet

2 conditions

Hi there I need some help to simplify the program that I made in Mathcad Prime  3.1 . I am using lookup  to get the required profile. But there are 2 conditions that I need to satisfy. If in condition 1 satisfied  the pre selected profiles. Condition two also should pass the utilization. If condition two did not pass how this will pre select up to a higher value to satisfy both conditions.  I attached the file for your reference.

1 ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:ldante)

I have experience that it does not work most of the time.

What you then should do is iterate inside the program for each of the input values.

So in essence:

r <- ORIGIN

if IsArray(x)

   for i el ORIGIN...last(x)

     Rr <- Select(xi,yi,data)

     r <- r+1

return R

will give you a nested array with the results.

Assumption is that y is as long as x. If not, your program becomes more complex.

Success!
Luc

View solution in original post

15 REPLIES 15
MJG
18-Opal
18-Opal
(To:ldante)

Many of us cannot open Prime 3.1 files.  Can you post a PDF of the whole document and/or better explain what you're trying to do.

LucMeekes
23-Emerald III
(To:ldante)

Your Prime file doesn't run for me. The Excel file is missing and a number of variables are undefined (due thereto?).

I see no way to use the lookup functions of Prime to do what you need. It can be done using a program, see my example below in the program "Select", and two examples of its use:

This was done in Mathcad 11, (my Prime Express doesn't allow programming),

but you should be able to recreate the Select function in Prime.

Success!
Luc

HI Luc,

I tried to adopt your program  and this is the result I am getting . How can I get the optimum value?

Thank you

LucMeekes
23-Emerald III
(To:ldante)

Lex,

What is the criterion for the optimum solution?

Luc

Luc,

The last selection

ldante
11-Garnet
(To:ldante)

Luc,

Hi. The last selected profile should be the answer since x and y already satisfy the criteria.

I have another problem. when I tried to make a couple of array this is what happened. Vectorization is possible in this formula?

MJG
18-Opal
18-Opal
(To:ldante)

In Luc's definition of "select", if you change R[r in the fourth line to just R, you should get what you want.  You can then also delete the first and fifth lines.

To use the vectorize option, you must place it over the called function.  I'm not sure if it will work with Luc's program or not.  It would look something like this:

test := select(M1,M2,data) =

(I used underline where you should place the vectorize modifier)

M1 & M2 are your input matricies.

ldante
11-Garnet
(To:MJG)

Mark

This one works thank you.

MJG
18-Opal
18-Opal
(To:ldante)

Lex,

Thanks goes to Luc - he did the hard part.

Also, here's a more optimized way to achieve what you want.  This cycles backwards and stops the program when it finds the first solution (from the bottom) istead of cycling through every line.  I checked, and it works with the vectorize notation.

MJG
18-Opal
18-Opal
(To:MJG)

I would also recommend adding a line in case there is no solution:

ldante
11-Garnet
(To:MJG)

HI Mark.

Using Math cad prime 3.1 this is the correct program . I am not getting the same result

MJG
18-Opal
18-Opal
(To:ldante)

Lex,

Here is what the solution looks like in Prime:

LucMeekes
23-Emerald III
(To:ldante)

I have experience that it does not work most of the time.

What you then should do is iterate inside the program for each of the input values.

So in essence:

r <- ORIGIN

if IsArray(x)

   for i el ORIGIN...last(x)

     Rr <- Select(xi,yi,data)

     r <- r+1

return R

will give you a nested array with the results.

Assumption is that y is as long as x. If not, your program becomes more complex.

Success!
Luc

Thank you  for your effort  and assistance .

ldante
11-Garnet
(To:ldante)

 

Hi.

Here is the attached excel file and pdf file format.

 

Step 1: I used lookup "It" to get the pre-selected profile by deflection criteria,

 

Step 2: I used lookup "eq" to select the profile base on step 1

 

Step 3: I used look up "eq" to select section modulus from the excel data.

 

Step 4:  some condition the design moment will exceed from the allowable. 

 

Step 5: I need to compare step 1 and 4 if both will satisfy the design criteria otherwise step 1 will select another data to satisfy step 4.

 

 

I don't know if this will be clear to you now.

 

 

Regards

 

Top Tags