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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Evaluation of a list of numbers

cgenger
4-Participant

Evaluation of a list of numbers

I'm hoping I'm missing a simple way of doing this...

cgenger_0-1704735522944.png

(MathCAD Prime 7.0.0.0)

 

Thanks

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:cgenger)

If your function ILt( ) is written in way to work OK with single, scalar arguments (of dimension 1/time) and you want to call that function with a vector of values as its argument and expect it to feed those values one by one into the function, evaluate it and collect the results in a vector, then you have to use vectorization because that's exactly what vectorization is made for!
Depending on how your function ILt( ) is defined it may not be necessary to manually apply vectorization as Prime might automatically implicitly applies it, but I always suggest to manually apply vectorization in such cases.
After all, if the function was written to work with a single scalar argument, there is no reason whatsoever that it should also work with a vector as its argument instead! So its perfectly OK and natural that you have to tell Prime what you expect it to do with the vector argument.

Werner_E_1-1704740862471.png

 

 

 

Use the appropriate keyboard shortcut or the menu to apply vectorization:

Werner_E_1-1704739930554.png

BTW, the keyboard short you see in the tooltip help might be wrong, depending on the keyboard you are using. On my German keyboard its Ctrl-Shift-6 (or Ctrl-Shift-&) and not Ctrl-Shift-^ as the help claims it to be.

 

 

View solution in original post

6 REPLIES 6

Hi,

please upload your mcdx file. In your picture the definition of ILt() function is not shown.

Dumb example:

MartinHanak_0-1704736204490.png

 

 

 


Martin Hanák
cgenger
4-Participant
(To:MartinHanak)

Hi Martin,

Sorry, can't upload it, too much proprietary info 🙄.

I guess I thought there would be a simple answer, like "don't define ft like that, do it this way."

There are other matrices in my ILt calc so i figure it's trying to apply this differently that I wanted.

when i use a number range it works fine (i.e. ft:= 1Hz,2Hz..12000Hz)

Thanks


@cgenger wrote:

Hi Martin,

Sorry, can't upload it, too much proprietary info 🙄.

I guess I thought there would be a simple answer, like "don't define ft like that, do it this way."

There are other matrices in my ILt calc so i figure it's trying to apply this differently that I wanted.

when i use a number range it works fine (i.e. ft:= 1Hz,2Hz..12000Hz)

Thanks


Hi,

I am almost sure you can create test mcdx file containing similar computation and upload it. Do not hesitate to do this if you need to receive a help.


Martin Hanák
LucMeekes
23-Emerald III
(To:cgenger)

The simple answer depends on how you defined the function ILt(). So if you can provide a (simplified) prototype of that function, which exhibits the same problem for you, we can tell you how to fix it.

 

Success!
Luc

Werner_E
25-Diamond I
(To:cgenger)

If your function ILt( ) is written in way to work OK with single, scalar arguments (of dimension 1/time) and you want to call that function with a vector of values as its argument and expect it to feed those values one by one into the function, evaluate it and collect the results in a vector, then you have to use vectorization because that's exactly what vectorization is made for!
Depending on how your function ILt( ) is defined it may not be necessary to manually apply vectorization as Prime might automatically implicitly applies it, but I always suggest to manually apply vectorization in such cases.
After all, if the function was written to work with a single scalar argument, there is no reason whatsoever that it should also work with a vector as its argument instead! So its perfectly OK and natural that you have to tell Prime what you expect it to do with the vector argument.

Werner_E_1-1704740862471.png

 

 

 

Use the appropriate keyboard shortcut or the menu to apply vectorization:

Werner_E_1-1704739930554.png

BTW, the keyboard short you see in the tooltip help might be wrong, depending on the keyboard you are using. On my German keyboard its Ctrl-Shift-6 (or Ctrl-Shift-&) and not Ctrl-Shift-^ as the help claims it to be.

 

 

cgenger
4-Participant
(To:Werner_E)

Ahhh, perfect.  Yes that did the trick, thanks Werner!  I'll try to remember to manually specify explicitly apply this in the future!

Announcements

Top Tags