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

Translate the entire conversation x

Mean-Max- Min functions for vectors

YA_10963798
14-Alexandrite

Mean-Max- Min functions for vectors

Hi everyone, 

I have this function that I used to find R from it 

YA_10963798_3-1767774598458.png

 

Now I want to find the min, max and max  from it ..but didn't work . It tells me that the values should be scalar 

YA_10963798_4-1767774690540.png

 

and when I do this , it gives me the same results of the original one not the average

YA_10963798_2-1767774017156.png

I need to find the min, average , and max values

Thanks 

Yusra 

 

ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald IV
(To:YA_10963798)

You may need to recalculate the sheet.

 

Success!
Luc

View solution in original post

8 REPLIES 8
LucMeekes
23-Emerald IV
(To:YA_10963798)

Hi Yusra,

Your z.tips is a range, not a vector. Applied to a function that makes the function result a range at best, but not a vector.

 Try making z.tips a vector, e.g. with:

LucMeekes_0-1767779509130.png

and vectorise your expression:

LucMeekes_1-1767779616997.png

Success!
Luc

YA_10963798
14-Alexandrite
(To:LucMeekes)

It didn't work, do you think I'm missing something?

YA_10963798_0-1767780867140.png

YA_10963798_1-1767780887806.png

 

LucMeekes
23-Emerald IV
(To:YA_10963798)

Don't vectorise the other expression:

LucMeekes_0-1767781520463.png

Success!

Luc

YA_10963798
14-Alexandrite
(To:LucMeekes)

YA_10963798_0-1767781625229.png

When I do this another error appears because I change ztips... but when ztips is range it works again 

YA_10963798_1-1767781768802.png

 

 

LucMeekes
23-Emerald IV
(To:YA_10963798)

You may need to recalculate the sheet.

 

Success!
Luc

YA_10963798
14-Alexandrite
(To:LucMeekes)

thanks it works

Werner_E
25-Diamond I
(To:YA_10963798)


@YA_10963798 wrote:

 

When I do this another error appears because I change ztips... but when ztips is range it works again 



When you do - what?

Luc told you that you should NOT use vectorization when you DEFINE the function R...

NOT 

Werner_E_0-1767787747733.png

but rather

Werner_E_1-1767787766404.png

as you initially did.

 

Or are you irritated because of the green boxes and think that they indicate an error? They don't, its just a warning because you already had defined ztips before and you are now overwriting/replacing that definition by a new one. Warnings can be turned off in the menu

Werner_E_2-1767788097028.png

Click the upper part of that button to turn on or off the warnings. Clicking the arrow let's you select in detail if the warning should concern functions, units, constants, variables.

 

As you are using Prime 11 you can also use the new function "vec" to define ztips as a vector, if you like:

Werner_E_3-1767788318749.png

 

You can't vectorize the definition of the function R.s;cal;max because this would also vectorize the vectors z and q, but these must remain vectors.

If you find it annoying having to vectorize the function CALL every time when you use it in your sheet with e vector ztips as its argument instead of the expected scalar argument, you can define it using a local function which you call vectorized in the definition:

Werner_E_4-1767788890026.png

That way you can use that function either with a scalar argument ztips or with a vector as its argument.

But you should not use a range as this would be a misuse of a range for something its not intended for. Exception is when you make a plot. Here using a range is perfectly OK:

Werner_E_0-1767790313826.png

You may get the same plot if you use a vector instead, though.

 

Ranges should be used in three occasions only:

  • in plots
  • for indexing the elements of a vector or matrix
  • inside a program as part of a for-loop

 

 

YA_10963798
14-Alexandrite
(To:Werner_E)

Brilliant as always thanks 

Announcements

Top Tags