Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get max. value from a range

Status
Not open for further replies.

sasmab

Mechanical
Feb 4, 2009
3
Who knows?

I want to get the maximum value out of a range of values.
The range is the result of a function.
Simplified, the function looks like this. I put 'X' in a range and therefore the result 'A(x)' is also a range.

X = 0, 1 .. X.max
A(X) = B(X)/C

I tried to get a maximum like this:

max (A(0), A(1) .. A(X.max))

Mathcad gives me the result '0'
The thing is, when I try this with 'min', I get the correct minimum result.
 
Replies continue below

Recommended for you

You should assign the values to a variable and find the maximum. max and min are actually defined for arrays.

TTFN

FAQ731-376
 
X as you have defined it is a range variable, not an array. As IRstuff said, max and min apply to arrays. A(X) defines a function of X, where X is a parameter not necessarily related to the range variable you defined. You don't say what B(X) is, but is is also a function of X.

You need to define an array, like A[sub]X[/sub]
A[X:=X/2 or something like that. Then you can find max(A)

I suggest you go to Help|Tutorials|Features In-Depth|Arrays and Range Variables.
 
Thanks a lot!

I put all the results inside an array and now mathcad finds my max en min value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor