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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Using a vector of values as an input for a function

ptc-5375931
1-Visitor

Using a vector of values as an input for a function

I have the problem that I would like to use a function with a set of values which are in an array. For example measured values.

My problem is that inside the function is a multiplication, so the vector is multiplicated with another vector. But I do not want this, I just want mathcad to take each value and to give out a vector with the results for each value in the input vector. This works if a range is defined but not with a vector. I understand that there is a matrix multiplication, but is there no way to tell mathcad what I want to do? Here is an example:

vector+multiplication.png

8 REPLIES 8
RichardJ
19-Tanzanite
(To:ptc-5375931)

Use the vectorize operator.

Thank you for the quick answer! I found another solution, but I like yours more. Anyway you could work with matrix indices.

vector+multiplication2.png

There was an unanswered question where someone did it this way, just found it by accident.

RichardJ
19-Tanzanite
(To:ptc-5375931)

Yes, you can use indices. That is a method that will always work, but if vectorizing works (which is usually the case, but not always) it is a lot faster. With very big vectors it can make a noticeable difference.

Why not create a vector in the first instance?

Have a read through the attached worksheets which have been passed in the forum many times.

That treatise about ranges and vectors from Stuart Bruff dating back to 2011 sure ist still worth reading for Prime users as well.

In case those users don't find a way to open files in real Mathcad format, find attached a pdf of both.

The Date at the lower left in the file is NOT the date the paper was written but just the date the pdf was created.

Cheers Werner - I dare not try and convert to Prime!!!!

Mike Armstrong wrote:

Cheers Werner - I dare not try and convert to Prime!!!!

No reason for doing so anyway. The pdf should suffice if someone is really interested.

Announcements

Top Tags