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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Evaluate function containing min-function for vector

Bruggi
3-Visitor

Evaluate function containing min-function for vector

Dear Community,

I'd like to evaluate a user-defined function for multiple input arguments using a vector. The problem is that my function contains the min-function and the user-defined function is evaluated only for the smallest argument. The following illustration shows my (simplified) function to calculate the force distribution in a concrete plate.

2015-09-10_135349.png

Is it possible to adapt the function, so that a vector can be used as input argument, or do I have to use a range variable?

Thank you for your efforts!

1 ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald II
(To:Bruggi)

Use the vectorize operator; first select the whole expression on the right hand side and then apply vectorize from the Operator tab in the ribbon.

Stuart

(I assume none of the other variables are vectors? If they are a different approach might be needed)

View solution in original post

8 REPLIES 8
MikeArmstrong
5-Regular Member
(To:Bruggi)

Please post a worksheet containing the function and multiple inputs. 

Mike

StuartBruff
23-Emerald II
(To:Bruggi)

Use the vectorize operator; first select the whole expression on the right hand side and then apply vectorize from the Operator tab in the ribbon.

Stuart

(I assume none of the other variables are vectors? If they are a different approach might be needed)

StuartBruff wrote:

Use the vectorize operator; first select the whole expression on the right hand side and then apply vectorize from the Operator tab in the ribbon.

Stuart

(I assume none of the other variables are vectors? If they are a different approach might be needed)

Actually, it's not quite as straightforward as that - I'd forgotten that min behaves differently under vectorize to most functions.  However, there are several ways of dealing with the situation:

Stuart

Bruggi
3-Visitor
(To:Bruggi)

Thank you for your efforts. Using the vectorize operator works fine.

The following illustration shows the solution as intended.

2015-09-10_165204.png

MikeArmstrong
5-Regular Member
(To:Bruggi)

Also works in M15 using Vectorise.

Mike

Another method just for fun. Not that I would recommend this one.

Mike

Mike Armstrong wrote:

Also works in M15 using Vectorise.

Mike

But, But, But ... That means that if you ever have to use vector x again, you'll have to type the vectorize operator *again* <splutter>   This flies in the face of every principle of maximal laziness that I know of !!!!

Bateman's Famous "The Man Who Was Asked To Apply An Operator Twice Rather Than Write A Function To Avoid Doing So"

Stuart

MikeArmstrong
5-Regular Member
(To:StuartBruff)

Only offered options because I was bored.  

I personally wouldn't solve as I suggested unless it was end of my worksheet.

Mike

Top Tags