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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Get results for three input values , Mathcad15

SFares
12-Amethyst

Get results for three input values , Mathcad15

Hello,

I have few questions in the attached MathCAD 15 sheet:

1. I had to Victoria's the equation to make it work but i did not do to others. I'd like to know why.

SFares_0-1668088318164.png

2. I expect to see three values in the results for each variable, but not able to. My initial input is three lengths Lx, Ly and Lz and I need to get the strength results for  three different lengths. Then arrange then as such  so for each length, the corresponding strength.

 

SFares_1-1668088455796.png

Thanks,

Sam

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:SFares)

There are some functions in operators which can't be vectorized. "min" is such a function. Furthermore you provide a nested matrix (1 x 4 consisting of 3 x1 vectors) as argument and vectorization would try to unravel the outer matrix as well.

There are three ways around this problem, I could think of:

1) Use a worksheet range variable to select the individual vector elements and apply the calculations to them:

Werner_E_0-1668092673108.png

Of course you simply could use i:=0..2 if you are sure that ORIGIN is set to 0 and there are only three elements in the vectors.

 

2) Same calculation as 1) but turned into a small program to avoid having to define a range variable (this would be my preferred option)

Werner_E_1-1668092783940.png

 

3) Define a user function (I used Min() with a capital "M" as function name) which then can be called vectorized:

Werner_E_2-1668092865409.png

 

You will experience a similar problem when calculating F.n because comparison operators like <= also can't be vectorized. Again you have the same three options as before (here I'd go for #3 but the choice is up to you):

Werner_E_3-1668093021258.png

BTW, there is no special reason for choosing the if-function instead of the programed if-statement in the second option. Just for variety 😉

 

A generally different solution could also be to change the basic setup of the sheet. By this I mean that you don't immediately calculate the values but rather turn the calculations into functions depending on the input values L.x, L.y and L.z.

Then you can define the vectors L.x, etc. later and call those functions vectorized.

Its more work and may not look that intuitive, but an additional benefit is that you can very easily calculate results for different input values and compare them:

Werner_E_0-1668095894720.png

 

One last remark: Its not necessary to define the units ksi and kip. They are already predefined in Mathcad.

 

View solution in original post

2 REPLIES 2
Werner_E
24-Ruby V
(To:SFares)

There are some functions in operators which can't be vectorized. "min" is such a function. Furthermore you provide a nested matrix (1 x 4 consisting of 3 x1 vectors) as argument and vectorization would try to unravel the outer matrix as well.

There are three ways around this problem, I could think of:

1) Use a worksheet range variable to select the individual vector elements and apply the calculations to them:

Werner_E_0-1668092673108.png

Of course you simply could use i:=0..2 if you are sure that ORIGIN is set to 0 and there are only three elements in the vectors.

 

2) Same calculation as 1) but turned into a small program to avoid having to define a range variable (this would be my preferred option)

Werner_E_1-1668092783940.png

 

3) Define a user function (I used Min() with a capital "M" as function name) which then can be called vectorized:

Werner_E_2-1668092865409.png

 

You will experience a similar problem when calculating F.n because comparison operators like <= also can't be vectorized. Again you have the same three options as before (here I'd go for #3 but the choice is up to you):

Werner_E_3-1668093021258.png

BTW, there is no special reason for choosing the if-function instead of the programed if-statement in the second option. Just for variety 😉

 

A generally different solution could also be to change the basic setup of the sheet. By this I mean that you don't immediately calculate the values but rather turn the calculations into functions depending on the input values L.x, L.y and L.z.

Then you can define the vectors L.x, etc. later and call those functions vectorized.

Its more work and may not look that intuitive, but an additional benefit is that you can very easily calculate results for different input values and compare them:

Werner_E_0-1668095894720.png

 

One last remark: Its not necessary to define the units ksi and kip. They are already predefined in Mathcad.

 

SFares
12-Amethyst
(To:Werner_E)

Thank you so much Werner!

Top Tags